Can I dynamically extract fields from a document?

Can I dynamically select fields from my document to return, based on a query? Say I have a document like so:

{"name":"jeff","friends":[{"name":"chad","age":29},{"name":"damian","age":23},{"name":"chris","age":21}]}

I would like the returned friends to include only those with an age above 21, e.g:

{"name":"jeff","friends":[{"name":"chad","age":29},{"name":"damian","age":23}]}

Can I do this in a query (presumably with a script), or must I do it after the response has been received?

take a look at the nested datatype and its corresponding queries and especially the inner hits functionality.

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.