# Explanation API Clarification

**URL:** <https://discuss.elastic.co/t/explanation-api-clarification/124419>\
**Category:** Elasticsearch\
**Created:** [March 17, 2018, 7:54pm UTC](https://discuss.elastic.co/t/explanation-api-clarification/124419 "2018-03-17T19:54:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![imranazad](https://avatars.discourse-cdn.com/v4/letter/i/c2a13f/32.png) [@imranazad](https://discuss.elastic.co/u/imranazad)\
**Post date:** [March 17, 2018, 7:54pm UTC](https://discuss.elastic.co/t/explanation-api-clarification/124419/1 "2018-03-17T19:54:11Z")

</div>

Take this output of the explanation API:

"explanations": [  
{  
"index": "my\_index",  
"valid": true,  
"explanation": "(title:brown title:fox) (body:brown body:fox)"  
}  
]

Am I right in thinking the syntax in the explanation field is explaining how "scores" will be calculated rather than how matches are made? So in this case it's saying add the scores from each field where there is a match for brown or fox in all the specified fields?

Whereas in this instance it saying only add the score from one of the matched fields

"explanations": [  
{  
"index": "my\_index",  
"valid": true,  
"explanation": "(title:brown +title:fox) | (body:brown body:fox)"  
}  
]

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 20, 2018, 3:00am UTC](https://discuss.elastic.co/t/explanation-api-clarification/124419/2 "2018-03-20T03:00:45Z")

</div>

The Explain API is to describe how queries are translated to [Lucene Query Syntax](http://lucene.apache.org/core/7_2_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description). So, generally speaking, it is to describe how matches are made and not how scores are calculated.

If you want to check how scores are calculated then you need to set `explain: true` in a search query body.

---

<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 17, 2018, 3:00am UTC](https://discuss.elastic.co/t/explanation-api-clarification/124419/3 "2018-04-17T03:00:59Z")

</div>

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