弹性搜索批量 api - 意外的输入结束:对象错误的预期关闭标记

Elastic search bulk api - Unexpected end-of-input: expected close marker for Object error

我正在尝试将 json 数据上传到 elastic search 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 的末尾添加了一个空行解决了问题。