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

版本: 6.8-8.9

简而言之,当Elasticsearch查询中的include/exclude子句包含非字符串值时,会出现此错误。Elasticsearch期望这些值是字符串类型。要解决此问题,你应该确保include/exclude子句中的所有元素都是字符串值。你可以通过在将数字或布尔值包含到查询之前将它们转换为字符串来实现这一点。另外,请检查你的数据类型,并确保它们与Elasticsearch架构中预期的字符串类型相匹配。

日志上下文 #

日志"Array elements in include/exclude clauses should be string values"的类名是 IncludeExclude.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:

if (parser.currentToken() != XContentParser.Token.START_ARRAY) {
 throw new ElasticsearchParseException("Missing start of array in include/exclude clause");
 }
 while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
 if (parser.currentToken().isValue() == false) {
 throw new ElasticsearchParseException("Array elements in include/exclude clauses should be string values");
 }
 set.add(new BytesRef(parser.text()));
 }
 return set;
 }