# Trouble with Elasticsearch sort

**URL:** <https://discuss.elastic.co/t/trouble-with-elasticsearch-sort/136183>\
**Category:** Elasticsearch\
**Created:** [June 16, 2018, 5:42pm UTC](https://discuss.elastic.co/t/trouble-with-elasticsearch-sort/136183 "2018-06-16T17:42:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![StartupFlux](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/startupflux/32/17375_2.png) [@StartupFlux](https://discuss.elastic.co/u/StartupFlux)\
**Post date:** [June 16, 2018, 5:42pm UTC](https://discuss.elastic.co/t/trouble-with-elasticsearch-sort/136183/1 "2018-06-16T17:42:19Z")

</div>

We have 3 sorting options in our application:  
Recommended, Distance and Rating.  
User can search by a Service and/or a Location. By default, if location is filled we show results that are within 50 miles of the search location. if service is filled, we show all professionals that provide that service.  
When both are selected we query all professional within 50 miles of the location that provide that service.

Now the problem:  
I want to show the results from query above, assign weightage to one of the parameters(recommended, distance, rating)  
Eg:  
Recommended sort: 50% weightage Recommended, 30% rating, 20% distance  
Distance sort: 70% weightage distance, 20% recommended, 10% rating  
Rating sort: 70% rating, 20% distance, 10% recommended

---

<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 14, 2018, 5:42pm UTC](https://discuss.elastic.co/t/trouble-with-elasticsearch-sort/136183/2 "2018-07-14T17:42:20Z")

</div>

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