Aggregation Path

I want to use global number of total docs in bucket script. But getting the error No aggregation found for path [global_total_docs>total_docs]
can you please help me to identify the right aggregation path?

GET bl_log_data/_search
{
  "size": 0,
  "aggs": {
    "global_total_docs": {
      "global": {},
      "aggs": {
        "total_docs": {
          "value_count": {
            "field": "_index"
          }
        }
      }
    },
    "group_by_keyword": {
      "terms": {
        "field": "response_code.keyword"
      },
      "aggs": {
        "percentage": {
          "bucket_script": {
            "buckets_path": {
              "doc_count": "_count",
              "total_docs": "global_total_docs>total_docs"
            },
            "script": "params.doc_count / params.total_docs * 100"
          }
        }
      }
    }
  }
}

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