# Using the explain api in kibana dev tools not working

**URL:** <https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115>\
**Category:** Kibana\
**Created:** [May 22, 2019, 2:39am UTC](https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115 "2019-05-22T02:39:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkarpov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkarpov/32/45326_2.png) [@dkarpov](https://discuss.elastic.co/u/dkarpov)\
**Post date:** [May 22, 2019, 2:39am UTC](https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115/1 "2019-05-22T02:39:50Z")

</div>

I am trying to figure out how ES is scoring my query. I am using the Kibana dev tools console with the explain api but I cannot get it to work.

The index I am querying is called "resource"

Performing a search with the same query, i get back 17 hits

My query using explain api:

```
GET /resource/_explain
{
  "query": {
    "bool": {
      "must": {
        "multi_match": {
          "query": "drill",
          "fields": [
            "locale.en.title^2",
            "locale.fr.title^2",
            "tags.locale.en.title^2",
            "tags.locale.fr.title^2",
            "locale.en.description",
            "locale.fr.description"
          ],
          "tie_breaker": 0.3,
          "fuzziness": "auto"
        }
      }
    }
  }
}

```

I have also tried  
`GET /resource/_explain/0`  
and the old syntax:  
`GET /resource/_search?explain`

I get the following error:

```
{
  "error": {
    "root_cause": [
      {
        "type": "invalid_type_name_exception",
        "reason": "Document mapping type name can't start with '_', found: [_explain]"
      }
    ],
    "type": "invalid_type_name_exception",
    "reason": "Document mapping type name can't start with '_', found: [_explain]"
  },
  "status": 400
}

```

Nothing seems to work. Is it because I am running this via the dev tools console?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [May 22, 2019, 7:22pm UTC](https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115/2 "2019-05-22T19:22:50Z")

</div>

Which version of Elasticsearch are you using? The error you've suggested happens when you leave off the "0" (ID) at the end... What error do you get when you do `GET /resource/_explain/0` with the query?

---

<div class="post-metadata">

**Author:** ![dkarpov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkarpov/32/45326_2.png) [@dkarpov](https://discuss.elastic.co/u/dkarpov)\
**Post date:** [May 22, 2019, 8:05pm UTC](https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115/3 "2019-05-22T20:05:11Z")

</div>

We are using version 6.4.3.

Thank you lukas! I figured out my mistake, I should be using the following format:  
`GET /resource/_doc/:id/_explain`

You the man!

---

<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:** [June 19, 2019, 8:07pm UTC](https://discuss.elastic.co/t/using-the-explain-api-in-kibana-dev-tools-not-working/182115/4 "2019-06-19T20:07:55Z")

</div>

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