# ES 2.0 '\_id': 'path' not allowed, but what is allowed?

**URL:** https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023
**Category:** Elasticsearch
**Created:** [October 12, 2015, 4:26pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023 "2015-10-12T16:26:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)
#### Post date: [October 12, 2015, 4:26pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/1 "2015-10-12T16:26:41Z")

</div>

I used [GitHub - elastic/elasticsearch-migration: This plugin will help you to check whether you can upgrade directly to the next major version of Elasticsearch, or whether you need to make changes to your data and cluster before doing so.](https://github.com/elastic/elasticsearch-migration) v0.11 on our production index and it flagged our 3 usages of `_id` with a `_path` which the docs clearly say will no longer be allowed. However, the wording confuses me as to what _is_ allowed:

> The `_id` field can no longer be configured in new indices. Importantly, it will not be possible to extract the `_id` value from a `path` in types, ...

and

> (you can't have) "Custom configured `_id` field."

[\_id field | Elasticsearch Guide [2.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/mapping-id-field.html) it says

> The `_id` field is not indexed as its value can be derived automatically from the `_uid` field.

and

> **The value of the `_id` field is** accessible in queries and scripts, but **not in aggregations** or when sorting, where the \_uid field should be used instead

My question is in ES 2.0 can we still define a custom type mapping (e.g., 'type': 'string', 'store': True, 'index': 'not\_analyzed') and populate our own value of the `_id` field (just not using `path`)? On a related note, I notice our current setup using `path` ends up with some mappings of `_id` with `type` `string` and others with type `long`, which would appear to be a conflict which is not flagged. Are there global restrictions on the `type` of the `_id` field (e.g., can only be 'type': 'string', 'index': 'not\_analyzed')?

Please advise.

---

<div class="post-metadata">

### Author: ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)
#### Post date: [October 12, 2015, 4:36pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/2 "2015-10-12T16:36:40Z")

</div>

I just stumbled across [https://github.com/elastic/elasticsearch/issues/8143](https://github.com/elastic/elasticsearch/issues/8143) but I'm still not totally clear.

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [October 12, 2015, 5:27pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/3 "2015-10-12T17:27:37Z")

</div>

You will no longer be able to change `_id` field type. So do not try to expect `long` values.

If you want a stored field, use `_uid`, which is of the format `type '#' docid`, and extract the doc id.

Please reconsider your use case of `path` in combination with `_id`, the chance is high that you can setup your own non-meta-field as a replacement.

---

<div class="post-metadata">

### Author: ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)
#### Post date: [October 12, 2015, 8:31pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/4 "2015-10-12T20:31:39Z")

</div>

Ok, so to be clear, the immutable mapping of `_id` will be:

```auto
{
    "type": "string",
    "store": false,
    "index": "not_analyzed"
}

```

whose value can be populated "as usual" (just not using `path`). Correct?

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [October 13, 2015, 7:46am UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/5 "2015-10-13T07:46:17Z")

</div>

Quite exact, the locked-down mapper definition is

```auto
{
  "type": "string",
  "norms" : { "enabled" : false},
  "analyzer" : "keyword",
  "store" : false
}

```

see `org.elasticsearch.index.mapper.internal.IdFieldMapper`

---

<div class="post-metadata">

### Author: ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)
#### Post date: [October 13, 2015, 2:13pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/6 "2015-10-13T14:13:57Z")

</div>

Thanks very much! Personally, I think this should be in the docs for [https://www.elastic.co/guide/en/elasticsearch/reference/2.0/mapping-id-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.0/mapping-id-field.html)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 11:45pm UTC](https://discuss.elastic.co/t/es-2-0--id-path-not-allowed-but-what-is-allowed/32023/7 "2017-07-05T23:45:05Z")

</div>


