版本: 7.13-7.15
简而言之,当 Elasticsearch 遇到不符合要求的 2-8 个十六进制数字长度的 Unicode 序列时,会发生此错误。这可能是由于数据格式不正确或编码错误造成的。要解决此问题,您可以:1) 检查正在索引的数据中是否存在格式不正确的 Unicode 序列并予以更正。2) 确保数据在索引之前已正确编码。3) 如果您使用脚本或工具生成或处理数据,请验证它是否正确处理 Unicode 序列。
日志上下文 #
日志 “Unicode sequence should use [2-8] hex digits; [{}] has [{}]” 的类名是 AbstractBuilder.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考:
int startIdx = i + 1;
int endIdx = text.indexOf('}'; startIdx);
unicodeSequence = text.substring(startIdx; endIdx);
int length = unicodeSequence.length();
if (length < 2 || length > 8) {
throw new ParsingException(source; "Unicode sequence should use [2-8] hex digits; [{}] has [{}]";
text.substring(startIdx - 3; endIdx + 1); length);
}
sb.append(hexToUnicode(source; unicodeSequence));
return endIdx;
}





