例如,这是我在elasticsearch中的数据:
{"name":"Tom", "score":100, "subject":"math"}
{"name":"Amy", "score":90, "subject":"math"}
{"name":"Jeffry", "score":95, "subject":"math"}
{"name":"Tom", "score":80, "subject":"verbal"}
{"name":"Amy", "score":98, "subject":"verbal"}
{"name":"Jeffry", "score":70, "subject":"verbal"}
{"name":"Tom", "score":90, "subject":"science"}
{"name":"Amy", "score":85, "subject":"science"}
{"name":"Jeffry", "score":70, "subject":"science"}
我如何获得汤姆在所有科目的分数中的排名?像{“数学”:1,“语言”:2,“科学”:1}