Elastic search query to get ranking of documents

Hi There,
We are having a requirement where we need to query the documents based on their ranking. We have a separate application where we customers will create some documents for a given category and the documents for the given category will be ranked in the tool. and we have a mechanism to update the elastic nodes whenever there is an action in the tool to store the data.
My question is What would be the best approach to store and retrieve the data from elastic nodes for the below requirement
Display the documents based on their rank for the given category?

Optimal way to store the relationship between the cat, docu id and rank in the elastic nodes and to query the same.
It would be better if somebody throw some light on this.