Elsticsearch5.6.*:_id is not configurable


(JingDan) #1

Hi,all
It told me "_id is not configurable" when i ceate index by assign _id mapping mainkey od the source.
create index statement is
curl -X PUT localhost:9200/test
{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas":0
},
"mappings" : {
"test1" : {
"_id":{"path":"mainkey"},
"_source" : { "enabled" : false },
"properties" : {
"mainkey" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}

response is
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "_id is not configurable"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [test1]: _id is not configurable",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "_id is not configurable"
}
},
"status": 400
}


(David Pilato) #2

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Yes. _id is not configurable. You need to provide it when you index your document:

PUT index/doc/id

(JingDan) #3

yeah,i will use markdown next time.Thank your reply.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.