How to calculate percentage of a field over all documents present in index

You can use Terms aggregation | Elasticsearch Guide [8.8] | Elastic to create the first lot of buckets.

From there you have two options;

  1. calcuate the percentage outside Elasticsearch
  2. use something like this Using doc_count to calculate percentage after aggregation - #2 by spinscale

Elasticsearch doesn't provide this sort of output itself.