Bucket_script aggregation on filters aggregation not showing results

Hello!

I have "event" (like clicks on websites) documents in a index. Now I want to to calculate the ratio between events with name=x and events with name=y. I use a bucket_script aggregation for that, but the result of it is not shown in the output...

Here is my query:

    GET /_search 
    {
      "query": { ... },
      "aggs": {
        "all_my_documents": {
          "filters": {
            "filters": {
              "all": { "match_all": {} }
            }
          }, 
          "aggs": {

            "bucket-aggregation-for-clicks-per-conversation": {
              "filters": {
                "filters": {
                  "presentation-clicks": { "term" : { "name" : "presentation-anchor-click" }},
                  "conversation-starts": { "term" : { "name" : "conversation-start" }}
                }
              }
            }, 
            "how-many-clicks-per-conversation": {
              "bucket_script": {
                  "buckets_path": {
                      "my_clicks": "bucket-aggregation-for-clicks-per-conversation['presentation-clicks']>_count", 
                      "my_starts": "bucket-aggregation-for-clicks-per-conversation['conversation-starts']>_count"
                  },
                  "script": "params.my_clicks / params.my_starts"
              }
            }

          }
        }
        
      }
    }

The query runs and as a result I get my two buckets but the "how-many-clicks-per-conversation" script does not seem to be run at all, because the value is missing from the output:

    ...
    "aggregations" : {
      "all_my_documents" : {
        "buckets" : {
          "all" : {
            "doc_count" : 5,
            "bucket-aggregation-for-clicks-per-conversation" : {
              "buckets" : {
                "conversation-starts" : {
                  "doc_count" : 4
                },
                "presentation-clicks" : {
                  "doc_count" : 1
                }
              }
            }
          }
        }
      }
    }

So, why is my bucket_script not showing up in the output? Every help is greatly appreciated!

Thanks in advance
Anton

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