# The set/number of matching patterns in a document for a query?

**URL:** <https://discuss.elastic.co/t/the-set-number-of-matching-patterns-in-a-document-for-a-query/58799>\
**Category:** Elasticsearch\
**Created:** [August 24, 2016, 10:04am UTC](https://discuss.elastic.co/t/the-set-number-of-matching-patterns-in-a-document-for-a-query/58799 "2016-08-24T10:04:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyes\_zaiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lyes_zaiko/32/11250_2.png) [@lyes\_zaiko](https://discuss.elastic.co/u/lyes_zaiko)\
**Post date:** [August 24, 2016, 10:04am UTC](https://discuss.elastic.co/t/the-set-number-of-matching-patterns-in-a-document-for-a-query/58799/1 "2016-08-24T10:04:41Z")

</div>

Hi!  
Is there any way to get the set/number of the matching patterns for some query in a document?

For example:  
If we have the text "red **people** , white **people** , _yellow people_", and the query 'people NOT "yellow people"' (matching the word **people** but not the phrase _"yellow people"_).

The result I expect is a matching pattern count of **2**

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:25pm UTC](https://discuss.elastic.co/t/the-set-number-of-matching-patterns-in-a-document-for-a-query/58799/2 "2017-07-05T22:25:34Z")

</div>

Closed on July 5, 2017, 10:25pm UTC


