'elasticsearch index usage , query stats collection

I am new to elasticsearch , need to analyze elasticsearch index utilisation , please, advice best practices on how can I collect statistics on queries sent to elasticsearch or particular index and sort by frequency so I can identify at later stage if any optimisations can be done from application side ?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source