Yes, this is possible by using a match query for your title query and a
nested query that wraps a match query for the deal names. Both the nested
and match query need to combined with a bool query. Example:
curl -XGET 'localhost:9200/_search' -d '
"query" : {
"bool" : {
"must" : [
{
"match" : {
"name" : {
"abc"
}
}
},
"nested" : {
"path" : "deals",
"query" : {
"match" : {
"name" : {
"best"
}
}
}
}
]
}
}
'
On 3 April 2013 01:37, Victor vicwin@gmail.com wrote:
a have Author model
Author: {
name: xyz,
books: [ { //nested object
title: "abc",
date: 1/1/1
},{
title: "123"
date: 2/2/2
}
],
deals: [{ //nested object
name: "best",
deal_end_at: 1/1/15
},
{
name: "not so good",
deal_end_at: 1/2/13
}]
}is it possible to construct a single query to find the author where
"author.book.title = 'abc'" and "deals.name = 'best' "?--
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.