Why aggregation result return max results only 10


(Manish Sharma) #1

i have a query on which i am bucketing year wise. Result return only 10 results


(Mark Harwood) #2

If you're talking about the terms aggregation the default size is 10.


(David Pilato) #3

Adding that if you have a date field you should use a date histogram agg probably.


(Manish Sharma) #4
   GET /demo/_search
    {
      "size": 0,
      "query":{
        "term": {
          "STATUS": {
            "value": 3
          }
        }
      },
      "aggs": {
        "SALE": {
          "terms": {
            "field": "YEAR.keyword"
          },
          "aggs": {
            "sales": {
              "sum": {
                "field": "PRICE"
              }
            }
          }
        }
      }
    }

(David Pilato) #5

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

"terms": {
  "field": "YEAR.keyword"
}

So it's a Terms aggregation and as @Mark_Harwood wrote: