What apis should be userd to calculate the total of a field in some documents in ElasticSearch?

Now I have some documents in ElasticSearch like this:
{"books":[{"name":"book1" , "price":14} , {"name":"book2" , "price":14}]}

{"books":[{"name":"book3" , "price":14} , {"name":"book4" , "price":12}]}

There are 3 books whose price is 14.
I tried "term" , but I can only get 2 , it is the total of the docments which have {"price":14}
I don't know how to accomplish it with ES..