1
votes

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":[]}}

1
Could you put all of the error in the question? - tim_yates
The query in your questiom has click_count. The error message has clickcount . Is that something you renamed before posting? - jay
What version of elasticsearch are you using? - jay
Yes, it's renamed and version of the elasticsearch is 2.3.5 - Yovo
The error seems to be showing _score * doc['type.clickcount'].value but you have a different script in your query - tim_yates

1 Answers

0
votes

According to the error, you have score instead of _score

score * doc['clickcount'].value

should read

_score * doc['clickcount'].value
^
|