json数组的弹性搜索
我有一个json文件,我想将json文件加载到elastic search中json数组的弹性搜索,json,
elasticsearch,Json,
elasticsearch,我有一个json文件,我想将json文件加载到elastic search中 curl -XPOST 'http://localhost:9200/datas/data/1' -d @rosia_data.json 但它会产生以下som错误: {"error":"MapperParsingException[Malformed content, must start withno bject]","status":400} 我的数据是这样的: [ { "sr":"Krishna Chaud
curl -XPOST 'http://localhost:9200/datas/data/1' -d @rosia_data.json
但它会产生以下som错误:
{"error":"MapperParsingException[Malformed content, must start withno bject]","status":400}
我的数据是这样的:
[
{
"sr":"Krishna Chaudhary",
"inventory":"Vector Plus - 2`S",
"packaing_unit":"pcs",
"shopname":"D&b Store",
"shoproute":"RCT Market",
"quantity":12,
"order_id":21745,
"distributor_name":"New Horizon Distributors Itahari",
"distributor_id":13,
"order_date":"2014-06-01"
},
{
"sr":"Krishna Chaudhary",
"inventory":"Vector Plus - 4`S",
"packaing_unit":"pcs",
"shopname":"D&b Store",
"shoproute":"RCT Market",
"quantity":12,
"order_id":21746,
"distributor_name":"New Horizon Distributors Itahari",
"distributor_id":13,
"order_date":"2014-06-01"
},
{
"sr":"Khagendra Pokhrel",
"inventory":"Vector Plus - 4`S",
"packaing_unit":"pcs",
"shopname":"Samita Cosmetic",
"shoproute":"Pathri",
"quantity":12,
"order_id":21762,
"distributor_name":"Horizon Distributors Damak",
"distributor_id":14,
"order_date":"2014-06-01"
}
]
所以请帮我解决这个问题。
顺便说一句,我不熟悉Elasticsearch。好的,这样你只能索引一个文档(但你的json是数组或文档,这会产生错误)。 如果需要为多个文档编制索引,只需使用
例如,查看能否显示@rosia_data.json内容如何使用批量api加载数据。你能举个例子吗?我得到了这个错误:{“错误”:“ActionRequestValidationException[Validation Failed:1:未添加任何请求;]”,“status”:500}请确保json中没有换行符,请看我的要点。我的.json文件是3mb,我需要手动在json文件的每个内部数组中包含{“index”:{“index”:“datas”、“_type”:“data”、“_id”:1}}。你应该按照我写的结构(是的,附加字符串,而不是用作数组),或者你应该编写一个脚本(可能使用python)。