📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当 Elasticsearch 无法定位指定的 Hunspell 字典时,就会出现此错误。Hunspell 是 Elasticsearch 用于文本分析的拼写检查工具。该错误表明字典文件要么缺失,要么命名不正确。要解决此问题,请确保字典文件存在于正确的目录中,并且文件名与 Elasticsearch 配置中指定的文件名完全匹配。另外,请检查字典在 Elasticsearch 设置中的配置是否正确。

日志上下文 #

日志 “Could not find hunspell dictionary [%s]” 的类名是 HunspellService.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

if (logger.isDebugEnabled()) {
    logger.debug("Loading hunspell dictionary [{}]...", locale);
}
Path dicDir = hunspellDir.resolve(locale);
if (FileSystemUtils.isAccessibleDirectory(dicDir, logger) == false) {
    throw new ElasticsearchException(String.format(Locale.ROOT, "Could not find hunspell dictionary [%s]", locale));
} 
// 将节点设置与 Hunspell 字典特定设置合并
Settings dictSettings = HUNSPELL_DICTIONARY_OPTIONS.get(nodeSettings);
nodeSettings = loadDictionarySettings(dicDir, dictSettings.getByPrefix(locale + "."));