Elasticsearch feature for rating

Yes, got it.

The question is,lets suppose i have an restaurant application and there user gives rating to the restaurant. Lets suppose there is restaurant abc and its rating changes based on user rating.

How Elastic Search calculate the average rating and ingest the changed rating to the document automatically. is there any feature or property in elastic search?