从 POST 上不成功的低级调用构建的无效 NEST 响应 [英] Invalid NEST response built from a unsuccessful low level call on POST
问题描述
我想从 C# 代码配置 NEST当我使用 Kibana 命令时 GET/_cat/indices?v
I want to configurate NEST from c# code
When I use Kibana command GET /_cat/indices?v
我得到了这个结果:
我的测试索引是客户"
我正在使用 Elasticsearch.Net 和 NEST:.NET 客户端 [6.x]弹性6.5.4",现在这就是我在 C# 上的配置方式:
I'm using Elasticsearch.Net and NEST: the .NET clients [6.x] Elastic "6.5.4", Now this is how I configurate on C#:
var settings = new ConnectionSettings(new Uri("http://localhost:9200"))
.DefaultIndex("customer");
var client = new ElasticClient(settings);
var newCustomer = new Customer
{
name = "test_name",
OS = "test_os",
script = "test_script"
};
var indexResponse = client.IndexDocument(newCustomer);
然后我收到一个错误:
Invalid NEST response built from a unsuccessful low level call on POST: /customer/customer
为什么它会向/customer/customer 构建请求???我配置错了什么?
why does it build request to /customer/customer ??? What am I configurating wrong?
错误信息:
从 POST 不成功的低级调用构建的无效 NEST 响应:/customer/customer此 API 调用的审计跟踪:- BadResponse:节点:http://localhost:9200/ 占用:00:00:00.2817669OriginalException: Elasticsearch.Net.ElasticsearchClientException: Удаленный сервер возвратил ошибку: (400) Недопустимый запрос.. 调用:状态码 400 来自:customer POST/customer/服务器错误:类型:非法参数异常原因:拒绝对 [客户] 的映射更新,因为最终映射将有不止一种类型:[_doc,客户]"---> System.Net.WebException:Удаленный сервер возвратил ошибку:(400)Недопустимый запрос.
Invalid NEST response built from a unsuccessful low level call on POST: /customer/customer Audit trail of this API call: - BadResponse: Node: http://localhost:9200/ Took: 00:00:00.2817669 OriginalException: Elasticsearch.Net.ElasticsearchClientException: Удаленный сервер возвратил ошибку: (400) Недопустимый запрос.. Call: Status code 400 from: POST /customer/customer. ServerError: Type: illegal_argument_exception Reason: "Rejecting mapping update to [customer] as the final mapping would have more than 1 type: [_doc, customer]" ---> System.Net.WebException: Удаленный сервер возвратил ошибку: (400) Недопустимый запрос.
推荐答案
您在 ES 中已经有一个映射,但您要索引的文档与其不匹配.
You have already a mapping in ES and the document you want to index doesnot match with it.
这篇关于从 POST 上不成功的低级调用构建的无效 NEST 响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!