# Aggregate/visualize based on substring or regex query

**URL:** <https://discuss.elastic.co/t/aggregate-visualize-based-on-substring-or-regex-query/215524>\
**Category:** Kibana\
**Created:** [January 17, 2020, 9:23pm UTC](https://discuss.elastic.co/t/aggregate-visualize-based-on-substring-or-regex-query/215524 "2020-01-17T21:23:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdberts](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@sdberts](https://discuss.elastic.co/u/sdberts)\
**Post date:** [January 17, 2020, 9:23pm UTC](https://discuss.elastic.co/t/aggregate-visualize-based-on-substring-or-regex-query/215524/1 "2020-01-17T21:23:11Z")

</div>

Hey all -

I have a use case where I need to query for a substring or regex pattern from a field, then visualize it in Kibana.

I have a field called "description" in an index, in which various data is stored. The data follows this pattern:

`application_name - metric : value`

`application_name`, `metric`, and `value` can all vary depending on the source of the data, so what I want to do is pull out `application_name`, then build a vertical bar chart showing the Count of different `application_name` values we receive. So for instance:

`application_name1` = 30 events last 24 hours  
`application_name2` = 72 events last 24 hours  
`application_name3` = 13 events last 24 hours

Unfortunately I don't have a way to change the source, otherwise I would split up the data into individual fields and that would make things a lot easier.

Is this feasible?

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [January 20, 2020, 4:41pm UTC](https://discuss.elastic.co/t/aggregate-visualize-based-on-substring-or-regex-query/215524/2 "2020-01-20T16:41:55Z")

</div>

Hi @sdberts,

Have you tried to extract application name in a dedicated [scripted field](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)? Then you can apply any aggregations (incl. count) on this new field.

Best, Oleg

---

<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:** [February 17, 2020, 4:42pm UTC](https://discuss.elastic.co/t/aggregate-visualize-based-on-substring-or-regex-query/215524/3 "2020-02-17T16:42:06Z")

</div>

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