# How to get frequency of a pattern

**URL:** <https://discuss.elastic.co/t/how-to-get-frequency-of-a-pattern/102912>\
**Category:** Elasticsearch\
**Created:** [October 5, 2017, 8:51pm UTC](https://discuss.elastic.co/t/how-to-get-frequency-of-a-pattern/102912 "2017-10-05T20:51:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Histell](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@Histell](https://discuss.elastic.co/u/Histell)\
**Post date:** [October 5, 2017, 8:51pm UTC](https://discuss.elastic.co/t/how-to-get-frequency-of-a-pattern/102912/1 "2017-10-05T20:51:55Z")

</div>

Hi,

I have documents like below. What I want is to get frequency of apple words(1 apple\_x, 2 apple\_y, 1 apple\_z). What is the best way for doing this. I get data from logstash by the way. Should I use add\_field filter in logstash?

```
{
	"field1": "text text apple_x text text"
}

{
	"field1": "text text apple_y text text"
}

{
	"field1": "text text apple_y text text"
}

{
	"field1": "text text apple_z text text"
}
```

---

<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 2, 2017, 8:51pm UTC](https://discuss.elastic.co/t/how-to-get-frequency-of-a-pattern/102912/2 "2017-11-02T20:51:55Z")

</div>

Closed on November 2, 2017, 8:51pm UTC

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