# Use text field as label in data visualization

**URL:** <https://discuss.elastic.co/t/use-text-field-as-label-in-data-visualization/334483>\
**Category:** Kibana\
**Tags:** visualisation\
**Created:** [May 26, 2023, 10:37pm UTC](https://discuss.elastic.co/t/use-text-field-as-label-in-data-visualization/334483 "2023-05-26T22:37:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marine.authorities](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@marine.authorities](https://discuss.elastic.co/u/marine.authorities)\
**Post date:** [May 26, 2023, 10:37pm UTC](https://discuss.elastic.co/t/use-text-field-as-label-in-data-visualization/334483/1 "2023-05-26T22:37:34Z")

</div>

Hi!

This is my first time using kibana, so sorry if this was asked before, but the threads I could find by searching were not helpful.

My use case is simple: I have an index that contains the fields `movieId (integer)`, `title (text)`, `ratings_count (int)`. I want to make a visualization that shows me the top 10 documents, sorted descendingly by `ratings_count`. For example as a pie chart.

However, when I choose ratings\_count as metric, and movieId as slice-by, there is no way to use my 'title' field anywhere, it is not even shown in the UI.

I can see the field in the Discover tab, wher everything is shown as a table. This works. but when creating a visualization, the field is hidden. All the previous threads said that you can use 'top values' to show text field, but this did not work for me.

This is what I have so far:

 ![Screenshot 2023-05-27 at 00.32.43@2x](https://us1.discourse-cdn.com/elastic/original/3X/7/3/7351c6de9c70d5dd649f1faad5ce31a7e96d63a3.jpeg)

Thanks for reading!

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [May 28, 2023, 12:49pm UTC](https://discuss.elastic.co/t/use-text-field-as-label-in-data-visualization/334483/2 "2023-05-28T12:49:12Z")

</div>

Hello @marine.authorities, welcome to the community!

Even though it would be for the title, this is an [aggregation-based](https://www.elastic.co/guide/en/kibana/current/add-aggregation-based-visualization-panels.html) visualization and by default, you cannot run aggregations on a text field. You can try creating a keyword [sub-field](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html) instead, and then your string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations.

---

<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:** [June 25, 2023, 12:49pm UTC](https://discuss.elastic.co/t/use-text-field-as-label-in-data-visualization/334483/3 "2023-06-25T12:49:32Z")

</div>

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