title: Elasticsearch error: Validation Failed: 1: parent histogram of moving_avg aggregation [3] must have min_doc_count of 0;
body: <p>Yesterday we updated elastic from 7.4.x to 7.10.1 and some of our grafana dashboards broke with the following error:</p>
  <blockquote>
  <p>Elasticsearch error: Validation Failed: 1: parent histogram of
  moving_avg aggregation [3] must have min_doc_count of 0;</p>
  </blockquote>
  <p>The dashboard used to represent a moving average and had a min_doc_count of 20 to exclude weekends.</p>
  <p>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.</p>
  <p>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?</p>
  <p>Thank you for your help.
  A snip of the query:</p>
  <pre><code>&quot;aggs&quot;:{
     &quot;2&quot;:{
        &quot;date_histogram&quot;:{
           &quot;interval&quot;:&quot;1d&quot;,
           &quot;field&quot;:&quot;metadata.timestamp&quot;,
           &quot;min_doc_count&quot;:&quot;20&quot;,
           &quot;extended_bounds&quot;:{
              &quot;min&quot;:1614248733448,
              &quot;max&quot;:1622021133448
           },
           &quot;format&quot;:&quot;epoch_millis&quot;
        },
        &quot;aggs&quot;:{
           &quot;1&quot;:{
              &quot;avg&quot;:{
                 &quot;field&quot;:&quot;some_variable_in_minutes&quot;,
                 &quot;script&quot;:&quot;(_value &lt; 30) ? 100: 0&quot;
              }
           },
           &quot;3&quot;:{
              &quot;moving_avg&quot;:{
                 &quot;buckets_path&quot;:&quot;1&quot;,
                 &quot;minimize&quot;:false,
                 &quot;model&quot;:&quot;simple&quot;,
                 &quot;window&quot;:5
              }
           }
        }
     }
  }
  </code></pre>