执行 sudowww ‘php artisan es:migrate’ 时,报错:Custom Analyzer [ik_smart_synonym] failed to find tokenizer under name [ik_smart]

1、执行 sudowww ‘php artisan es:migrate’ 时,报错:Custom Analyzer [ik_smart_synonym] failed to find tokenizer under name [ik_smart]。如图1

图1


root@iZ2ze4fjghbbj74d4kfnf0Z:/var/www/laravel-shop# sudowww 'php artisan es:migrate'
正在处理索引 products
索引不存在,准备创建

   Elasticsearch\Common\Exceptions\BadRequest400Exception

  {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Custom Analyzer [ik_smart_synonym] failed to find tokenizer under name [ik_smart]"}],"type":"illegal_argument_exception","reason":"Custom Analyzer [ik_smart_synonym] failed to find tokenizer under name [ik_smart]"},"status":400}

  at vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:693
    689▕             $exception = new ScriptLangNotSupportedException($responseBody. $statusCode);
    690▕         } elseif ($statusCode === 408) {
    691▕             $exception = new RequestTimeout408Exception($responseBody, $statusCode);
    692▕         } else {
  ➜ 693▕             $exception = new BadRequest400Exception($responseBody, $statusCode);
    694▕         }
    695▕
    696▕         $this->logRequestFail($request, $response, $exception);
    697▕

      +9 vendor frames
  10  app/Console/Commands/Elasticsearch/Migrate.php:64
      Elasticsearch\Namespaces\IndicesNamespace::create()

  11  app/Console/Commands/Elasticsearch/Migrate.php:30
      App\Console\Commands\Elasticsearch\Migrate::createIndex()
root@iZ2ze4fjghbbj74d4kfnf0Z:/var/www/laravel-shop#

2、参考:执行命令:./20.04/install_elasticsearch.sh 7 安装 Elasticsearch 后,对应版本的 IK 分词插件未安装 。操作成功。如图2

图2

root@iZ2zeh119jtszpxb8sf8pvZ:/var/www/laravel-shop# sudowww 'php artisan es:migrate'
正在处理索引 products
索引不存在,准备创建
创建成功,准备初始化数据
操作成功
永夜