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/<index>/<parent>_search
{
  "query": {
    "has_child": {
      "type": "<child>",
      "score_type": "sum",
      "query": {
        "function_score": {
          "script_score": {
            "script": "doc['<child>.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 [email protected].
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.

Reply via email to