gpt4 book ai didi

Elasticsearch 2.0 : _id is not configurable

转载 作者:行者123 更新时间:2023-11-29 02:54:24 24 4
gpt4 key购买 nike

ES 2.0 刚刚发布。出于好奇,我针对 ES 2.0 测试了一直适用于 ES 1.7.3 的映射文件。我收到以下错误:

{
"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"
},

刚刚谷歌了一下,没能找到在 ES 2.0 中将 doc _id 设置为索引文档的实际标识符的方法。我怎样才能做到这一点?

感谢您的指点和输入!

最佳答案

根据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

关于 Elasticsearch 2.0 : _id is not configurable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33428976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com