# Score Sorting and shuffle Adversiting results

**URL:** <https://discuss.elastic.co/t/score-sorting-and-shuffle-adversiting-results/109602>\
**Category:** Elasticsearch\
**Created:** [November 29, 2017, 1:17pm UTC](https://discuss.elastic.co/t/score-sorting-and-shuffle-adversiting-results/109602 "2017-11-29T13:17:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucashfreitas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lucashfreitas/32/23166_2.png) [@lucashfreitas](https://discuss.elastic.co/u/lucashfreitas)\
**Post date:** [November 29, 2017, 1:17pm UTC](https://discuss.elastic.co/t/score-sorting-and-shuffle-adversiting-results/109602/1 "2017-11-29T13:17:32Z")

</div>

Hello guys,

My site use elasticsearch query for fetch adversiting data of customers. My query on elastic sort data considering **SCORE** calculed from score function. (_I use score because many properties make a difference in the order that the data should be returned from elastic, such as whether the ad is premium or not etc._)

I need to keep sorting by score, but i want to Shuffle data for elasticsearch brings adversiting from different customers, which are differentiated by the **customerID** field. As the records are sorted by score, elastic returns a certain flood, containing multiple pages with adversting from just one customer.

Basically i wanna keep soring by function score, avoid the flood and bring as much as more possible different customers adversiting, that is diferencied by field **customerID**

**PRACTICAL EXAMPLE:**

I have customer A that have 80 adversiting.  
I have customer B that have 12 adversiting.

The adverstings of A and B are ordered by score and both ADS that elastic returns have a high score value. But elasticsearch query returns FIRST 80 adversiting of A and after 12 adversiting of B. Since my website is paging results, the adversiting of customer B will be shown only in last pages leaving customer B at a disadvantage.

---

<div class="post-metadata">

**Author:** ![lucashfreitas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lucashfreitas/32/23166_2.png) [@lucashfreitas](https://discuss.elastic.co/u/lucashfreitas)\
**Post date:** [December 6, 2017, 8:06pm UTC](https://discuss.elastic.co/t/score-sorting-and-shuffle-adversiting-results/109602/2 "2017-12-06T20:06:24Z")

</div>

Someone can help, please?

---

<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:** [January 3, 2018, 8:06pm UTC](https://discuss.elastic.co/t/score-sorting-and-shuffle-adversiting-results/109602/3 "2018-01-03T20:06:43Z")

</div>

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