Scout 结合 Elasticsearch8.1.0导入数据出现问题(求用过es8.1.0的大佬救命!!!)
laravel版本 5.7.24
ElasticSearch版本 8.1.0
扩展包是babenkoivan/scout-elasticsearch-driver最新
其他配置均已完成,只是在导入文章数据时出现以下报错
Elasticsearch\Common\Exceptions\BadRequest400Exception : {"error":"no handler found for uri [/articles_write/articles/_mapping?include_type_name=true] and method [PUT]"}
感觉include_type_name=true是个重要的错误,看了一些参考说ES7以后include_type_name默认为false在8以后直接移除了,实在不知道怎么修改,特此询问社区大佬,请求帮助,并帮小弟看看是否还有其他错误 比如 method [PUT] 这块
模型配置如下
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use ScoutElastic\Searchable;
class Articles extends Model
{
use Searchable;
protected $table = 'articles';
protected $indexConfigurator = ArticlesIndexConfigurator::class;
protected $mapping = [
'include_type_name' => true,
'properties' => [
'title' => [
'type' => 'text',
'analyzer' => 'ik_max_word'
],
'content' => [
'type' => 'text',
'analyzer' => 'ik_smart'
],
'keyword' => [
'type' => 'text',
'analyzer' => 'ik_max_word'
],
'desc' => [
'type' => 'text',
'analyzer' => 'ik_max_word'
],
]
];
public function toSearchableArray()
{
return [
'title'=> $this->title,
'content' => $this->content,
'keyword' => $this->keyword,
'desc' => $this->desc,
];
}
}
推荐文章: