# Predefined number of random results from every \_type

**URL:** <https://discuss.elastic.co/t/predefined-number-of-random-results-from-every--type/56326>\
**Category:** Elasticsearch\
**Created:** [July 25, 2016, 6:14pm UTC](https://discuss.elastic.co/t/predefined-number-of-random-results-from-every--type/56326 "2016-07-25T18:14:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_Adams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eddie_adams/32/5219_2.png) [@Eddie\_Adams](https://discuss.elastic.co/u/Eddie_Adams)\
**Post date:** [July 25, 2016, 6:14pm UTC](https://discuss.elastic.co/t/predefined-number-of-random-results-from-every--type/56326/1 "2016-07-25T18:14:17Z")

</div>

Is it possible to get a predefined number of random results from every \_type? For example when there are 5 types and the predefined number is 10, the final result will be 10 random results from each type resulting in a total of 50.

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 28, 2016, 2:01pm UTC](https://discuss.elastic.co/t/predefined-number-of-random-results-from-every--type/56326/2 "2016-07-28T14:01:09Z")

</div>

You can affect how documents get scored (randomly etc.). But you cannot change how many documents you get back. That you can control through the `size` parameter that you can provide with the search request:

`GET /_search?size=30`

you can also provide size as a top level field in the json request body.

So the logic depending on the number of types etc. should be moved to the client side I believe.

---

<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:32pm UTC](https://discuss.elastic.co/t/predefined-number-of-random-results-from-every--type/56326/3 "2017-07-05T22:32:03Z")

</div>

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


