我正在尝试使用Bulk Inset API进行弹性搜索。我想插入带有自动生成ID的文档,但不管我怎么做,都会出错。
以下是一些例子:
http://localhost:9200/_bulk
{"create": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
Put和Post都给出了错误:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
},
"status": 400
}
如果我删除“类型”文档,我会得到以下错误:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
},
"status": 400
}
我正在通过Docker使用弹性搜索6.4.2
~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
elasticsearch 6.4.2 e47ebd7ec3ee 7 weeks ago 828MB
当前通过邮递员发送请求