# Field length and average field lengths BM25

**URL:** <https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105>\
**Category:** Elasticsearch\
**Created:** [February 22, 2021, 6:01pm UTC](https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105 "2021-02-22T18:01:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![d3v3lop3r](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/d3v3lop3r/32/77472_2.png) [@d3v3lop3r](https://discuss.elastic.co/u/d3v3lop3r)\
**Post date:** [February 22, 2021, 6:01pm UTC](https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105/1 "2021-02-22T18:01:17Z")

</div>

I dont quite understand the forumula of the BM25 explained here:

> **[Practical BM25 - Part 2: The BM25 Algorithm and its Variables](https://www.elastic.co/de/blog/practical-bm25-part-2-the-bm25-algorithm-and-its-variables)**
>
> BM25 is the default similarity ranking (relevancy) algorithm in Elasticsearch. Learn more about how it works by digging into the equation and exploring the concepts behind its variables.

What is menat by the field length?

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [February 22, 2021, 6:23pm UTC](https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105/2 "2021-02-22T18:23:01Z")

</div>

Field length is a number of terms in the current field of the current document.

For example:  
if a doc1 has a field `field1` with a value "foo foo bar", its field length will be 3.  
if a doc2 has a field `field1` with a value "foo foo foo bar bar", its field length will be 5.

If these are the only two documents in the index, the `avgFieldLen` of field `field1` will be = ( 3+5)/2 = 4

---

<div class="post-metadata">

**Author:** ![d3v3lop3r](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/d3v3lop3r/32/77472_2.png) [@d3v3lop3r](https://discuss.elastic.co/u/d3v3lop3r)\
**Post date:** [February 22, 2021, 7:39pm UTC](https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105/3 "2021-02-22T19:39:36Z")

</div>

Thank you very much!

---

<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:** [March 22, 2021, 7:40pm UTC](https://discuss.elastic.co/t/field-length-and-average-field-lengths-bm25/265105/4 "2021-03-22T19:40:02Z")

</div>

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