# Random inner hits

**URL:** <https://discuss.elastic.co/t/random-inner-hits/64842>\
**Category:** Elasticsearch\
**Created:** [November 3, 2016, 10:58am UTC](https://discuss.elastic.co/t/random-inner-hits/64842 "2016-11-03T10:58:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![francesconero](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francesconero/32/11981_2.png) [@francesconero](https://discuss.elastic.co/u/francesconero)\
**Post date:** [November 3, 2016, 10:58am UTC](https://discuss.elastic.co/t/random-inner-hits/64842/1 "2016-11-03T10:58:11Z")

</div>

Is there any way to retrieve a set of inner hits in a random order?

Using a random\_score function inside a function\_score query in the nested query assigns the same random score to all inner hits for a certain parent document (it seems the random score gets calculated once per parent document hit, and not for each inner hit).

---

<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:07pm UTC](https://discuss.elastic.co/t/random-inner-hits/64842/2 "2017-07-05T22:07:00Z")

</div>

Closed on July 5, 2017, 10:07pm UTC


