# Has Child sorting problem

**URL:** https://discuss.elastic.co/t/has-child-sorting-problem/62168
**Category:** Elasticsearch
**Created:** [October 4, 2016, 2:11pm UTC](https://discuss.elastic.co/t/has-child-sorting-problem/62168 "2016-10-04T14:11:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yovo\_yovchev](https://avatars.discourse-cdn.com/v4/letter/y/73ab20/32.png) [@yovo\_yovchev](https://discuss.elastic.co/u/yovo_yovchev)
#### Post date: [October 4, 2016, 2:11pm UTC](https://discuss.elastic.co/t/has-child-sorting-problem/62168/1 "2016-10-04T14:11:39Z")

</div>

Hi there,

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['click\_count'].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?  
Thanks in advance.

Cheers

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:15pm UTC](https://discuss.elastic.co/t/has-child-sorting-problem/62168/2 "2017-07-05T22:15:06Z")

</div>


