# How to group related logs in elasticsearch, based on a sentence?

**URL:** <https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369>\
**Category:** Elasticsearch\
**Created:** [April 14, 2016, 9:31am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369 "2016-04-14T09:31:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrikanth\_N\_C](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shrikanth\_N\_C](https://discuss.elastic.co/u/Shrikanth_N_C)\
**Post date:** [April 14, 2016, 9:31am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/1 "2016-04-14T09:31:58Z")

</div>

I want to group similar logs based on a sentence. In, other words I want to group logs into different buckets based on certain similarities. Wish to know are there any inbuilt closest feature to achieve the same.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 14, 2016, 1:11pm UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/2 "2016-04-14T13:11:25Z")

</div>

Hey,

what is your definition of 'certain similarities' - sounds pretty broad, but might actually be very specific to your concrete implementation. As it does not make a lot of sense to create buckets for each sentence (you might have a lot of those), is there a possibility you could create a grouping field based on the sentence before you index your data as a preprocessing step? I could also imagine some ingest node processor which is doing that.

Hope this helps.

--Alex

---

<div class="post-metadata">

**Author:** ![Shrikanth\_N\_C](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shrikanth\_N\_C](https://discuss.elastic.co/u/Shrikanth_N_C)\
**Post date:** [April 15, 2016, 6:14am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/3 "2016-04-15T06:14:06Z")

</div>

Thanks Alex for your quick response. I am quite new to log analytics and elasticsearch.

Yeah, I was sounding pretty broad 🙂 . Let me rephrase a bit.

I search for a specific string say "Dog" and I am able to get the results of logs containing string "Dog".

However, I wish to make elasticsearch return results even if I search using "Animal" or "Doog" (spelling mistake)

Can I achieve this ? if yes kindly provide pointers for the same.

Appreciate your support!

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 15, 2016, 6:56am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/4 "2016-04-15T06:56:06Z")

</div>

Hey,

one can be achieved by the use of synonyms. The other use-case is a fuzzy search which allows for typos.

See the chapter in the definitive guide about [synonyms](https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms.html) and the [typos & mispellings](https://www.elastic.co/guide/en/elasticsearch/guide/current/fuzzy-matching.html) chapter.

--Alex

---

<div class="post-metadata">

**Author:** ![Shrikanth\_N\_C](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shrikanth\_N\_C](https://discuss.elastic.co/u/Shrikanth_N_C)\
**Post date:** [April 15, 2016, 6:57am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/5 "2016-04-15T06:57:56Z")

</div>

Fantastic will check this out thanks! 😄

---

<div class="post-metadata">

**Author:** ![talk2cshah](https://avatars.discourse-cdn.com/v4/letter/t/8e7dd6/32.png) [@talk2cshah](https://discuss.elastic.co/u/talk2cshah)\
**Post date:** [April 15, 2016, 7:02am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/6 "2016-04-15T07:02:11Z")

</div>

Dear Shrikant,

you can also look in to clustering . your requirements is to have keywords cluster from description.  
It can be further enhanced with supervised and unsupervised,

You can look at integrating carrot2 or mahout along with elasticsearch.

Regards!

---

<div class="post-metadata">

**Author:** ![Shrikanth\_N\_C](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Shrikanth\_N\_C](https://discuss.elastic.co/u/Shrikanth_N_C)\
**Post date:** [April 15, 2016, 7:03am UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/7 "2016-04-15T07:03:59Z")

</div>

Oh okay, makes sense will check this too. Thank You 🙂

---

<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 5, 2017, 10:59pm UTC](https://discuss.elastic.co/t/how-to-group-related-logs-in-elasticsearch-based-on-a-sentence/47369/8 "2017-07-05T22:59:02Z")

</div>


