_bucket_count in bucket_selector- pipeline aggregation


(liorg2) #1

hello,
I'm trying to make this work with no luck. should this syntax even work?
I am referring this git issue:

thanks!

GET client_data_228_d_2017-03-15,client_data_228_d_2017-03-16/prt/_search?ignore_unavailable
{
  "size": 0,
  "aggs": {
    "groupby_country": {
      "terms": {
        "field": "country",
        "size": 2000
      },
      "aggs": {
        "should_we_consider": {
          "bucket_selector": {
            "buckets_path": {
              "hits": "groupby_domain.**_bucket_count**"
            },
            "script": "_bucket_count.hits>0"
          }
        },
        "groupby_domain": {
          "terms": {
            "field": "domain",
            "size": 2000
          },
          "aggs": {
            "groupby_page": {
              "terms": {
                "field": "page",
                "size": 2000,
                "min_doc_count": 2
              }
            }
          }
        }
      }
    }
  }
}

(liorg2) #2

was a silly copy-paste error.

{
  "size": 0,
  "aggs": {
    "groupby_country": {
      "terms": {
        "field": "country",
        "size": 2000
      },
      "aggs": {
        "should_we_consider": {
          "bucket_selector": {
            "buckets_path": {
              "hits": "groupby_domain._bucket_count"
            },
            "script": "params.hits > 0"
          }
        },
        "groupby_domain": {
          "terms": {
            "field": "domain",
            "size": 2000
          },
          "aggs": {
            "groupby_page": {
              "terms": {
                "field": "page",
                "size": 2000,
                "min_doc_count": 2
              }
            }
          }
        }
      }
    }
  }
}

(system) #3

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