I am trying to calculate the total number of times a particular term occurs throughout an entire index (term collection frequency). I have attempted to do so through the use of
Have you tried simply using COUNT API? https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-count.html
It can return the number of matches for a query. So something like this may work.
GET /my_index/_count { "query" : {"match": {"my_field": "my_keyword"} }