# Normalize Elasticsearch score with subfield length

**URL:** <https://discuss.elastic.co/t/normalize-elasticsearch-score-with-subfield-length/175413>\
**Category:** Elasticsearch\
**Created:** [April 4, 2019, 12:46pm UTC](https://discuss.elastic.co/t/normalize-elasticsearch-score-with-subfield-length/175413 "2019-04-04T12:46:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erkethan](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@Erkethan](https://discuss.elastic.co/u/Erkethan)\
**Post date:** [April 4, 2019, 12:46pm UTC](https://discuss.elastic.co/t/normalize-elasticsearch-score-with-subfield-length/175413/1 "2019-04-04T12:46:53Z")

</div>

I have some documents in ElasticSearch, and each document has one or many appendices. When I do a search on the text of the appendices, I often got scores greater than 1. When I do searches with really common patterns, I realize that more the document has appendices, greater its score is. So, I aim to 'normalize' the scores, by dividing each document score by the number of appendices it has.

For example, for this query:

```auto
"query": {
  "match": {
    "document.appendices.text" = "What is love?"
  }
}

```

I wish to do `score = score / length(document.appendices)` but I don't know how to express it.

It that possible, or all the appendices has to be indexed as document to achieve this?

Many thanks community!

---

<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:** [May 2, 2019, 12:47pm UTC](https://discuss.elastic.co/t/normalize-elasticsearch-score-with-subfield-length/175413/2 "2019-05-02T12:47:04Z")

</div>

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