ES 2.0刚刚发布。出于好奇,我测试了我的ES 1.7.3针对ES 2.0的映射文件。我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "_id is not configurable"
}
],
"type": "mapper_parsing_exception",
"reason": "mapping [mydoctype]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "_id is not configurable"
}
},
"status": 400
}
基本上,这个错误抱怨我的映射文件包含以下内容:
"mydoctype": {
"_id" : {
"path" : "id"
},
刚刚google并且未能找到将doc _id设置为ES 2.0中索引文档的实际标识符的方法。我怎样才能做到这一点?
感谢任何指针和输入!
答案 0 :(得分:6)
根据announcing blog post,您现在需要在索引查询中明确设置值,即
curl -XPUT localhost:9200/your_index/your_type/YOUR_ID -d '{...}'
^
|
set your id here
或在您的_bulk
查询中:
curl -XPOST localhost:9200/your_index/your_type/_bulk -d '
{"index": {"_id": "YOUR_ID"}}
{...} ^
' |
set your id here