# Couldn't get Not Filter working

**URL:** https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816
**Category:** Elasticsearch
**Created:** [May 22, 2012, 11:18pm UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816 "2012-05-22T23:18:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [May 22, 2012, 11:18pm UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816/1 "2012-05-22T23:18:16Z")

</div>

Hello, I know I do something wrong, but I couldn't figure out what.  
I need to get really simple result back, with logic as following:  
Get me all posts of users with provided IDs, but exclude 2 posts with  
specific IDs.  
Here is what I have:  
[https://gist.github.com/2772255](https://gist.github.com/2772255)  
But it doesn't exclude the posts. I'm actually getting posts with CHIzzfjoB1  
and 0oT84UVtB1 back.  
Could you please help me out with query?

Thank you

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [May 23, 2012, 8:50am UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816/2 "2012-05-23T08:50:23Z")

</div>

On Tue, 2012-05-22 at 16:18 -0700, Eugene Strokin wrote:

> Hello, I know I do something wrong, but I couldn't figure out what.  
> I need to get really simple result back, with logic as following:  
> Get me all posts of users with provided IDs, but exclude 2 posts with  
> specific IDs.  
> Here is what I have:  
> [https://gist.github.com/2772255](https://gist.github.com/2772255)
> 
> But it doesn't exclude the posts. I'm actually getting posts  
> with CHIzzfjoB1 and 0oT84UVtB1 back.  
> Could you please help me out with query?

What is the mapping for post.postId?

Is it analyzed, or not\_analyzed?

clint

> Thank you

---

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [May 23, 2012, 3:55pm UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816/3 "2012-05-23T15:55:16Z")

</div>

No,.. it is not analyzed, just indexed.

On Wednesday, May 23, 2012 4:50:23 AM UTC-4, Clinton Gormley wrote:

> On Tue, 2012-05-22 at 16:18 -0700, Eugene Strokin wrote:
> 
> > Hello, I know I do something wrong, but I couldn't figure out what.  
> > I need to get really simple result back, with logic as following:  
> > Get me all posts of users with provided IDs, but exclude 2 posts with  
> > specific IDs.  
> > Here is what I have:  
> > [https://gist.github.com/2772255](https://gist.github.com/2772255)
> > 
> > But it doesn't exclude the posts. I'm actually getting posts  
> > with CHIzzfjoB1 and 0oT84UVtB1 back.  
> > Could you please help me out with query?
> 
> What is the mapping for post.postId?
> 
> Is it analyzed, or not\_analyzed?
> 
> clint
> 
> > Thank you

---

<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 25, 2012, 8:37pm UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816/4 "2012-05-25T20:37:44Z")

</div>

Can you provide a fuller recreation? Including setting up teh index and the  
relevant mappings, index sample data, and show the search that does not  
work?

On Wed, May 23, 2012 at 1:18 AM, Eugene Strokin [eugene@strokin.info](mailto:eugene@strokin.info) wrote:

> Hello, I know I do something wrong, but I couldn't figure out what.  
> I need to get really simple result back, with logic as following:  
> Get me all posts of users with provided IDs, but exclude 2 posts with  
> specific IDs.  
> Here is what I have:  
> [https://gist.github.com/2772255](https://gist.github.com/2772255)  
> But it doesn't exclude the posts. I'm actually getting posts with CHIzzfjoB1  
> and 0oT84UVtB1 back.  
> Could you please help me out with query?
> 
> 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 6, 2017, 3:27am UTC](https://discuss.elastic.co/t/couldnt-get-not-filter-working/7816/5 "2017-07-06T03:27:00Z")

</div>


