Can Elastic Search give part of array when condition met ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Can Elastic Search give part of array when condition met ?

senthild4u@gmail.com
This post has NOT been accepted by the mailing list yet.
I have documents like this: { ... ..., "id":"abc001", "nominations":[ { "comment":"test", "events":[ { "name":"aaa", "year":"2012" },{ "name":"bbb", "year":"2011" } ] }, ... ... ] } As you can see, there are two nested array, 'nominations' and 'events'. When I search for docs that match {"term":{"events.name":"aaa"}} and {"term":{"events.year":"2012"}}, the document above will be returned. But in practice, array 'events' may contains many elements like "{"name":"bbb","year":"2011"}" that don't match the query and also are useless to users. So my question is, can Elasticsearch return a document with array 'events' that contains element "{"name":"aaa","year":"2012"}" only? If not, is there any other possible ways to solve this problem?