# How to sort based on field in search ouput

**URL:** <https://discuss.elastic.co/t/how-to-sort-based-on-field-in-search-ouput/42704>\
**Category:** Kibana\
**Created:** [February 25, 2016, 11:49am UTC](https://discuss.elastic.co/t/how-to-sort-based-on-field-in-search-ouput/42704 "2016-02-25T11:49:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lamp0chka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lamp0chka/32/8051_2.png) [@lamp0chka](https://discuss.elastic.co/u/lamp0chka)\
**Post date:** [February 25, 2016, 11:49am UTC](https://discuss.elastic.co/t/how-to-sort-based-on-field-in-search-ouput/42704/1 "2016-02-25T11:49:19Z")

</div>

Hi,

It seems that .raw fields are not displayed in search results output (both discover and dashboard) and Kibana throws an error if I try to sort based on analyzed field.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/18fc8141b8812b6c3f4a4de029bf34a9cacb9078.png)

For example I would like to sort by host, but this is not possible. If I use host.raw Kibana shows - instead of text. And if I use host field, it will throw "Field data loading is forbidden on host" error.

So what should I do? Disable analyze on fields that I want to sort? Or some other approach to sort logs?

---

<div class="post-metadata">

**Author:** ![lamp0chka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lamp0chka/32/8051_2.png) [@lamp0chka](https://discuss.elastic.co/u/lamp0chka)\
**Post date:** [February 26, 2016, 8:37pm UTC](https://discuss.elastic.co/t/how-to-sort-based-on-field-in-search-ouput/42704/2 "2016-02-26T20:37:00Z")

</div>

So I ended up with writing my own templates for fields in ES. Works fine now.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.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 6, 2017, 2:00pm UTC](https://discuss.elastic.co/t/how-to-sort-based-on-field-in-search-ouput/42704/3 "2017-07-06T14:00:54Z")

</div>


