# Is there any way to find two terms and not more than n matches of a third term between them?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-find-two-terms-and-not-more-than-n-matches-of-a-third-term-between-them/65349>\
**Category:** Elasticsearch\
**Created:** [November 8, 2016, 12:20pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-find-two-terms-and-not-more-than-n-matches-of-a-third-term-between-them/65349 "2016-11-08T12:20:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akrupnik](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@akrupnik](https://discuss.elastic.co/u/akrupnik)\
**Post date:** [November 8, 2016, 12:20pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-find-two-terms-and-not-more-than-n-matches-of-a-third-term-between-them/65349/1 "2016-11-08T12:20:43Z")

</div>

Hi there!

The question is how to find, for example "clinton" and "trump" and not more than 5 matches of, for example "obama" between them?

So that the document "clinton obama obama obama obama obama trump" would match  
and "clinton obama obama obama obama obama obama obama obama obama trump" would not?

Thanks in advance,  
Anna

---

<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 6, 2016, 12:20pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-find-two-terms-and-not-more-than-n-matches-of-a-third-term-between-them/65349/2 "2016-12-06T12:20:43Z")

</div>

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