# Adding \_id to doc\_values to help w/ sorting performance

**URL:** <https://discuss.elastic.co/t/adding--id-to-doc-values-to-help-w-sorting-performance/72944>\
**Category:** Elasticsearch\
**Created:** [January 26, 2017, 7:36pm UTC](https://discuss.elastic.co/t/adding--id-to-doc-values-to-help-w-sorting-performance/72944 "2017-01-26T19:36:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darinhoward](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darinhoward/32/14033_2.png) [@darinhoward](https://discuss.elastic.co/u/darinhoward)\
**Post date:** [January 26, 2017, 7:36pm UTC](https://discuss.elastic.co/t/adding--id-to-doc-values-to-help-w-sorting-performance/72944/1 "2017-01-26T19:36:45Z")

</div>

End goal is to have the value set in `_id` saved w/ `doc_values` enabled. I'm looking to do this in order to increase sorting performance - where id is used.

Regardless of if the \_id values is provided or generated, is there a way to set `doc_values` on this field?

If not, is it possible to copy the value of `_id` into another field that does have `doc_values` enabled?

Other thoughts ?

Running ES version 1.7.5

---

<div class="post-metadata">

**Author:** ![darinhoward](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darinhoward/32/14033_2.png) [@darinhoward](https://discuss.elastic.co/u/darinhoward)\
**Post date:** [January 28, 2017, 7:45pm UTC](https://discuss.elastic.co/t/adding--id-to-doc-values-to-help-w-sorting-performance/72944/2 "2017-01-28T19:45:56Z")

</div>

I was able to do this w/ a transform, setting a newly defined field to the values of \_id on insert.

---

<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:** [February 25, 2017, 7:46pm UTC](https://discuss.elastic.co/t/adding--id-to-doc-values-to-help-w-sorting-performance/72944/3 "2017-02-25T19:46:11Z")

</div>

Closed on February 25, 2017, 7:46pm UTC

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