How filter an aggregation result

I have a query that return the max date from articles by blog.

But I want only the blogs that don't have any new article from 1 month ago.

   GET article_stats/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "blog_disabled": false
          }
        }
      ]
    }
  },
  "aggs": {
    "blog_id": {
        "terms": {
          "field": "blog_slug",
          "size": 1000
        },
        "aggs": {
          "max_date": {
            "max": {
              "field": "date"
            }
          }
        }
      }
      },
  "size": 0
}

Is it possible to filter the result of the aggregation for having only the blog with article older than 1 month ?

Jean

Use a filter aggregation: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html
And add your date filter in it.

This should work.