How do I access term frequency in painless scripting?

I want to do an aggregation where I measure the average frequency of a given term. The only way I can see of doing this is via a painless script. But according to the docs, I only have doc available which has all the fields and terms, but I don't know how to access the actual term frequencies that have already been calculated and stored in the index via the script.

Term frequencies are not available within painless. However, this can be accomplished through advanced scripting.

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