# Collapse similar words in one

**URL:** <https://discuss.elastic.co/t/collapse-similar-words-in-one/102590>\
**Category:** Kibana\
**Created:** [October 3, 2017, 4:00pm UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590 "2017-10-03T16:00:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavuk/32/28914_2.png) [@pavuk](https://discuss.elastic.co/u/pavuk)\
**Post date:** [October 3, 2017, 4:00pm UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/1 "2017-10-03T16:00:54Z")

</div>

Hi,  
Sorry, I'm new here and maybe my question is not related directly to Kibana.  
I have a Cloud Tag visualisation with most popular keywords. Problem in that there are many similar words like **"webmail"** and **webmail** or **Webmail** or **WebMail**. I would like to collapse all these similar words to one keyword, **webmail** , for example.  
Could you please give me right direction? How this can be done?  
Thanks.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 4, 2017, 3:54pm UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/2 "2017-10-04T15:54:45Z")

</div>

This has to do with how your data is analyzed as it is indexed into Elasticsearch. Could you provide your mapping?

---

<div class="post-metadata">

**Author:** ![pavuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavuk/32/28914_2.png) [@pavuk](https://discuss.elastic.co/u/pavuk)\
**Post date:** [October 13, 2017, 10:23am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/3 "2017-10-13T10:23:00Z")

</div>

I hope, it is correct?

curl -XGET -u elastic '[domain.com:9200/saved\_queries/\_mapping?pretty](http://domain.com:9200/saved_queries/_mapping?pretty)'  
Enter host password for user 'elastic':  
{  
"saved\_queries" : {  
"mappings" : {  
"query" : {  
"properties" : {  
"query\_content" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 13, 2017, 3:36pm UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/4 "2017-10-13T15:36:49Z")

</div>

Are you visualizing on `query_content.keyword` or `query_content`?

---

<div class="post-metadata">

**Author:** ![pavuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavuk/32/28914_2.png) [@pavuk](https://discuss.elastic.co/u/pavuk)\
**Post date:** [October 16, 2017, 4:22am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/5 "2017-10-16T04:22:18Z")

</div>

It is query\_content.keyword.  
Thanks.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 18, 2017, 8:09am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/6 "2017-10-18T08:09:28Z")

</div>

You'll have to visualize on `query_content` instead, which means you may have to update your mappings to enable field data on this field.

---

<div class="post-metadata">

**Author:** ![pavuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavuk/32/28914_2.png) [@pavuk](https://discuss.elastic.co/u/pavuk)\
**Post date:** [October 18, 2017, 8:23am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/7 "2017-10-18T08:23:54Z")

</div>

Could you please clarify a little bit why do you think so? Thanks.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 18, 2017, 10:31am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/8 "2017-10-18T10:31:11Z")

</div>

The `query_content.keyword` field is of type `keyword`, which means it isn't analyzed before it is indexed into ElasticSearch. On the other hand, the `query_content` field is of type `text`, which means it is analyzed before indexing. (See the documentation for the [text type](https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html) and [keyword type](https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html) for more information.)

By default, `text` types are not aggregatable, which means they won't show up in the list to select for things like the cloud tag visualization, which means you'll have to update the mapping for the `query_content` field to enable [`fielddata`](https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html).

Hope this helps!

---

<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:** [November 15, 2017, 10:31am UTC](https://discuss.elastic.co/t/collapse-similar-words-in-one/102590/9 "2017-11-15T10:31:12Z")

</div>

Closed on November 15, 2017, 10:31am UTC

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