elasticsearch - Filtering Elaticsearch query on existence of a nested field -
i'm trying write elasticsearch query return elements have nested field. however, i'm apparently having deal of difficulty it. mapping field looks follows:
{ "mytype": { "properties": { "hello": { "type": "nested", "properties": { "foo": {"type": "string", "index": "not_analyzed"}, "bar": {"type": "string", "index": "not_analyzed"}, } } } } }
my query follows: { "query": { "filtered": { "filter": { "exists": { "field": "hello.foo" } } } } }
this query returns 0 matching documents though know there matching documents.
i tried use exists
query inside nested
query, given error message nested
queries not supporting exists
query.
i'm testing against elasticsearch 2.3 appreciated!
i hope help
{ "query": { "bool": { "must": [ { "nested": { "path": "hello", "filter": { "term": { // replace term "match" in case of fulltext "hello.foo": "value searched" } } } } ] } }, "from": 0, "size": 50 }
Comments
Post a Comment