不要急,总有办法的

_id is not configurable

Elasticsearch | 作者 hanbj | 发布于2017年06月05日 | 阅读数:8648

Elasticsearch5.x 创建映射时报错PUT /shirts
{
    "mappings": {
        "item": {
            "_id":{"path": "color"},
            "properties": {
                "brand": { "type": "keyword"},
                "color": { "type": "keyword"},
                "model": { "type": "keyword"}
            }
        }
    }
}
 
 
错误如下;
{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "_id is not configurable"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [item]: _id is not configurable",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "_id is not configurable"
    }
  },
  "status": 400
}
 
请问下es5.x怎么制定_id引用一个filed呢?
已邀请:

novia - 1&0

赞同来自:

试了试,
1.7版本支持
2以上版本貌似已经不支持了,最后在入库的时候自定义_id吧

Jea - 一只猿

赞同来自:

不能使用_id作为mapping字段, 这个是保留字段, 如果你需要的话可以在创建时指定_id来自定义, 我不知道有办法可以定义_id的引用

要回复问题请先登录注册