Re: Counts of children in parent/child data


(Binh Ly) #1

James,

Sounds like you want to query the parents and then score/rank them by the
sum of the userScore values of their corresponding children. You can try
something like this:

POST http://localhost:9200//_search
{
"query": {
"has_child": {
"type": "",
"score_type": "sum",
"query": {
"function_score": {
"script_score": {
"script": "doc['.userScore'].value"
},
"boost_mode": "replace"
}
}
}
}
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5b1fc5b0-16c0-42f2-90de-9169f3cb6e64%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2