ES doesn't know that. I misread your question / example. The book.title
part should also be put into a nested query:
curl -XGET 'localhost:9200/_search' -d '
"query" : {
"bool" : {
"must" : [
{
"nested" : {
"path" : "books",
"query" : {
"match" : {
"books.title" : {
"abc"
}
}
}
}
},
"nested" : {
"path" : "deals",
"query" : {
"match" : {
"deals.name" : {
"best"
}
}
}
}
]
}
}
'
Also the field names inside the nested query should be the full path. The
above query should return any root document (author in your case) that has
a nested inner deal object with a name that has the term best and a
nested inner book object with title that has a term abc. Does this makes
sense?
On 3 April 2013 19:16, Victor Huang vicwin@gmail.com wrote:
in the first match query, how does ES knows "name" mapped to
"books.title"? am i missing something--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Met vriendelijke groet,
Martijn van Groningen
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.