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/d2019aac-77e8-43ce-a7c3-2afb4a8403e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to