# Sort on multiple fields with different weighted criteria

**URL:** <https://discuss.elastic.co/t/sort-on-multiple-fields-with-different-weighted-criteria/244147>\
**Category:** Elasticsearch\
**Created:** [August 7, 2020, 9:43am UTC](https://discuss.elastic.co/t/sort-on-multiple-fields-with-different-weighted-criteria/244147 "2020-08-07T09:43:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![neeraj142](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neeraj142/32/85199_2.png) [@neeraj142](https://discuss.elastic.co/u/neeraj142)\
**Post date:** [August 7, 2020, 9:43am UTC](https://discuss.elastic.co/t/sort-on-multiple-fields-with-different-weighted-criteria/244147/1 "2020-08-07T09:43:31Z")

</div>

as i am doing shorting on multiple fields  
{ followersCount: { order: 'desc' } },  
{ averageRating: 'desc' },  
{  
\_geo\_distance: {  
coordinates:  
[lng,  
lat],  
order: "asc",  
unit: "km",  
distance\_type: "arc",  
ignore\_unmapped: true  
}  
},

The business are sort 100% on first short than on 100 % on second sort key

for example [7,5,7] ,[2,9,9] ,[6, 3,8]

the result is [7,5,7] ,[6, 3,8] ,[2,9,9]

i am bit confused here can we define the weight to sorting key is it is possible

i have to sort according this criteria

1. Count of follower - 50%
2. Average rating of the business - 40%
3. Location - the closest businesses will be given more score - 10%

---

<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:** [September 4, 2020, 9:43am UTC](https://discuss.elastic.co/t/sort-on-multiple-fields-with-different-weighted-criteria/244147/2 "2020-09-04T09:43:36Z")

</div>

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