Field Statistics Export + API

Within Kibana, when clicking the "Field Statistics" for any given index, I was wondering if there's an easy way of saving the results, in particular the top-value statistics for each field. I've tried saving a webarchive, but the output is garbled. Is there a sensible way to export these field statistics?

Alternatively, is there an API way to query Field Statistics for any given index, to return results? Ideally, with a parameter "K" specifying the "Top K" values for each field?

Check this out Terms aggregation | Elasticsearch Guide [8.17] | Elastic