# Get list with all users name?

**URL:** <https://discuss.elastic.co/t/get-list-with-all-users-name/25434>\
**Category:** Elasticsearch\
**Created:** [July 13, 2015, 10:21am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434 "2015-07-13T10:21:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 10:21am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/1 "2015-07-13T10:21:38Z")

</div>

Hi!!!  
I have many documents with field "user-name".  
I want to see list with all user names in it.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 13, 2015, 10:23am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/2 "2015-07-13T10:23:44Z")

</div>

This probably answers your question:

> <https://stackoverflow.com/questions/25465215/elasticsearch-return-unique-values>

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 11:03am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/3 "2015-07-13T11:03:44Z")

</div>

@magnusbaeck  
Well i create a aggs  
"size": 0,  
"aggs" : {  
"user-ids" : {  
"terms" : { "field" : "user-id" }  
}  
}  
But it returns me only 12 id's. How can i increase numbers of id's in my response? (i have it apx. 7000) And i want to see all of them.  
The respond looks like this:  
"aggregations": {  
"user-ids": {  
"doc\_count\_error\_upper\_bound": 137,  
"sum\_other\_doc\_count": 97335,  
"buckets": [  
{  
"key": 572773,  
"doc\_count": 646  
},  
{  
"key": 665035,  
"doc\_count": 533  
},  
{  
"key": 672046,  
"doc\_count": 425  
},  
{  
"key": 672870,  
"doc\_count": 403  
},  
{  
"key": 192596,  
"doc\_count": 364  
},  
{  
"key": 588616,  
"doc\_count": 361  
},  
{  
"key": 401020,  
"doc\_count": 348  
},  
{  
"key": 664634,  
"doc\_count": 347  
},  
{  
"key": 673037,  
"doc\_count": 340  
},  
{  
"key": 669806,  
"doc\_count": 334  
}  
]  
}  
}

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 11:04am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/4 "2015-07-13T11:04:52Z")

</div>

Sorry not 12 but 10

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 11:09am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/5 "2015-07-13T11:09:19Z")

</div>

I mean I want to see all buckets not only 10.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 13, 2015, 11:18am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/6 "2015-07-13T11:18:15Z")

</div>

this should help you: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#\_size](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_size)

Note that it is not a good idea to set `size` to `0` as this can lead to memory issues. If you are expecting approx 7000 values I would set `size` to `10000`.

Note that this `size` parameter is inside the `terms` aggregation and is not the same as the `size` parameter you already have in your request.

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 11:24am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/7 "2015-07-13T11:24:48Z")

</div>

@colings86  
Well, there is no any solution like \_all in size?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 13, 2015, 11:25am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/8 "2015-07-13T11:25:35Z")

</div>

If you want the `user-name` field of _all_ documents (i.e. no aggregation at all) try this:

```
POST /name-of-your-index/_search
{
  "query": {
    "constant_score": {
      "filter": {
        "exists": {
          "field": "user-name"
        }
      }
    }
  },
  "fields": ["user-name"],
  "size": 10000
}

```

(If you don't have an reasonable accurate upper bound on the number of documents to return, have a look at the [scan and scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html).

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 13, 2015, 9:53pm UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/9 "2015-07-13T21:53:12Z")

</div>

@magnusbaeck  
Sorry I can't find answer.  
I have request  
POST /name-index/\_search  
{  
"filter": {  
"term": {  
"event\_type": "03\_finish\_tutorial\_battle1"  
}  
}  
}  
and i want to see all my 1235 document in response (something like "size": "\_all"). Is it possible?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 14, 2015, 5:35am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/10 "2015-07-14T05:35:33Z")

</div>

To get _all_ documents, set `size` to zero. Or what's the problem?

---

<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 6, 2017, 12:01am UTC](https://discuss.elastic.co/t/get-list-with-all-users-name/25434/11 "2017-07-06T00:01:39Z")

</div>


