# Can fields in the mapping be made non sortable

**URL:** https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461
**Category:** Elasticsearch
**Created:** [March 7, 2021, 5:03am UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461 "2021-03-07T05:03:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Deepti](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@Deepti](https://discuss.elastic.co/u/Deepti)
#### Post date: [March 7, 2021, 5:03am UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461/1 "2021-03-07T05:03:18Z")

</div>

Can we make a field in the mapping as non sortable?  
The way we can make a field unsearchable by setting the mapping parameter "index:false" ,is there a way to make fields non sortable?  
Is there any mapping parameter that can be used or any other way ?

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [March 11, 2021, 5:47pm UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461/2 "2021-03-11T17:47:43Z")

</div>

The data structure for sorting and aggregations is `doc_values` and you can disable that: [doc\_values | Elasticsearch Reference [7.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html) Though that will also affect aggregations and not just sorting.

Why do you want to do that? To save disk space or is there another reason for that? Maybe there is a better solution to get that done.

---

<div class="post-metadata">

### Author: ![Deepti](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@Deepti](https://discuss.elastic.co/u/Deepti)
#### Post date: [March 15, 2021, 2:57am UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461/3 "2021-03-15T02:57:37Z")

</div>

@xeraa  
Few fields like a unique code may not be be used for sorting at all but is of type keyword (can be of other types as well), in that case I don't want it to be sortable.  
Ultimately Iam looking for a list of all the fields that are sortable ,so I don't want to include those which will never be sorted in my case,so Iam trying to make fields non sortable.

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [March 15, 2021, 3:57pm UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461/4 "2021-03-15T15:57:21Z")

</div>

Aggregations and sorting use the same internal data-structure, so you can only disable them together with `doc_values`. I'm not really aware of any other was just to turn off sorting on a field alone. Also note that aggregations could be abused to do something similar like sorting (using min / max aggregations), so you won't be able to hide this information.

Depending on what you want to do with that field, you could even turn off the `enabled` setting if you need none of those features.

---

<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: [April 12, 2021, 3:58pm UTC](https://discuss.elastic.co/t/can-fields-in-the-mapping-be-made-non-sortable/266461/5 "2021-04-12T15:58:00Z")

</div>

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