I have documents like this:
{
... ...,
"id":"abcabc",
"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? Or should I change the structure of the document?
Thanks a lot!