in our project we are using hasChild sorting which is exactly by the book:
{ "query": { "has_child" : { "type" : "blog_tag", "score_mode" : "max", "query" : { "function_score" : { "script_score": { "script": "_score * doc['click_count'].value" } } } } } }
The problem is that when I have "score_mode" it returns the following error:
"reason":{"type":"script_exception","reason":"failed to run inline script ["_score * doc['clickcount'].value] using lang [groovy]","caused_by":{"type":"missing_property_exception","reason":"No such property:
Getting rid of the "score_mode" will show results that are not sorted. Does anyone have any idea what could be the problem?
EDIT: Here is the full error. The above example is from the documentation as my info is confidential and I had to replace with example. In the following error I have also replaced some names.
{"took":24,"timed_out":false,"_shards":{"total":4,"successful":2,"failed":2,"failures":[{"shard":1,"index":"my_index","node":"qA2MHVABTHKXs6Le0TD0iQ","reason":{"type":"script_exception","reason":"failed to run inline script [_score * doc['type.clickcount'].value] using lang [groovy]","caused_by":{"type":"missing_property_exception","reason":"No such property: type for class: c47126be960099501d9aebe33d6f1e7666fdff5e"}}}]},"hits":{"total":0,"max_score":null,"hits":[]}}
_score * doc['type.clickcount'].valuebut you have a different script in your query - tim_yates