How to one result when search nested?

this is data
{
'firstname' :'Nicolas'
'lastname' :'Ippolito'
'books' :array
{
0 :array
{
'name' :php,
'rating':3
}
1 :array
{
'name' :'nodejs',
'rating':5,
},
2 :array
{
'name' :'guitar',
'rating':3,
}
}
}
I want result data if books.rating is "Max" and only one nested
example result I want
{
'firstname' :'Nicolas'
'lastname' :'Ippolito'
'books' :array
{
0 :array
{
'name' :'nodejs',
'rating':5,
},
}
}

--

Hi,

You mean, when a search hits a document, you want ES only to return
parts of that document?

If so, I'm not sure how you can do this other than at client side. Or,
by changing your data structure. For example, you might want to use
parent-child and search for what you want in the children, then use
the has_parent[0] query to search for what you want in the parent. In
this case Elasticsearch would return only the matching children. And
you can fetch their parents at client-side using the Multi Get API[1]

[0] http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query.html
[1] http://www.elasticsearch.org/guide/reference/api/multi-get.html

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Sat, Nov 17, 2012 at 11:43 AM, softtech Wonder
wondersofttech@gmail.com wrote:

this is data
{
'firstname' :'Nicolas'
'lastname' :'Ippolito'
'books' :array
{
0 :array
{
'name' :php,
'rating':3
}
1 :array
{
'name' :'nodejs',
'rating':5,
},
2 :array
{
'name' :'guitar',
'rating':3,
}
}
}
I want result data if books.rating is "Max" and only one nested
example result I want
{
'firstname' :'Nicolas'
'lastname' :'Ippolito'
'books' :array
{
0 :array
{
'name' :'nodejs',
'rating':5,
},
}
}

--

--