elasticsearch - query_string filter inside a nested filter throws an error -
in example i've placed full query example that's been paired down non-working portion has me stuck.
basically have document has nested document type under datailitems , trying query_string filter against field in nested document fails. take same portion , run against non-nested field , works. i'm doing wrong.
the error receive nested: queryparsingexception[[******] [_na] filter malformed, must start start_object]
so, proper way this?
some caveats. "and"s used further filter requirements contain bools, ranges, etc... have stripped out additional reqs example.
{ "size" : 1, "query" : { "filtered" : { "filter" : { "and" : [{ "nested" : { "path" : "detailitems", "filter" : { "and" : [{ "query" : { "query_string" : { "detailitems.name" : { "query" : "mastersettings", "minimum_should_match" : 1 } } } } ] } } } ] } } } }
the query_string in op not syntactically correct, below example of how query string re-written:
"size" : 1, "query" : { "filtered" : { "filter" : { "and" : [{ "nested" : { "path" : "detailitems", "filter" : { "and" : [{ "query" : { "query_string" : { "fields": [ "detailitems.name" ], "query" : "mastersettings", "minimum_should_match" : 1 } } } ] } } } ] } } }
Comments
Post a Comment