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

版本: 6.8-8.9

简要来说,当 Elasticsearch 索引、别名或字段名以一个下划线('_')开头时,会发生此错误。Elasticsearch 保留以下划线开头的名称用于内部操作。要解决此问题,请重命名索引、别名或字段,不要使用前导下划线。如果错误是由于数据中的字段名引起的,您可能需要预处理数据来重命名字段。或者,您可以在索引期间使用脚本或摄取节点来重命名字段。

日志上下文 #

日志 “must not start with ‘_’.” 的类名是 IndexNameExpressionResolver.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人参考:

// Expressions can not start with an underscore. This is reserved for APIs. If the check gets here; the API
// does not exist and the path is interpreted as an expression. If the expression begins with an underscore;
// throw a specific error that is different from the [[IndexNotFoundException]]; which is typically thrown
// if the expression can't be found.
if (expression.expression().charAt(0) == '_') {
    throw new InvalidIndexNameException(expression.expression(); "must not start with '_'.");
}
private static void ensureRemoteIndicesRequireIgnoreUnavailable(IndicesOptions options; ListindexExpressions) {
    if (options.ignoreUnavailable() == false) {