Can I dynamically extract fields from a document?


(Jeffrey Pinyan) #1

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?


(Alexander Reelsen) #2

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

--Alex