elasticsearch,curl,aws-elasticsearch,Amazon Web Services,elasticsearch,Curl,Aws Elasticsearch" /> elasticsearch,curl,aws-elasticsearch,Amazon Web Services,elasticsearch,Curl,Aws Elasticsearch" />

Amazon web services 弹性搜索批量api-输入意外结束:对象错误应为关闭标记

Amazon web services 弹性搜索批量api-输入意外结束:对象错误应为关闭标记,amazon-web-services,elasticsearch,curl,aws-elasticsearch,Amazon Web Services,elasticsearch,Curl,Aws Elasticsearch,我试图将json数据上传到弹性搜索api中,并尝试使用curl命令,但当我尝试时,会出现这种错误 错误原因 "reason": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$MarkSupportingStreamInputWrappe

我试图将json数据上传到弹性搜索api中,并尝试使用curl命令,但当我尝试时,会出现这种错误

错误原因

"reason": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$MarkSupportingStreamInputWrapper); line: 1, column: 1])\n at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$MarkSupportingStreamInputWrapper); line: 2, column: 1]"
命令:

curl -XPOST -u dev-user:dev-user-password domain-endpoint/_bulk https://search-****.us-west-2.es.amazonaws.com/_bulk --data-binary @sample.json -H "Content-Type: application/json"
sample.json

{ "index": {"_index": "products", "_type": "product", "_id": 1} }
{ "title": "Product A","description": "Brand A - Product A - 1.5 kg","price": 3.49,"sku": "wi208564","supermarket": "AJ","categories": "Fruit AJ","product_type": "Sinaasappels - mandarijnen","brand": "Brand A\n"}
{ "index": {"_index": "products", "_type": "product", "_id": 2} }
{ "title": "Product B","description": "Brand B - Product B - 1 kg","price": 2.49,"sku": "wi308564","supermarket": "AJ","categories": "Fruit AJ","product_type": "Sinaasappels - mandarijnen","brand": "Brand B\n"}
我尝试了这里发布的解决方案,但仍然得到相同的错误。
非常感谢您的帮助。

在json末尾添加了一个空行,解决了此问题。

请确保在json末尾添加了一个空行。