# Sort by \_score error in es5.1.1

**URL:** <https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340>\
**Category:** Elasticsearch\
**Created:** [January 12, 2017, 9:02am UTC](https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340 "2017-01-12T09:02:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![laigood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laigood/32/30060_2.png) [@laigood](https://discuss.elastic.co/u/laigood)\
**Post date:** [January 12, 2017, 9:02am UTC](https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340/1 "2017-01-12T09:02:41Z")

</div>

I found that es5.1.1 can't sort by \_score,the same query es2.x works but it throw:  
No mapping found for [\_score] in order to sort on  
sort json:  
"sort" : [  
{  
"\_score" : {  
"order" : "desc"  
}  
},  
{  
"memb\_num" : {  
"order" : "desc"  
}  
}  
]

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [January 12, 2017, 11:12am UTC](https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340/2 "2017-01-12T11:12:06Z")

</div>

I was not able to reproduce your issue on a fresh install of ES 5.1.1 using the below script.

Could you paste the complete request you are sending, the response JSON you receive and the stack trace you'll get in your server logs for this? Also, is this a fresh install of ES 5.1.1 or have you upgraded it from 2.x?

Thanks

Colin

---

<div class="post-metadata">

**Author:** ![laigood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laigood/32/30060_2.png) [@laigood](https://discuss.elastic.co/u/laigood)\
**Post date:** [January 13, 2017, 2:08am UTC](https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340/3 "2017-01-13T02:08:31Z")

</div>

I‘m using the java api,and found that ’SortBuilders has new function call scoreSort,i use this solve the problem(original use fieldSort with "\_score").

---

<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:** [February 10, 2017, 2:08am UTC](https://discuss.elastic.co/t/sort-by--score-error-in-es5-1-1/71340/4 "2017-02-10T02:08:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
