# Can we apply NOT operator before Proximity?

**URL:** <https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344>\
**Category:** Elasticsearch\
**Created:** [April 16, 2012, 9:39am UTC](https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344 "2012-04-16T09:39:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumit\_Guptaa](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Sumit\_Guptaa](https://discuss.elastic.co/u/Sumit_Guptaa)\
**Post date:** [April 16, 2012, 9:39am UTC](https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344/1 "2012-04-16T09:39:00Z")

</div>

Hi all,

can we apply NOT before proximity....is this query work or not?

curl -XGET '[http://localhost:9200/sumitproximityagain/proximityindexagain/\_search](http://localhost:9200/sumitproximityagain/proximityindexagain/_search)' -d '{  
"query" : {

```
"query_string" : {
    "default_field" : "message",
    "query" : NOT "\"Elastic Search\"~4"
}

},
"highlight" : {
    "fields" : {
        "message" : {}
    }
}

```

}'

thanx

Regards,  
Sumit Gupta

---

<div class="post-metadata">

**Author:** ![pulkitsinghal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pulkitsinghal/32/802_2.png) [@pulkitsinghal](https://discuss.elastic.co/u/pulkitsinghal)\
**Post date:** [May 28, 2012, 12:19pm UTC](https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344/2 "2012-05-28T12:19:16Z")

</div>

Actually I too am curious about this. Does anyone in the group happen to  
know if Lucene in general supports applying a not (inversing) on a phrase  
query?

On Mon, Apr 16, 2012 at 4:39 AM, Sumit Guptaa [sumit.gupta.ngi@gmail.com](mailto:sumit.gupta.ngi@gmail.com)wrote:

> Hi all,
> 
> can we apply NOT before proximity....is this query work or not?
> 
> curl -XGET  
> '[http://localhost:9200/sumitproximityagain/proximityindexagain/\_search](http://localhost:9200/sumitproximityagain/proximityindexagain/_search)' -d  
> '{  
> "query" : {
> 
> "query\_string" : {  
> "default\_field" : "message",  
> "query" : NOT ""Elastic Search"~4"  
> }
> 
> },  
> "highlight" : {  
> "fields" : {  
> "message" : {}  
> }  
> }  
> }'
> 
> thanx
> 
> Regards,  
> Sumit Gupta
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/can-we-apply-NOT-operator-before-Proximity-tp3913957p3913957.html](http://elasticsearch-users.115913.n3.nabble.com/can-we-apply-NOT-operator-before-Proximity-tp3913957p3913957.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 29, 2012, 7:26pm UTC](https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344/3 "2012-05-29T19:26:58Z")

</div>

It should work...

On Mon, May 28, 2012 at 2:19 PM, Pulkit Singhal [pulkitsinghal@gmail.com](mailto:pulkitsinghal@gmail.com)wrote:

> Actually I too am curious about this. Does anyone in the group happen to  
> know if Lucene in general supports applying a not (inversing) on a phrase  
> query?
> 
> On Mon, Apr 16, 2012 at 4:39 AM, Sumit Guptaa [sumit.gupta.ngi@gmail.com](mailto:sumit.gupta.ngi@gmail.com)wrote:
> 
> > Hi all,
> > 
> > can we apply NOT before proximity....is this query work or not?
> > 
> > curl -XGET  
> > '[http://localhost:9200/sumitproximityagain/proximityindexagain/\_search](http://localhost:9200/sumitproximityagain/proximityindexagain/_search)'  
> > -d  
> > '{  
> > "query" : {
> > 
> > "query\_string" : {  
> > "default\_field" : "message",  
> > "query" : NOT ""Elastic Search"~4"  
> > }
> > 
> > },  
> > "highlight" : {  
> > "fields" : {  
> > "message" : {}  
> > }  
> > }  
> > }'
> > 
> > thanx
> > 
> > Regards,  
> > Sumit Gupta
> > 
> > --  
> > View this message in context:  
> > [http://elasticsearch-users.115913.n3.nabble.com/can-we-apply-NOT-operator-before-Proximity-tp3913957p3913957.html](http://elasticsearch-users.115913.n3.nabble.com/can-we-apply-NOT-operator-before-Proximity-tp3913957p3913957.html)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 3:26am UTC](https://discuss.elastic.co/t/can-we-apply-not-operator-before-proximity/7344/4 "2017-07-06T03:26:27Z")

</div>


