Using Suggest Api in Dev Tools Console gives invalid_type_name_exception


#1

I am using the Kibana Dev Tools Console.
Elastic 6.1.1
Kibana 6.1.1
Running on windows

I am following the same steps outlined in the blog https://www.elastic.co/blog/you-complete-me

However, when I try

curl -X POST localhost:9200/hotels/_suggest -d '
{
  "hotels" : {
    "text" : "m",
    "completion" : {
      "field" : "name_suggest"
    }
  }
}'

which equates to

POST /hotels/_suggest
{
  "hotels" : {
    "text" : "m",
    "completion" : {
      "field" : "name_suggest"
    }
  }
}

I get the following error

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

I have searched through the forum but I can't find the solution


#2

I can see that I used an older blog

On looking at elastic documentation

_suggest endpoint has been deprecated in favour of using suggest via _search endpoint. In 5.0, the _search endpoint has been optimized for suggest only search requests.


(Spencer Alger) #3

Yep, the blog post is just out of date. Try reading https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-suggesters.html to learn about the suggest functionality in search


(system) #4

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