主要原因:Elasticsearch8.x版本中type已经被弃用了!所以一些请求的命名方式也随之改变
一、PUT创建报错
PUT /test1/tpye/1
{
"name":"张三",
"age":23,
"birthday": 2000-1-1
}
报错:
"error" : "no handler found for uri [/test1/type/1?pretty=true] and method [PUT]"
解决办法:
PUT /test1/_doc/1
{
"name":"张三",
"age":23,
"birthday": 2000-1-1
}
二、POST更新报错
POST /test1/_doc/1/_update
{
"doc":{
"name": "法外狂徒张三"
}
}
报错:
"error": "no handler found for uri [/test3/_doc/1/_update?pretty=true] and method [POST]"
解决办法:
POST /test1/_update/1
{
"doc":{
"name": "法外狂徒张三"
}
}
三、GET搜索报错
GET /test1/type/_search?q=name:张三
报错:
request [/test1/type/_search] contains unrecognized parameter: [q]"
解决办法:
GET bobo/_search?q=name:张三