# Restriction on amount of records returned by elasticsearch

**URL:** <https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412>\
**Category:** Elasticsearch\
**Created:** [November 13, 2017, 3:24pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412 "2017-11-13T15:24:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilpor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilpor/32/24043_2.png) [@bilpor](https://discuss.elastic.co/u/bilpor)\
**Post date:** [November 13, 2017, 3:24pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/1 "2017-11-13T15:24:07Z")

</div>

Hi All,

It doesn't matter what type of search I perform. (I know for example one particular search I do should return over 1000 records/entries on the index). In Kibana using the Dev Tools window, the output window may show hit's with a total 1033 but actual records returned are never any greater than 10. I'm trying to perform the exact same query via classic asp and a call using the MSXML2 library and this has the same issue. It returns me the same records that I see via Kibana,

So I'm thinking that there is a restriction somewhere in the ElasticSearch config, but I dont know what to look for to increase this size.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 13, 2017, 3:37pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/2 "2017-11-13T15:37:36Z")

</div>

`"size": 1000` ?

---

<div class="post-metadata">

**Author:** ![bilpor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilpor/32/24043_2.png) [@bilpor](https://discuss.elastic.co/u/bilpor)\
**Post date:** [November 13, 2017, 4:15pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/3 "2017-11-13T16:15:42Z")

</div>

Basically if I do my select in SQL Server. i have returned 1033 records. The same index that indexes that table will show the hits total 1033, but will only return me 10 records. i.e. Im expecting elasticsearch to return me 1033 documents, but it never returns more than 10. Even when I just do a simple match\_all I still get only 10

in SQL if I do

> select \* from News

it will return 1737 rows

in Kibana against the index that maps to this table if I do:

```
GET newsindex/_search
{
     "query": { "match_all" : {}}
}

```

then in the kibana output window I see

> .... "hits": { "total": 1737, .....

but paging down the window I dont see anymore than 10.

For further clarity:

when I created the index, I created a property called "author". I only see 10 "author" values

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 13, 2017, 4:36pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/4 "2017-11-13T16:36:26Z")

</div>

So I said, run:

```auto
GET newsindex/_search
{
  "size": 1737
}

```

And you'll get your 1737 hits.

---

<div class="post-metadata">

**Author:** ![bilpor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilpor/32/24043_2.png) [@bilpor](https://discuss.elastic.co/u/bilpor)\
**Post date:** [November 13, 2017, 4:45pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/5 "2017-11-13T16:45:36Z")

</div>

that's ok in my test scenario, but for real I may not know the amount of records I'm expecting back, I need the query to send me back ALL available records based on my Query not just the first 10 or a subset.

I also just ran your code, and it still only returned me 10 entries in the kibana output window

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 13, 2017, 5:30pm UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/6 "2017-11-13T17:30:57Z")

</div>

> I also just ran your code, and it still only returned me 10 entries in the kibana output window

I don't know. But yeah may be.

> I need the query to send me back ALL available records based on my Query not just the first 10 or a subset.

Then you need to use scroll API which is built for that: [Scroll | Elasticsearch Reference [5.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-scroll.html)

---

<div class="post-metadata">

**Author:** ![bilpor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilpor/32/24043_2.png) [@bilpor](https://discuss.elastic.co/u/bilpor)\
**Post date:** [November 14, 2017, 9:00am UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/7 "2017-11-14T09:00:41Z")

</div>

HI dadoonet,

I tried an example using this link. On my initial search it did return more than 10 records, and it returned me a scroll Id. I then did a get using the scroll id based on the documentation i.e.:

```
GET _search/scroll
{
  "scroll": "1m",
  "scroll_id": "DnF1ZXJ5VGhlbkZldGNoAwAAAAAACmZTFlcwMm9YN3NlUjZXMnBxTDZnX2E4aEEAAAAAAApmURZXMDJvWDdzZVI2VzJwcUw2Z19hOGhBAAAAAAAKZlIWVzAyb1g3c2VSNlcycHFMNmdfYThoQQ=="
}

```

and it always errors of the type: "search\_context\_missing\_exception"

I first thought perhaps the first get returned me all my records hence, nothing left to scroll, so I reduced the size parameter on my inital query, and tried again after deleting the scroll. This still made no difference.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 14, 2017, 10:40am UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/9 "2017-11-14T10:40:04Z")

</div>

Can you reproduce with a full example, including the top of the responses?

---

<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:** [December 12, 2017, 10:40am UTC](https://discuss.elastic.co/t/restriction-on-amount-of-records-returned-by-elasticsearch/107412/10 "2017-12-12T10:40:27Z")

</div>

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