# Scroll parameter to get all the values from ES indices

**URL:** <https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135>\
**Category:** Elasticsearch\
**Created:** [December 9, 2019, 2:12pm UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135 "2019-12-09T14:12:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blason](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blason/32/42284_2.png) [@Blason](https://discuss.elastic.co/u/Blason)\
**Post date:** [December 9, 2019, 2:12pm UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135/1 "2019-12-09T14:12:26Z")

</div>

Hi Folks,

I am running this query to get the IP addresses from ES indices however I noticed that I am unable to get all the src\_ips and then found the scroll parameter.

Can someone please confirm if scroll API will help me find all the src\_ips since beginning?

```auto
curl -s -XGET "https://127.0.0.1:16577/$INDICES/_search" -H 'Content-Type: application/json' -d'
{
  "aggs": {
    "ips": {
      "terms": { "field": "src_ip.keyword", "size": 10000 }
      }
    },
  "size" : 0
  }'
}

```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 11, 2019, 9:06am UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135/2 "2019-12-11T09:06:03Z")

</div>

If you want just the IPs and none of the docs you should use the `composite` aggregation and page results with the `after` parameter rather than use the `terms` aggregation

---

<div class="post-metadata">

**Author:** ![Blason](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blason/32/42284_2.png) [@Blason](https://discuss.elastic.co/u/Blason)\
**Post date:** [December 11, 2019, 6:01pm UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135/3 "2019-12-11T18:01:41Z")

</div>

Hmm..would you please paste an example here? I am unable to co-relate how do I connect with my above query.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 11, 2019, 9:43pm UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135/4 "2019-12-11T21:43:52Z")

</div>

Change the word “terms” in your example to “composite”. Then read the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html) on how to get the next 10000 using the “after” parameter

---

<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 8, 2020, 9:43pm UTC](https://discuss.elastic.co/t/scroll-parameter-to-get-all-the-values-from-es-indices/211135/5 "2020-01-08T21:43:55Z")

</div>

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