I am trying to write a query using query_string to retrieve data requests from nested objects.
An example of the query I would like to make is the following:
{ "query": { "query_string": { "query": "a.id:2" } } }
Where "a" is the nested object, and "id" is the field "a".
I know that I can successfully complete this task with a subquery by writing a query like:
{ "nested": { "path": "a" "query_string": { "query": "a.id:2" } } }
However, I would like to avoid this. I do not want to find out on my own that the user is looking for a nested field and modifies the request. I tried using the "fields" parameter, but it does not seem to work with nested objects.
Is it possible to write this query directly using query_string queries? What semantics can I get? (for example, if I write "a.id:2 AND ab: 10", do I match two fields in the same object or in different objects?)
source share