We are using function_score query to sort search results. The score takes into account the value of a field in the indexed document. However, it appears the field value can not be properly retrieved from Doc Values, it always returns '0' although the actual value is otherwise.
As the example shows the field 'reward_factor' in the indexed document is populated with non zero value, however, when it's retrieved using doc['reward_factor'].value, it is alway '0'. Tried other ways to retrieve the value, such as _fields (as documented here), no success.
One thing maybe special here is that the function_score query is under a 'nested' query, in such case, are we not able to retrieve the field value? No documentation seems indicating so.
Much appreciated if someone could help with this.
PS: Elasticsearch version: 5.1.1