【发布时间】:2016-09-18 16:45:27
【问题描述】:
我在运行时生成了许多不同的值集合,并希望将它们发送到 ElasticSearch。我可以将它们表示为List<object>,或者如果真的不能以任何其他方式工作,则表示为List<string>。但我找不到任何示例如何做到这一点。这是一个不起作用的代码示例。它可能有很多错误,因此非常感谢任何其他指针。
var client = new ElasticClient(new Uri("http://localhost:9200"));
client.CreateIndex("testentry");
var values = new List<object> {"StringValue", 123, DateTime.Now};
var indexResponse = client.Index(values, descriptor => descriptor.Index("testentry"));
Console.WriteLine(indexResponse.DebugInformation);
结果:
Invalid NEST response built from a unsuccessful low level call on POST: /testentry/list%601
# Audit trail of this API call:
- [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.0600035
# ServerError: ServerError: 400Type: mapper_parsing_exception Reason: "failed to parse" CausedBy: "Type: not_x_content_exception Reason: "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes""
和
[2016-09-17 14:16:20,955][DEBUG][action.index ] [Gin Genie] failed to execute [index {[t
estentry][list`1][AVc4E3HaPglqpoLcosDo], source[_na_]}] on [[testentry][1]]
MapperParsingException[failed to parse]; nested: NotXContentException[Compressor detection can only
be called on some xcontent bytes or compressed xcontent bytes];
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:156)
我正在使用 Elasticsearch.Net 2.4.3 和 NEST 2.4.3。
【问题讨论】:
标签: c# elasticsearch nest