# Span\_Near query minimum slop

**URL:** <https://discuss.elastic.co/t/span-near-query-minimum-slop/52106>\
**Category:** Elasticsearch\
**Created:** [June 7, 2016, 3:54pm UTC](https://discuss.elastic.co/t/span-near-query-minimum-slop/52106 "2016-06-07T15:54:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![philv](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@philv](https://discuss.elastic.co/u/philv)\
**Post date:** [June 7, 2016, 3:54pm UTC](https://discuss.elastic.co/t/span-near-query-minimum-slop/52106/1 "2016-06-07T15:54:33Z")

</div>

Is there a way to specify that overlapping tokens should not count in a span\_near query ?  
As in, after using a PatternCaptureGroupFilter I end up with several tokens that overlap and occupy the same token position. But I don't want these tokens to be found when I issue a span\_near query with a slop of 0.  
I need the equivalent of minimum slop- something greater than -1, say.  
Is there a way to do this ?

To be clear I need to distinguish between these two cases:

WORD1/WORD2 WORD3 WORD2

Where WORD1/WORD2 are at token position 0, WORD3 is position 1, and the last WORD2 instance is position 2.  
I need a way to find WORD1 within one word of WORD2, but not include the WORD2 that overlaps WORD1.

Many thanks,  
Phil

---

<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:45pm UTC](https://discuss.elastic.co/t/span-near-query-minimum-slop/52106/2 "2017-07-05T22:45:33Z")

</div>


