# Incorrect averageFieldLength(avgdl, average length of field) and fieldLength (dl, length of field) calculation

**URL:** <https://discuss.elastic.co/t/incorrect-averagefieldlength-avgdl-average-length-of-field-and-fieldlength-dl-length-of-field-calculation/200189>\
**Category:** Elasticsearch\
**Created:** [September 19, 2019, 10:59am UTC](https://discuss.elastic.co/t/incorrect-averagefieldlength-avgdl-average-length-of-field-and-fieldlength-dl-length-of-field-calculation/200189 "2019-09-19T10:59:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AshishkumarUpadhye](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@AshishkumarUpadhye](https://discuss.elastic.co/u/AshishkumarUpadhye)\
**Post date:** [September 19, 2019, 10:59am UTC](https://discuss.elastic.co/t/incorrect-averagefieldlength-avgdl-average-length-of-field-and-fieldlength-dl-length-of-field-calculation/200189/1 "2019-09-19T10:59:13Z")

</div>

## I have created new index in Elastic Search 7.3.2 version ( "lucene\_version" : "8.1.0") .

With following details:  
INDEX created using the below details:  
**FILTER**

## "skillset\_synonyms\_filter": {

"type": "synonym\_graph",  
"synonyms": [  
"c-sharp,c sharp",  
".net,mvc,core, [asp.net](http://asp.net),winservice",  
"sql,structured query language,dba,database,backend",  
"javascript,js"  
]  
},  
"my\_stopword\_filter": {  
"type": "stop",  
"stopwords": [  
"a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or",  
"such","that","the","their","then","there","these","they","this","to","was","will","with"  
]  
},  
**ANALYZER**

## "analyzer": {

"my\_synonym\_analyzer": {  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"skillset\_synonyms\_filter",  
"my\_stopword\_filter"  
]  
}

## and also I have added the data into the index like this

1]skills -.NET,MVC,SQL,WEB API  
2]skills -.NET,MVC,SQL,WEB API  
3]skills -javascript  
4]skills-java  
5]skills-SQL  
6]skills:.NET,.NET MVC,.NET Core,SQL,WEB API  
so in this the 1st and 2nd record the skillset is the same.

## my query to fetch the record like this:

{  
"explain": "true",  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"skills": "javascript"  
}  
}  
]  
}  
}  
}

So i am getting the correct result set but i am not getting how the tf getting calculated.  
Means **I am getting the "length of field" (dl)=1 And "average length of field " (avgdl)= 13.666667  
which is confusing, So anyone could you please help me with this.**

## Here is the Details:

- {
  - "value": 0.8453608,
  - "description": "tf, computed as freq / (freq + k1 \* (1 - b + b \* dl / avgdl)) from:",
  - "details": [
    - {
      - "value": 2,
      - "description": "termFreq=2.0",
      - "details": }  
, \* {
      - "value": 1.2,
      - "description": "k1, term saturation parameter",
      - "details":   
}  
, \* {
      - "value": 0.75,
      - "description": "b, length normalization parameter",
      - "details":   
}  
, \* {
      - "value": 1,
      - "description": "dl, length of field",
      - "details":   
}  
, \* {
      - "value": 13.666667,
      - "description": "avgdl, average length of field",
      - "details":   
}  
]  
}

---

<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 17, 2019, 10:59am UTC](https://discuss.elastic.co/t/incorrect-averagefieldlength-avgdl-average-length-of-field-and-fieldlength-dl-length-of-field-calculation/200189/2 "2019-10-17T10:59:16Z")

</div>

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