{ "error" : { "root_cause" : [ { "type" : "illegal_argument_exception", "reason" : "failed to find global analyzer [ik_smark]" } ], "type" : "illegal_argument_exception", "reason" : "failed to find global analyzer [ik_smark]" }, "status" : 400 }
时间: 2023-07-03 22:20:43 浏览: 97
这个错误提示表明 Elasticsearch 无法找到名为 `ik_smark` 的全局分析器。这可能是由于以下原因之一导致的:
1. 分析器未正确配置。请确保你已经正确安装了 Elasticsearch 和相应的分析器插件,并且已经在索引和映射定义中正确引用分析器。
2. 分析器名称拼写错误。请检查你的索引和映射定义中使用的分析器名称是否正确拼写为 `ik_smark`。
你可以通过以下步骤来解决问题:
1. 确认你已经正确安装了 `ik_smark` 分析器插件。你可以使用以下命令来检查安装情况:`curl -X GET "localhost:9200/_cat/plugins?v"`
2. 确认你的索引和映射定义中正确引用了 `ik_smark` 分析器。你可以使用以下命令来检查映射定义:`curl -XGET "http://localhost:9200/your_index/_mapping?pretty"`
3. 如果你发现分析器名称拼写错误,可以在映射定义中进行更正,并重启 Elasticsearch 服务。
如果你仍然无法解决问题,请提供更多的详细信息和错误日志,以便我更好地帮助你解决问题。
相关问题
"type": "illegal_argument_exception", "reason": "failed to find global analyzer [id_smart]"
这个错误通常是因为 Elasticsearch 中缺少名为 "id_smart" 的全局分析器。您需要创建该分析器,并确保在使用它的索引中进行了正确配置。以下是创建该分析器的示例代码:
```
PUT _settings
{
"analysis": {
"analyzer": {
"id_smart": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
}
```
您可以将此代码放在 Kibana Dev Tools 或任何其他支持 Elasticsearch REST API 的工具中运行。然后,您需要在您的索引设置中使用此分析器:
```
PUT your_index_name/_settings
{
"analysis": {
"analyzer": {
"default": {
"type": "id_smart"
}
}
}
}
```
请注意,此示例将 "id_smart" 分析器用作默认分析器。如果您想在索引中使用不同的分析器,则需要相应地进行更改。
[type=illegal_argument_exception, reason=Custom Analyzer [default_search] failed to find tokenizer under name [ik_smart]]]
这个错误提示是 Elasticsearch 的错误提示,意思是你使用了一个名为 "ik_smart" 的 tokenizer,但是 Elasticsearch 没有找到这个 tokenizer。这通常是因为你没有安装或配置正确的分词插件导致的。
如果你想使用 "ik_smart" 分词器,你需要先安装 Elasticsearch 的 IK 分词插件。你可以在 Elasticsearch 插件官网查找 IK 分词插件的安装方法,或者使用以下命令进行安装:
```
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.13.2/elasticsearch-analysis-ik-7.13.2.zip
```
安装完成后,你需要重新启动 Elasticsearch,然后再次尝试使用 "ik_smart" 分词器。