Elasticsearch error: Validation Failed: 1: parent histogram of moving_avg aggregation [3] must have min_doc_count of 0;

Greetings everyone
Yesterday we updated elastic from 7.4.x to 7.10.1 and some of our grafana dashboards broke with the following error:

Elasticsearch error: Validation Failed: 1: parent histogram of moving_avg aggregation [3] must have min_doc_count of 0;

The dashboard used to represent a moving average and had a min_doc_count of 20 to exclude weekends.
But now it does not work after the update.
We also updated our grafana from 6.x to 7.x, but i'm not sure if grafana is the culprit here.

I understood that the moving average aggregate cannot have min_doc_count higher than 0, and if i set it to 0, it works.
But how come in 7.4.x it worked and 7.10.1 it does not work?

Thank you for your help.
A snip of the query:

"aggs":{
   "2":{
      "date_histogram":{
         "interval":"1d",
         "field":"metadata.timestamp",
         "min_doc_count":"20",
         "extended_bounds":{
            "min":1614248733448,
            "max":1622021133448
         },
         "format":"epoch_millis"
      },
      "aggs":{
         "1":{
            "avg":{
               "field":"some_variable_in_minutes",
               "script":"(_value < 30) ? 100: 0"
            }
         },
         "3":{
            "moving_avg":{
               "buckets_path":"1",
               "minimize":false,
               "model":"simple",
               "window":5
            }
         }
      }
   }
}

Hey,

would it be possible to create a fully reproducible example, test this under the latest release (7.13.0) and if that fails open a github issue at Issues · elastic/elasticsearch · GitHub - also include the exact version where the same query was still working.

Thank you!

--Alex

Tested the query on a local machine on elastic 7.4.2 and it works fine.
Tested it again on a local machine, but on 7.10.1 and it returns the mentioned error.
It seems between 7.4.2 and 7.10.1 it was decided to not allow the min_doc_count to be higher than 0 on moving_fn or date_histograms.
The only documentation that clearly states this is on Derivative aggregation:

I would recommend to close this issue as i decided not to pursue further for now.
Thank you for your collaboration.

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