# Elasticsearch feature for rating

**URL:** <https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410>\
**Category:** Elasticsearch\
**Created:** [September 16, 2021, 2:05pm UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410 "2021-09-16T14:05:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic\_dev](https://avatars.discourse-cdn.com/v4/letter/e/cab0a1/32.png) [@elastic\_dev](https://discuss.elastic.co/u/elastic_dev)\
**Post date:** [September 16, 2021, 2:05pm UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/1 "2021-09-16T14:05:28Z")

</div>

Hi, what feature does Elastic Search provide for rating? For example, I have a restaurant application and I want to update the restaurant rating and how can I sort the query on the basis of rating for nearby restaurants.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 16, 2021, 2:19pm UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/2 "2021-09-16T14:19:35Z")

</div>

If you have a `rate` field in your document, you can use this for example: [Function score query | Elasticsearch Guide [7.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-field-value-factor)

---

<div class="post-metadata">

**Author:** ![elastic\_dev](https://avatars.discourse-cdn.com/v4/letter/e/cab0a1/32.png) [@elastic\_dev](https://discuss.elastic.co/u/elastic_dev)\
**Post date:** [September 16, 2021, 2:36pm UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/3 "2021-09-16T14:36:55Z")

</div>

okay and what type should i use for rating. i tried integer and floating but it gave me error while adding values to it.

Moreover what about ranking evaluation api, can i also use for rating?

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [September 20, 2021, 8:52am UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/4 "2021-09-20T08:52:30Z")

</div>

> [@elastic\_dev](#):
>
> ranking evaluation api, can i also use for rating

No, that API doesn't adress the use case of adding ratings to individual documents and then querying for it. It is rather an API for rating sets of search results for their retrival quality based on some previously collected gold standard. See [How to Use the Ranking Evaluation API in Elasticsearch | Elastic Blog](https://www.elastic.co/de/blog/made-to-measure-how-to-use-the-ranking-evaluation-api-in-elasticsearch) for details.

---

<div class="post-metadata">

**Author:** ![elastic\_dev](https://avatars.discourse-cdn.com/v4/letter/e/cab0a1/32.png) [@elastic\_dev](https://discuss.elastic.co/u/elastic_dev)\
**Post date:** [September 20, 2021, 9:20am UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/5 "2021-09-20T09:20:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 18, 2021, 9:21am UTC](https://discuss.elastic.co/t/elasticsearch-feature-for-rating/284410/6 "2021-10-18T09:21:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
