# Understand Explain API scoring

**URL:** <https://discuss.elastic.co/t/understand-explain-api-scoring/125805>\
**Category:** Elasticsearch\
**Created:** [March 27, 2018, 7:52pm UTC](https://discuss.elastic.co/t/understand-explain-api-scoring/125805 "2018-03-27T19:52:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithag](https://avatars.discourse-cdn.com/v4/letter/k/ecb155/32.png) [@keithag](https://discuss.elastic.co/u/keithag)\
**Post date:** [March 27, 2018, 7:52pm UTC](https://discuss.elastic.co/t/understand-explain-api-scoring/125805/1 "2018-03-27T19:52:39Z")

</div>

I'm trying to understand the Explain API scoring in the elastic documentation: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html)

When I couldn't figure it out on my own simple index with just a couple documents, I tried to reproduce the calculation on the above documentation page.

In the example, it shows a "value" of 1.3862944 with the description: "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5))". Under "details" it gives the following values for the fields: docFreq: 1.0, docCount: 5.0

Using the provided docFreq and docCount values, I compute this to be: log(1 + (5.0 - 1.0 + 0.5) / (1.0 + 0.5)) = 0.602 which is not the same as the 1.3862944 in the example.

I can't get any of the values to match up.

Am I reading it incorrectly?

Thanks!

---

<div class="post-metadata">

**Author:** ![keithag](https://avatars.discourse-cdn.com/v4/letter/k/ecb155/32.png) [@keithag](https://discuss.elastic.co/u/keithag)\
**Post date:** [March 30, 2018, 12:23pm UTC](https://discuss.elastic.co/t/understand-explain-api-scoring/125805/2 "2018-03-30T12:23:58Z")

</div>

From StackOverflow: the answer is that the logarithm calculation is the natural logarithm and not the base 10 logarithm.

---

<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:** [April 27, 2018, 12:23pm UTC](https://discuss.elastic.co/t/understand-explain-api-scoring/125805/3 "2018-04-27T12:23:59Z")

</div>

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