# String field in Discover is not sortable, and .keyword field and alias field are both empty

**URL:** <https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892>\
**Category:** Kibana\
**Created:** [December 16, 2020, 4:50pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892 "2020-12-16T16:50:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![qub123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qub123/32/55327_2.png) [@qub123](https://discuss.elastic.co/u/qub123)\
**Post date:** [December 16, 2020, 4:50pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892/1 "2020-12-16T16:50:44Z")

</div>

We noticed that only keyword and date field are sort-able in "Discover" , not string and numeric field. I found a post that mentioned we need to use .keyword field in order to make it sortable, to enable it, we need to disable the "Hide missing fields" in the "Available fields" setting. But something which is strange, the .keyword field has missing values. We have an alias field pointing to the .keyword field too, that field also has missing value. When I added the .keyword field and the alias field to clumn, I see an warning message "Unable to write index pattern. Refresh the page to getthe most up to date changes for the index pattern"

Would be great if I can get some recommendation from someone.

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f55265e47162dbcd743b887a456a52a8c75401f9.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/5/65b0f9f99888d2d069da085eb1b7a0aa3d3c0ad9.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [December 16, 2020, 5:07pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892/2 "2020-12-16T17:07:46Z")

</div>

Hey @qub123,

Based on having to disable "hide missing fields", I'd say that it's expected that these fields wouldn't contain any data. To me the question is: why are these fields empty? If you query this index directly in the [Kibana Console](https://www.elastic.co/guide/en/kibana/current/console-kibana.html), do you see data in those `keyword` fields?

What does your index mapping look like for the underlying indices? Can you provide a copy of that?

> When I added the .keyword field and the alias field to clumn, I see an warning message "Unable to write index pattern. Refresh the page to getthe most up to date changes for the index pattern"

We've seen this in the past when concurrent updates to the index pattern take too long to save. To triage that further, it would be great to capture a HAR showing this. If you're comfortable doing so, instructions for generating a HAR can be found here: [Kibana HAR Instructions · GitHub](https://gist.github.com/legrego/7154b71096a09876423e2bd61d6a3e0f)

---

<div class="post-metadata">

**Author:** ![qub123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qub123/32/55327_2.png) [@qub123](https://discuss.elastic.co/u/qub123)\
**Post date:** [December 16, 2020, 7:07pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892/3 "2020-12-16T19:07:35Z")

</div>

Hi @Larry_Gregory,

Please see the post post, according to @Bargs (Elastic Team memeber), it is common behavior that unchecking "Hide missing field" is a common behavior to see the "keyword" field in Discover. And also it seems like there is bug in alias too, the issue has been raised since august 2018, but until now the error still hasn't been fixed.

> [@Sorting in Discover not working](https://discuss.elastic.co/t/sorting-in-discover-not-working/204626/5):
>
> If you only need nice display names, have you tried using a [field formatter](https://www.elastic.co/guide/en/kibana/7.4/field-formatters-string.html)? These can be more lightweight performance-wise because the formatting is done in the browser rather than in Elasticsearch. Search will be more performant if done against regular fields vs a script. If a field formatter won't do the job for you, could you open up your browser's dev tools and see if there's an error when filtering on the scripted field? Filter on scripted fields should work, so there must be something f…

[Discover doesn't show field aliases · Issue #21705 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/21705) ]([Discover doesn't show field aliases · Issue #21705 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/21705)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/7/b74b74b424b972ea9666166c8b83fe6011726e99.png)

Here you can see the field mapping for the activity\_type, activity\_type.keyword, and the alias Activity\_Type. I tried to filter in the activity\_type.keyword, and also filter with alias Activity\_Type. Both return correct result, but same problem also, the .keyword and alias column have empty value again.

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/c/ec8b0a81f154cf6da4ac77a715d9a3c2426d1b18.png)

Pic: filter with activity\_type.keyword field, return correct result on the activity\_type text field

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2c020a1f0898eafa87bb78aaf1c6c7b1db017f30.png)

Pic: Filter with alias "Activity\_type", return correct result on the activity\_type text field.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/9/49a55e6ca2e8d5238226f2ab75ba80a8848c0da2.png)

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [December 16, 2020, 7:31pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892/4 "2020-12-16T19:31:58Z")

</div>

@qub123 thank you for taking the time to explain the problem to me in more detail - that was very helpful, and I understand it better now.

The multi-field problem seems to be captured in an even older issue here: [https://github.com/elastic/kibana/issues/7419](https://github.com/elastic/kibana/issues/7419).

More importantly, it looks like we've made [some progress](https://github.com/elastic/kibana/issues/7419#issuecomment-597836280) on this front recently. I still don't know when this will be fully resolved, but I [linked back to this post](https://github.com/elastic/kibana/issues/7419#issuecomment-746887932) as another data point for the team to consider, and asked for an update on the issue.

---

<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:** [January 13, 2021, 7:32pm UTC](https://discuss.elastic.co/t/string-field-in-discover-is-not-sortable-and-keyword-field-and-alias-field-are-both-empty/258892/5 "2021-01-13T19:32:04Z")

</div>

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