【发布时间】:2023-04-03 09:39:01
【问题描述】:
我最近升级到 Elasticsearch 6.1.1 版,现在我无法从 JSON 文件批量索引文档。当我内联时,它工作正常。以下是文档内容:
{"index" : {}}
{"name": "Carlson Barnes", "age": 34}
{"index":{}}
{"name": "Sheppard Stein","age": 39}
{"index":{}}
{"name": "Nixon Singleton","age": 36}
{"index":{}}
{"name": "Sharron Sosa","age": 33}
{"index":{}}
{"name": "Kendra Cabrera","age": 24}
{"index":{}}
{"name": "Young Robinson","age": 20}
当我运行这个命令时,
curl -XPUT 'localhost:9200/subscribers/ppl/_bulk?pretty' -H 'Content-Type: application/json' -d @customers_full.json
我收到此错误:
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
}
],
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
},
"status" : 400
如果我在 Elasticsearch 5.x 中内联发送数据,它可以正常工作。我尝试在文件末尾添加换行符和换行符。好像没用。
【问题讨论】:
标签: json elasticsearch elasticsearch-5 bulk-load