Extract the values of a field from elasticsearch

I have a field name across 100 documents. I want to extract the values that the name field has across all documents without returning duplicate.
how can I achieve that.

if the field is called "xyz", aggregate using below payload assuming xyz is string.
If it's number, then just remove ".keyword".
"label" is just a name you give for reference when you get the payload back.
This will give you all unique "xyz" values in your index.

"aggs": {
    "label": {
      "terms": {
        "field": "xyz.keyword",
        "size": 100

This is giving me only 10 of the values of the fields.
so the field is this way,

I am trying to get all values of a and b

"size" defaults to 10.

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