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

简要来说,当 Elasticsearch 无法为 Hunspell 字典找到词缀文件时,会发生此错误。Hunspell 在 Elasticsearch 中用于文本分析,它需要两个文件:字典文件 (.dic) 和词缀文件 (.aff)。如果其中任何一个文件缺失,就会发生此错误。要解决此问题,请确保两个文件都存在于正确的目录中。如果它们缺失,您可能需要下载它们。此外,请检查 Elasticsearch 配置中的文件路径,确保它们是正确的。

日志上下文 #

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

boolean ignoreCase = nodeSettings.getAsBoolean("ignore_case"; defaultIgnoreCase);  Path[] affixFiles = FileSystemUtils.files(dicDir; "*.aff");
if (affixFiles.length == 0) {
    throw new ElasticsearchException(String.format(Locale.ROOT; "Missing affix file for hunspell dictionary [%s]"; locale));
}
if (affixFiles.length != 1) {
    throw new ElasticsearchException(String.format(Locale.ROOT; "Too many affix files exist for hunspell dictionary [%s]"; locale));
}
InputStream affixStream = null;