# Relevance Score calculation

**URL:** <https://discuss.elastic.co/t/relevance-score-calculation/138561>\
**Category:** Elasticsearch\
**Created:** [July 4, 2018, 1:09pm UTC](https://discuss.elastic.co/t/relevance-score-calculation/138561 "2018-07-04T13:09:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharmateja\_Tummala](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Dharmateja\_Tummala](https://discuss.elastic.co/u/Dharmateja_Tummala)\
**Post date:** [July 4, 2018, 1:09pm UTC](https://discuss.elastic.co/t/relevance-score-calculation/138561/1 "2018-07-04T13:09:44Z")

</div>

Hi,  
Am new to elastic search and am trying to use EXPLAIN API in elastic search(6.2.4).But am unable to understand terminology used there in calculation TF IDF.

Can you please explain me terms doc\_count and doc\_freq.

Below is the result I got from EXPLAIN API.

{  
"\_index": "suggest",  
"\_type": "phrase\_details",  
"_id": "Q9ZlXWQBv-nPAuW_-OH5",  
"matched": true,  
"explanation": {  
"value": 25.682423,  
"description": "sum of",  
"details": [  
{  
"value": 22.959066,  
"description": "weight(Synonym(tags.start\_word:cr tags.start\_word:cre tags.start\_word:cred tags.start\_word:credi tags.start\_word:credit tags.start\_word:credit tags.start\_word:credit c tags.start\_word:credit ca) in 544) [PerFieldSimilarity], result of:",  
"details": [  
{  
"value": 22.959066,  
"description": "score(doc=544,freq=6.0 = termFreq=6.0\n), product of:",  
"details": [  
{  
"value": 2,  
"description": "boost",  
"details": []  
},  
{  
"value": 5.5329504,  
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",  
"details": [  
{  
"value": 4,  
"description": "docFreq",  
"details": []  
},  
{  
"value": 1137,  
"description": "docCount",  
"details": []  
}  
]  
},  
{  
"value": 2.074758,  
"description": "tfNorm, computed as (freq \* (k1 + 1)) / (freq + k1 \* (1 - b + b \* fieldLength / avgFieldLength)) from:",  
"details": [  
{  
"value": 6,  
"description": "termFreq=6.0",  
"details": []  
},  
{  
"value": 1.2,  
"description": "parameter k1",  
"details": []  
},  
{  
"value": 0.75,  
"description": "parameter b",  
"details": []  
},  
{  
"value": 14.472296,  
"description": "avgFieldLength",  
"details": []  
},  
{  
"value": 1,  
"description": "fieldLength",  
"details": []  
}  
]  
}  
]  
}  
]  
},  
{  
"value": 2.7233558,  
"description": "min of:",  
"details": [  
{  
"value": 2.7233558,  
"description": "field value function: sqrt(doc['weight'].value \* factor=1.0)",  
"details": []  
},  
{  
"value": 3.4028235e+38,  
"description": "maxBoost",  
"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:** [August 1, 2018, 1:09pm UTC](https://discuss.elastic.co/t/relevance-score-calculation/138561/2 "2018-08-01T13:09:47Z")

</div>

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