Hi Jilles,

I just tried, but wasn't able to reproduce this behavior. In my test ES only returned the correct document. I created a gist for that:
https://gist.github.com/hkorte/ca5f91e2f4838213d956

I tried it using ES 1.4.1. Which version are you using? Does my gist work for you? I noticed that it doesn't matter whether or not it is a nested document.

Best regards,
Hannes


On 10.02.2015 15:52, Jilles van Gurp wrote:
I'm trying to filter documents that have a particular field at the top
level. Like for example:

{
"group_id":"xxx"
}

so I wrote the following query:

GET inbot_users/usercontact/_search
{
   "query": {
     "filtered": {
       "query": {
         "match_all": {}
       },
       "filter": {
         "exists": {
           "field": "group_id"
         }
       }
     }
   }
}

But now my problem is that it is also returning documents with a nested
group_id property:

{
"nested":{
"group_id":"xxx"
}
}

In this case I wouldn't expect a match because I specified "group_id" and
not "nested.group_id".

How can I make it filter just documents that have the field at the top
level like is clearly the intention here?


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/54DA2675.1080401%40hkorte.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to