# How to index \_id field using templates

**URL:** https://discuss.elastic.co/t/how-to-index--id-field-using-templates/61202
**Category:** Elasticsearch
**Created:** [September 22, 2016, 5:58am UTC](https://discuss.elastic.co/t/how-to-index--id-field-using-templates/61202 "2016-09-22T05:58:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Yash\_Datta](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yash\_Datta](https://discuss.elastic.co/u/Yash_Datta)
#### Post date: [September 22, 2016, 5:58am UTC](https://discuss.elastic.co/t/how-to-index--id-field-using-templates/61202/1 "2016-09-22T05:58:55Z")

</div>

Hi all,

For my use case I index documents and supply unique ids based on my data. In the queries, I want to retrieve documents based on a list of ids + some other filters. Currently, we are using the ids query combined with the filters. The problem is the list of ids can be large. I was thinking maybe I can get some speedup by indexing the \_id field and using a terms query instead. But I found no way to index the field. Is it still supported ?

I used the following and got \_id is not configurable:

PUT at /index

{  
"mappings": {  
"_default_": {  
"\_id": {  
"index": "not\_analyzed"   
}  
}  
}  
}

---

<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, 10:18pm UTC](https://discuss.elastic.co/t/how-to-index--id-field-using-templates/61202/2 "2017-07-05T22:18:19Z")

</div>


