# Implicit match all when using not filters

**URL:** <https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454>\
**Category:** Elasticsearch\
**Created:** [April 4, 2013, 5:56pm UTC](https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454 "2013-04-04T17:56:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 4, 2013, 5:56pm UTC](https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454/1 "2013-04-04T17:56:12Z")

</div>

Besides working on projects using ElasticSearch, I am still using on Lucene  
as well. One limitation of Lucene is that a query or sub-query cannot  
continue only NOT clauses. The common workaround is to ask for everything  
_:_ when using a NOT clause.

I believe ElasticSearch does this automatically when using NOT clauses. I  
am looking to borrow _cough_steal_cough_ some ideas, but I can't figure  
where exactly in the code this magic is happening. Anyone have any ideas  
where it could be? Imitation is the sincerest form of flattery.

Cheers,

Ivan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 5, 2013, 1:51pm UTC](https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454/2 "2013-04-05T13:51:31Z")

</div>

> <https://github.com/elastic/elasticsearch/blob/4eefcb9c82778e8cd7a0126b98872cf08740c46e/src/main/java/org/elasticsearch/common/lucene/search/Queries.java#L103>

On Thursday, April 4, 2013 1:56:12 PM UTC-4, Ivan Brusic wrote:

> Besides working on projects using Elasticsearch, I am still using on  
> Lucene as well. One limitation of Lucene is that a query or sub-query  
> cannot continue only NOT clauses. The common workaround is to ask for  
> everything _:_ when using a NOT clause.
> 
> I believe Elasticsearch does this automatically when using NOT clauses. I  
> am looking to borrow _cough_steal_cough_ some ideas, but I can't figure  
> where exactly in the code this magic is happening. Anyone have any ideas  
> where it could be? Imitation is the sincerest form of flattery.
> 
> Cheers,
> 
> Ivan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 5, 2013, 4:39pm UTC](https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454/3 "2013-04-05T16:39:08Z")

</div>

Thanks so much. I was looking in the Builder classes, while the call was in  
the parser instead.

I knew I would learn something. My code is pretty much identical, except I  
didn't know about the existence of isProhibited(). Not sure how I missed it  
after many years of using Lucene.

--  
Ivan

On Fri, Apr 5, 2013 at 6:51 AM, Igor Motov [imotov@gmail.com](mailto:imotov@gmail.com) wrote:

> [https://github.com/elasticsearch/elasticsearch/blob/4eefcb9c82778e8cd7a0126b98872cf08740c46e/src/main/java/org/elasticsearch/common/lucene/search/Queries.java#L103](https://github.com/elasticsearch/elasticsearch/blob/4eefcb9c82778e8cd7a0126b98872cf08740c46e/src/main/java/org/elasticsearch/common/lucene/search/Queries.java#L103)
> 
> On Thursday, April 4, 2013 1:56:12 PM UTC-4, Ivan Brusic wrote:
> 
> > Besides working on projects using Elasticsearch, I am still using on  
> > Lucene as well. One limitation of Lucene is that a query or sub-query  
> > cannot continue only NOT clauses. The common workaround is to ask for  
> > everything _:_ when using a NOT clause.
> > 
> > I believe Elasticsearch does this automatically when using NOT clauses. I  
> > am looking to borrow _cough_steal_cough_ some ideas, but I can't figure  
> > where exactly in the code this magic is happening. Anyone have any ideas  
> > where it could be? Imitation is the sincerest form of flattery.
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/implicit-match-all-when-using-not-filters/11454/4 "2017-07-06T02:42:35Z")

</div>


