我正在尝试在Elastic Search上进行工作,但是在格式化JSON文件并将其发布到本地主机时遇到一些问题。
我的JSON文件具有以下结构:
{"datasetid": "dataset1", "recordid": "01fc9ae28dd02cd94c97fc759cc0fe9a7b640a3b", "fields":{"movie":"Star Wars", "emplacement":"USA", "movie_id":"40"}, "record_timestamp": "2019-02-08T11:51:00+01:00"}, {"datasetid": "dataset1", "recordid":"906117d0d489f38218df8e01cb228c217c050ce2", "fields": {"movie":"James Bond", "emplacement":"USA", "movie_id":"41"}, "record_timestamp":"2019-02-08T11:51:00+01:00"}
它具有更多的迭代,但它们遵循此结构。
根据我在Internet上搜索到的内容,做了以下命令:
<sirene_v3.json jq -c '. | {"index": {"_index": "json", "_type": "json"}}, .' \
| curl -XPOST localhost:9200/_bulk -H "Content-Type: application/json" --data-binary @-
但是我遇到了这个错误,我不知道这里出了什么问题:
{
"took": 2,
"errors": true,
"items": [
{
"index": {
"_index": "json",
"_type": "json",
"_id": "_IOQumkBjKtepv9oHnVg",
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse",
"caused_by": {
"type": "not_x_content_exception",
"reason": "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
}
}
}
}
]
}
有人对此有任何想法吗? 预先谢谢你