【发布时间】:2016-06-17 13:17:43
【问题描述】:
我正在尝试将一些 JSON 数据插入到弹性搜索中进行测试。
代码如下:
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node);
settings.DefaultIndex("FormId");
var client = new ElasticClient(settings);
var myJson = @"{ ""hello"" : ""world"" }";
var response = client.Index(myJson, i => i.Index("FormId")
.Type("resp")
.Id((int)r.id)
.Refresh()
);
没有插入任何内容,我从 ES 收到以下错误: {通过对 PUT 的不成功的低级别调用构建的无效 NEST 响应:/FormId/resp/1?refresh=true}
我试图找到一些示例,但都使用预定义的数据结构,而不是我想使用 JSON 数据和非结构化数据。
以上错误信息来自 NEST。 Elastic 回复(并在日志中写入)以下消息: MapperParsingException[解析失败]; nested- NotXContentException[压缩器检测只能在某些xcontent字节或压缩xcontent字节上调用];
解析失败 { ""hello"" : ""world"" } ????
【问题讨论】:
标签: c# json elasticsearch kibana nest