# Nested value on function score

**URL:** <https://discuss.elastic.co/t/nested-value-on-function-score/29935>\
**Category:** Elasticsearch\
**Created:** [September 24, 2015, 5:22pm UTC](https://discuss.elastic.co/t/nested-value-on-function-score/29935 "2015-09-24T17:22:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [September 24, 2015, 8:43pm UTC](https://discuss.elastic.co/t/nested-value-on-function-score/29935/2 "2015-09-24T20:43:28Z")

</div>

You'd want to do something like this and you may want to consider using field value factor:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-field-value-factor](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-field-value-factor)

```auto
{
  "query": {
    "filtered": {
      "query": {
        "nested": {
          "path": "reviews",
          "query": {
            "function_score": {
              "query": {
                "term": {
                  "reviews.userId": {
                    "value": "1"
                  }
                }
              },
              "functions": [
                {
                  "field_value_factor": {
                    "field": "reviews.rating"
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/nested-value-on-function-score/29935)._
