# Filter query works for X but not for Y, while they are similar

**URL:** <https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762>\
**Category:** Elasticsearch\
**Created:** [December 8, 2013, 2:56pm UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762 "2013-12-08T14:56:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacek\_Tomaszewski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacek_tomaszewski/32/1925_2.png) [@Jacek\_Tomaszewski](https://discuss.elastic.co/u/Jacek_Tomaszewski)\
**Post date:** [December 8, 2013, 2:56pm UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/1 "2013-12-08T14:56:06Z")

</div>

Okay, so I have indexed these documents (they are seen with normal  
match\_all search):

- hits: {
  - total: 4
  - max\_score: 1
  - hits: [
    - {
      - \_index: posts\_test\_20131208153023965
      - \_type: post/comment
      - \_id: 1
      - \_score: 1
      - \_source: {
        - search\_class: comment
        - target\_users: [
          - 0  
]

        - created\_at: 2013-11-21T15:26:11.000+01:00  
}  
},

    - {
      - \_index: posts\_test\_20131208153023965
      - \_type: post/request
      - \_id: 4
      - \_score: 1
      - \_source: {
        - search\_class: request
        - target\_users: [
          - 0  
]

        - created\_at: 2013-12-08T15:26:11.000+01:00  
}  
},

    - {
      - \_index: posts\_test\_20131208153023965
      - \_type: post/user\_registration
      - \_id: 7
      - \_score: 1
      - \_source: {
        - search\_class: notice
        - target\_users: [
          - 0  
]

        - created\_at: 2013-12-08T15:26:12.000+01:00  
}  
},

    - {
      - \_index: posts\_test\_20131208153023965
      - \_type: post/hehe
      - \_id: 8
      - \_score: 1
      - \_source: {
        - search\_class: hehe
        - target\_users: [
          - 1  
]

        - created\_at: 2013-12-08T15:30:14.000+01:00  
}  
}  
]  
}

When I filter this search over search\_class: 'hehe', search\_class:  
'request', search\_class: 'comment', I get one result (post/hehe,  
post/request or post/comment). Example:  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all": {}  
},  
"filter": {  
"term": {  
"search\_class": "request"  
}  
}  
}  
}  
}

- hits: {
  - total: 1
  - max\_score: 1
  - hits: [
    - {
      - \_index: posts\_test\_20131208153023965
      - \_type: post/request
      - \_id: 4
      - \_score: 1
      - \_source: {
        - search\_class: request
        - target\_users: [
          - 0  
]

        - created\_at: 2013-12-08T15:26:11.000+01:00  
}  
}  
]  
}

But when I will change the phrase "request" to "notice", I get no hits:  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all": {}  
},  
"filter": {  
"term": {  
"search\_class": "notice"  
}  
}  
}  
}  
}

- hits: {
  - total: 0
  - max\_score: null
  - hits: []  
}

The only difference is changing the name from "notice" to "request" !  
Why?

I have already refreshed the index, and tried to add those documents in  
different order, or change the "notice" name to other name (f.e.  
"notification"), but still, I get the same result.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f8a9f672-4fe7-4faa-9c71-bdd689522a3d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f8a9f672-4fe7-4faa-9c71-bdd689522a3d%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [December 9, 2013, 10:46am UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/2 "2013-12-09T10:46:48Z")

</div>

I cannot reproduce the problem. Would you mind sending a complete curl  
recreation with the indexing, refresh and search that doesn't return the  
expected result?

On Sunday, December 8, 2013 3:56:06 PM UTC+1, Jacek Tomaszewski wrote:

> Okay, so I have indexed these documents (they are seen with normal  
> match\_all search):
> 
> - hits: {
> - total: 4
> - max\_score: 1
> - hits: [
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/comment
> - \_id: 1
> - \_score: 1
> - \_source: {
> - search\_class: comment
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-11-21T15:26:11.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/request
> - \_id: 4
> - \_score: 1
> - \_source: {
> - search\_class: request
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:11.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/user\_registration
> - \_id: 7
> - \_score: 1
> - \_source: {
> - search\_class: notice
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:12.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/hehe
> - \_id: 8
> - \_score: 1
> - \_source: {
> - search\_class: hehe
> - target\_users: [
> - 1  
> ]
> 
> - created\_at: 2013-12-08T15:30:14.000+01:00  
> }  
> }  
> ]  
> }
> 
> When I filter this search over search\_class: 'hehe', search\_class:  
> 'request', search\_class: 'comment', I get one result (post/hehe,  
> post/request or post/comment). Example:  
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> },  
> "filter": {  
> "term": {  
> "search\_class": "request"  
> }  
> }  
> }  
> }  
> }
> 
> - hits: {
> - total: 1
> - max\_score: 1
> - hits: [
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/request
> - \_id: 4
> - \_score: 1
> - \_source: {
> - search\_class: request
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:11.000+01:00  
> }  
> }  
> ]  
> }
> 
> But when I will change the phrase "request" to "notice", I get no hits:  
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> },  
> "filter": {  
> "term": {  
> "search\_class": "notice"  
> }  
> }  
> }  
> }  
> }
> 
> - hits: {
> - total: 0
> - max\_score: null
> - hits:   
> }
> 
> The only difference is changing the name from "notice" to "request" !  
> Why?
> 
> I have already refreshed the index, and tried to add those documents in  
> different order, or change the "notice" name to other name (f.e.  
> "notification"), but still, I get the same result.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/399497b1-f4dd-4838-9109-7a944d0e9bfb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/399497b1-f4dd-4838-9109-7a944d0e9bfb%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jacek\_Tomaszewski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacek_tomaszewski/32/1925_2.png) [@Jacek\_Tomaszewski](https://discuss.elastic.co/u/Jacek_Tomaszewski)\
**Post date:** [December 9, 2013, 10:50am UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/3 "2013-12-09T10:50:23Z")

</div>

I'll try to send you that today.

I also noticed that my cluster is in yellow health (it was in red,but I  
managed to get it to yellow after deleting some indexes). Maybe that's the  
problem?

W dniu poniedziałek, 9 grudnia 2013 11:46:48 UTC+1 użytkownik Luca Cavanna  
napisał:

> I cannot reproduce the problem. Would you mind sending a complete curl  
> recreation with the indexing, refresh and search that doesn't return the  
> expected result?
> 
> On Sunday, December 8, 2013 3:56:06 PM UTC+1, Jacek Tomaszewski wrote:
> 
> > Okay, so I have indexed these documents (they are seen with normal  
> > match\_all search):
> > 
> > - hits: {
> > - total: 4
> > - max\_score: 1
> > - hits: [
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/comment
> > - \_id: 1
> > - \_score: 1
> > - \_source: {
> > - search\_class: comment
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-11-21T15:26:11.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/request
> > - \_id: 4
> > - \_score: 1
> > - \_source: {
> > - search\_class: request
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/user\_registration
> > - \_id: 7
> > - \_score: 1
> > - \_source: {
> > - search\_class: notice
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:12.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/hehe
> > - \_id: 8
> > - \_score: 1
> > - \_source: {
> > - search\_class: hehe
> > - target\_users: [
> > - 1  
> > ]
> > 
> > - created\_at: 2013-12-08T15:30:14.000+01:00  
> > }  
> > }  
> > ]  
> > }
> > 
> > When I filter this search over search\_class: 'hehe', search\_class:  
> > 'request', search\_class: 'comment', I get one result (post/hehe,  
> > post/request or post/comment). Example:  
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "match\_all": {}  
> > },  
> > "filter": {  
> > "term": {  
> > "search\_class": "request"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > - hits: {
> > - total: 1
> > - max\_score: 1
> > - hits: [
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/request
> > - \_id: 4
> > - \_score: 1
> > - \_source: {
> > - search\_class: request
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > }  
> > }  
> > ]  
> > }
> > 
> > But when I will change the phrase "request" to "notice", I get no hits:  
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "match\_all": {}  
> > },  
> > "filter": {  
> > "term": {  
> > "search\_class": "notice"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > - hits: {
> > - total: 0
> > - max\_score: null
> > - hits:   
> > }
> > 
> > The only difference is changing the name from "notice" to "request" !  
> > Why?
> > 
> > I have already refreshed the index, and tried to add those documents in  
> > different order, or change the "notice" name to other name (f.e.  
> > "notification"), but still, I get the same result.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d039bd0f-e396-4939-bef9-248c66a8d213%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d039bd0f-e396-4939-bef9-248c66a8d213%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [December 9, 2013, 11:11am UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/4 "2013-12-09T11:11:57Z")

</div>

Thanks, I'll wait for your recreation.  
The red status could be the problem, the yellow is not as yellow just means  
that some replicas cannot be allocated (if for instance you have a single  
node no replicas can be allocated).

On Mon, Dec 9, 2013 at 11:50 AM, Jacek Tomaszewski [jacek@jtom.me](mailto:jacek@jtom.me) wrote:

> I'll try to send you that today.
> 
> I also noticed that my cluster is in yellow health (it was in red,but I  
> managed to get it to yellow after deleting some indexes). Maybe that's the  
> problem?
> 
> W dniu poniedziałek, 9 grudnia 2013 11:46:48 UTC+1 użytkownik Luca Cavanna  
> napisał:
> 
> > I cannot reproduce the problem. Would you mind sending a complete curl  
> > recreation with the indexing, refresh and search that doesn't return the  
> > expected result?
> > 
> > On Sunday, December 8, 2013 3:56:06 PM UTC+1, Jacek Tomaszewski wrote:
> > 
> > > Okay, so I have indexed these documents (they are seen with normal  
> > > match\_all search):
> > > 
> > > - hits: {
> > > - total: 4
> > > - max\_score: 1
> > > - hits: [
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/comment
> > > - \_id: 1
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: comment
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-11-21T15:26:11.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/request
> > > - \_id: 4
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: request
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/user\_registration
> > > - \_id: 7
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: notice
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:12.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/hehe
> > > - \_id: 8
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: hehe
> > > - target\_users: [
> > > - 1  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:30:14.000+01:00  
> > > }  
> > > }  
> > > ]  
> > > }
> > > 
> > > When I filter this search over search\_class: 'hehe', search\_class:  
> > > 'request', search\_class: 'comment', I get one result (post/hehe,  
> > > post/request or post/comment). Example:  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "query": {  
> > > "match\_all": {}  
> > > },  
> > > "filter": {  
> > > "term": {  
> > > "search\_class": "request"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > - hits: {
> > > - total: 1
> > > - max\_score: 1
> > > - hits: [
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/request
> > > - \_id: 4
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: request
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > > }  
> > > }  
> > > ]  
> > > }
> > > 
> > > But when I will change the phrase "request" to "notice", I get no hits:  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "query": {  
> > > "match\_all": {}  
> > > },  
> > > "filter": {  
> > > "term": {  
> > > "search\_class": "notice"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > - hits: {
> > > - total: 0
> > > - max\_score: null
> > > - hits:   
> > > }
> > > 
> > > The only difference is changing the name from "notice" to "request" !  
> > > Why?
> > > 
> > > I have already refreshed the index, and tried to add those documents in  
> > > different order, or change the "notice" name to other name (f.e.  
> > > "notification"), but still, I get the same result.
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/d039bd0f-e396-4939-bef9-248c66a8d213%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d039bd0f-e396-4939-bef9-248c66a8d213%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CADdZ9MXE-A%2BeKXLrdarYB5Veo5J6wfc-wnOL%3DNC--uAA%2BALscQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CADdZ9MXE-A%2BeKXLrdarYB5Veo5J6wfc-wnOL%3DNC--uAA%2BALscQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jacek\_Tomaszewski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacek_tomaszewski/32/1925_2.png) [@Jacek\_Tomaszewski](https://discuss.elastic.co/u/Jacek_Tomaszewski)\
**Post date:** [December 10, 2013, 3:05pm UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/5 "2013-12-10T15:05:32Z")

</div>

After I changed search\_class from "notice" to anything else like "foobar",  
it solved the problem =)

Both "notice" and "notification" words made the record not to be found,  
when queried by the search\_class column. Strange - are they some kind of  
reserved words in elasticsearch?

W dniu niedziela, 8 grudnia 2013 15:56:06 UTC+1 użytkownik Jacek  
Tomaszewski napisał:

> Okay, so I have indexed these documents (they are seen with normal  
> match\_all search):
> 
> - hits: {
> - total: 4
> - max\_score: 1
> - hits: [
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/comment
> - \_id: 1
> - \_score: 1
> - \_source: {
> - search\_class: comment
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-11-21T15:26:11.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/request
> - \_id: 4
> - \_score: 1
> - \_source: {
> - search\_class: request
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:11.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/user\_registration
> - \_id: 7
> - \_score: 1
> - \_source: {
> - search\_class: notice
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:12.000+01:00  
> }  
> },
> 
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/hehe
> - \_id: 8
> - \_score: 1
> - \_source: {
> - search\_class: hehe
> - target\_users: [
> - 1  
> ]
> 
> - created\_at: 2013-12-08T15:30:14.000+01:00  
> }  
> }  
> ]  
> }
> 
> When I filter this search over search\_class: 'hehe', search\_class:  
> 'request', search\_class: 'comment', I get one result (post/hehe,  
> post/request or post/comment). Example:  
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> },  
> "filter": {  
> "term": {  
> "search\_class": "request"  
> }  
> }  
> }  
> }  
> }
> 
> - hits: {
> - total: 1
> - max\_score: 1
> - hits: [
> - {
> - \_index: posts\_test\_20131208153023965
> - \_type: post/request
> - \_id: 4
> - \_score: 1
> - \_source: {
> - search\_class: request
> - target\_users: [
> - 0  
> ]
> 
> - created\_at: 2013-12-08T15:26:11.000+01:00  
> }  
> }  
> ]  
> }
> 
> But when I will change the phrase "request" to "notice", I get no hits:  
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "match\_all": {}  
> },  
> "filter": {  
> "term": {  
> "search\_class": "notice"  
> }  
> }  
> }  
> }  
> }
> 
> - hits: {
> - total: 0
> - max\_score: null
> - hits:   
> }
> 
> The only difference is changing the name from "notice" to "request" !  
> Why?
> 
> I have already refreshed the index, and tried to add those documents in  
> different order, or change the "notice" name to other name (f.e.  
> "notification"), but still, I get the same result.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [December 10, 2013, 3:14pm UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/6 "2013-12-10T15:14:28Z")

</div>

As I said before I couldn't reproduce your problem with your same words.  
Would be nice if you can send a curl recreation. Maybe the problem is in  
your mappings.

On Tue, Dec 10, 2013 at 4:05 PM, Jacek Tomaszewski [jacek@jtom.me](mailto:jacek@jtom.me) wrote:

> After I changed search\_class from "notice" to anything else like "foobar",  
> it solved the problem =)
> 
> Both "notice" and "notification" words made the record not to be found,  
> when queried by the search\_class column. Strange - are they some kind of  
> reserved words in elasticsearch?
> 
> W dniu niedziela, 8 grudnia 2013 15:56:06 UTC+1 użytkownik Jacek  
> Tomaszewski napisał:
> 
> > Okay, so I have indexed these documents (they are seen with normal  
> > match\_all search):
> > 
> > - hits: {
> > - total: 4
> > - max\_score: 1
> > - hits: [
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/comment
> > - \_id: 1
> > - \_score: 1
> > - \_source: {
> > - search\_class: comment
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-11-21T15:26:11.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/request
> > - \_id: 4
> > - \_score: 1
> > - \_source: {
> > - search\_class: request
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/user\_registration
> > - \_id: 7
> > - \_score: 1
> > - \_source: {
> > - search\_class: notice
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:12.000+01:00  
> > }  
> > },
> > 
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/hehe
> > - \_id: 8
> > - \_score: 1
> > - \_source: {
> > - search\_class: hehe
> > - target\_users: [
> > - 1  
> > ]
> > 
> > - created\_at: 2013-12-08T15:30:14.000+01:00  
> > }  
> > }  
> > ]  
> > }
> > 
> > When I filter this search over search\_class: 'hehe', search\_class:  
> > 'request', search\_class: 'comment', I get one result (post/hehe,  
> > post/request or post/comment). Example:  
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "match\_all": {}  
> > },  
> > "filter": {  
> > "term": {  
> > "search\_class": "request"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > - hits: {
> > - total: 1
> > - max\_score: 1
> > - hits: [
> > - {
> > - \_index: posts\_test\_20131208153023965
> > - \_type: post/request
> > - \_id: 4
> > - \_score: 1
> > - \_source: {
> > - search\_class: request
> > - target\_users: [
> > - 0  
> > ]
> > 
> > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > }  
> > }  
> > ]  
> > }
> > 
> > But when I will change the phrase "request" to "notice", I get no hits:  
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "match\_all": {}  
> > },  
> > "filter": {  
> > "term": {  
> > "search\_class": "notice"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > - hits: {
> > - total: 0
> > - max\_score: null
> > - hits:   
> > }
> > 
> > The only difference is changing the name from "notice" to "request" !  
> > Why?
> > 
> > I have already refreshed the index, and tried to add those documents in  
> > different order, or change the "notice" name to other name (f.e.  
> > "notification"), but still, I get the same result.
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CADdZ9MWkpW\_X86Rx4NorvwEEWOQuEy4x90WuEgKR9wJRSkpBQw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CADdZ9MWkpW_X86Rx4NorvwEEWOQuEy4x90WuEgKR9wJRSkpBQw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jacek\_Tomaszewski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacek_tomaszewski/32/1925_2.png) [@Jacek\_Tomaszewski](https://discuss.elastic.co/u/Jacek_Tomaszewski)\
**Post date:** [December 10, 2013, 3:22pm UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/7 "2013-12-10T15:22:32Z")

</div>

Well, the models were autogenerated with ruby library called Tire[https://github.com/karmi/retire](https://github.com/karmi/retire),  
so I don't have any curl recreation (at least for now).

Currently my problem is solved, so I think we can skip this issue. Thank  
you for your help.

W dniu wtorek, 10 grudnia 2013 16:14:28 UTC+1 użytkownik Luca Cavanna  
napisał:

> As I said before I couldn't reproduce your problem with your same words.  
> Would be nice if you can send a curl recreation. Maybe the problem is in  
> your mappings.
> 
> On Tue, Dec 10, 2013 at 4:05 PM, Jacek Tomaszewski \<[ja...@jtom.me](mailto:ja...@jtom.me)\<javascript:\>
> 
> > wrote:
> 
> > After I changed search\_class from "notice" to anything else like  
> > "foobar", it solved the problem =)
> > 
> > Both "notice" and "notification" words made the record not to be found,  
> > when queried by the search\_class column. Strange - are they some kind of  
> > reserved words in elasticsearch?
> > 
> > W dniu niedziela, 8 grudnia 2013 15:56:06 UTC+1 użytkownik Jacek  
> > Tomaszewski napisał:
> > 
> > > Okay, so I have indexed these documents (they are seen with normal  
> > > match\_all search):
> > > 
> > > - hits: {
> > > - total: 4
> > > - max\_score: 1
> > > - hits: [
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/comment
> > > - \_id: 1
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: comment
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-11-21T15:26:11.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/request
> > > - \_id: 4
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: request
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/user\_registration
> > > - \_id: 7
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: notice
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:12.000+01:00  
> > > }  
> > > },
> > > 
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/hehe
> > > - \_id: 8
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: hehe
> > > - target\_users: [
> > > - 1  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:30:14.000+01:00  
> > > }  
> > > }  
> > > ]  
> > > }
> > > 
> > > When I filter this search over search\_class: 'hehe', search\_class:  
> > > 'request', search\_class: 'comment', I get one result (post/hehe,  
> > > post/request or post/comment). Example:  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "query": {  
> > > "match\_all": {}  
> > > },  
> > > "filter": {  
> > > "term": {  
> > > "search\_class": "request"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > - hits: {
> > > - total: 1
> > > - max\_score: 1
> > > - hits: [
> > > - {
> > > - \_index: posts\_test\_20131208153023965
> > > - \_type: post/request
> > > - \_id: 4
> > > - \_score: 1
> > > - \_source: {
> > > - search\_class: request
> > > - target\_users: [
> > > - 0  
> > > ]
> > > 
> > > - created\_at: 2013-12-08T15:26:11.000+01:00  
> > > }  
> > > }  
> > > ]  
> > > }
> > > 
> > > But when I will change the phrase "request" to "notice", I get no hits:  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "query": {  
> > > "match\_all": {}  
> > > },  
> > > "filter": {  
> > > "term": {  
> > > "search\_class": "notice"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > - hits: {
> > > - total: 0
> > > - max\_score: null
> > > - hits:   
> > > }
> > > 
> > > The only difference is changing the name from "notice" to "request" !  
> > > Why?
> > > 
> > > I have already refreshed the index, and tried to add those documents in  
> > > different order, or change the "notice" name to other name (f.e.  
> > > "notification"), but still, I get the same result.
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Pws1OAK5Els/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5c277b09-3cc6-468b-bd47-62203d1932ff%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c7a9034b-4539-4c79-9fe3-e6b9d94026d9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c7a9034b-4539-4c79-9fe3-e6b9d94026d9%40googlegroups.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:02am UTC](https://discuss.elastic.co/t/filter-query-works-for-x-but-not-for-y-while-they-are-similar/14762/8 "2017-07-06T02:02:13Z")

</div>


