Getting error when using variable_width_histogram aggregation 'Too many buckets'

We are trying to execute a query to get variable_width_histogram aggregation results but getting an error 'Trying to create too many buckets'. However bucket size in query is 10. When trying to get bucket size 8, I am able to get results correctly but with size 10, this error is coming.

{
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "must": [
              {
                "query_string": {
                  "fields": [
                    "field1",
                    "field2"
                  ],
                  "default_operator": "AND",
                  "query": "(product1)"
                }
              }
            ]
          }
        }
      ],
      "must": [],
      "must_not": []
    }
  },
  "size": 0,
  "aggs": {
    "minMaxPriceRangeData": {
      "filter": {
        "bool": {
          "must": []
        }
      },
      "aggs": {
        "piceRangeData": {
          "variable_width_histogram": {
            "field": "value",
            "buckets": 10
          }
        }
      }
    }
  }
}

Total result doc count are 7974263 on which this query is running. Is there any other way we can extract similar data without any error?

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