Hello,
I would like to run multiple has_child queries and find a set of
documents that matches them based on boolean conditions. Something like:
give me all documents where (there is a child A which matches field1 =
value1) or ( (there is a child B that matches range field 2 between A and B
) AND (there is a child C that matches field 3 = value 3) )
Besides that, I want to calculate a score for each of the has_child
queries and match only those with score between S1 and S2.
I created a query that does exactly what I want to filter for just 1
child:
documents/document/_search
{
"query": {
"function_score": {
"query": {
"has_child" : {
"type" : "comment",
"score_type" : "sum",
"boost": 1,
"query" : {
"range": {
"date": {
"lte": 20130204,
"gte": 20130201,
"boost": 1
}
}
}
}
},
"boost": "1",
"script_score" : {
"script" : "_score"
},
"boost_mode":"replace"
}
}
}
But when I have multiple child queries and with boolean conditions
between them, it became harder. Bellow is what I was trying to do, but it
seems it won't work because I cannot have scores on filters... Any thought
about how to solve this?
{
"query": {
"filtered" : {
"query": {
"has_child" : {
"type" : "comment",
"score_type" : "sum",
"boost": 1,
"query" : {
"range": {
"date": {
"lte": 20130204,
"gte": 20130201,
"boost": 1
}
}
}
}
},
"filter" : {
"or" : [
{
"has_child" : {
"type" : "comment",
"query" : {
"range": {
"date": {
"lte": 20130204,
"gte": 20130201
}
}
}
}
}
]
}
}
}
}
Best regards,
Marcelo.
--
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.