Using the explain api in kibana dev tools not working

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?

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?

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!

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