How can I filter by count? / How can I apply a custom filter?

This question is a continuation of the following question : https://discuss.elastic.co/t/filter-based-on-the-doc-count-with-aggregations/62677

When building aggregations in Kibana , I get the following output :

My question is , how can I filter by count?

For example : Build a visualization where "doc_count": 4

Or , how can I run this specific query ?

GET /cars/transactions/_search
{

   "size": 0,
   "aggs": {
      "popular_colors": {
         "terms": {
            "field": "color"
         },
         "aggs": {
            "my_filter": {
               "bucket_selector": {
                  "buckets_path": {
                     "the_doc_count": "_count"
                  },
                  "script": "the_doc_count == 4"
               }
            }
         }
      }
   }
}

That query at the end of your post uses a pipeline aggregation, which isn't yet supported in Kibana.

Can you filter the doc_count in Kibana with any other method?

not at the moment

I understand , thank you