# Categorizing similar values

**URL:** <https://discuss.elastic.co/t/categorizing-similar-values/257071>\
**Category:** Elasticsearch\
**Created:** [November 30, 2020, 1:50pm UTC](https://discuss.elastic.co/t/categorizing-similar-values/257071 "2020-11-30T13:50:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmarDacca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/omardacca/32/68171_2.png) [@OmarDacca](https://discuss.elastic.co/u/OmarDacca)\
**Post date:** [November 30, 2020, 1:50pm UTC](https://discuss.elastic.co/t/categorizing-similar-values/257071/1 "2020-11-30T13:50:32Z")

</div>

Hi,

Is there a way to categorize similar values of specific field, during the query time ?

for example, suppose I have these documents:

1. {..., message: "this is message no 1",...}
2. {..., message: "this is message no 2",...}
3. {..., message: "the message: 'very long message' is too long",...}

my goal is to aggregate the message not by term, but by pattern, so for the given example I expect the result to be something like this, not necessarily the exact same:

```
{
    buckets: [
      {
        key: 'message: "this is message no 1"',
        pattern: ''this is message no"
      },
      {
        key: 'message: "the message: 'very long message' is too long"',
        pattern: 'the message: is too long'
      }
    ]
  }
```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [November 30, 2020, 2:04pm UTC](https://discuss.elastic.co/t/categorizing-similar-values/257071/2 "2020-11-30T14:04:21Z")

</div>

Hi Omar.  
See [this post](https://www.elastic.co/blog/elastic-logs-7-6-0-released)

---

<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:** [December 28, 2020, 2:04pm UTC](https://discuss.elastic.co/t/categorizing-similar-values/257071/3 "2020-12-28T14:04:30Z")

</div>

Closed on December 28, 2020, 2:04pm UTC

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