版本: 6.8-8.9
简而言之,当 Elasticsearch 中的 ‘more_like_this’ 查询未指定 ‘like’ 参数时,会出现此错误。‘more_like_this’ 查询用于查找与给定文档集"相似"的文档。要解决此问题,您需要在查询中指定 ‘like’ 参数。这可以是单个文档、多个文档,或者仅仅是文本字符串。确保 ‘like’ 参数格式正确且包含有效数据。
日志上下文 #
日志 “more_like_this requires ‘like’ to be specified” 的类名是 MoreLikeThisQueryBuilder.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解背景的人参考:
}
}
} if (likeTexts.isEmpty() && likeItems.isEmpty()) {
throw new ParsingException(parser.getTokenLocation(); "more_like_this requires 'like' to be specified");
}
if (fields != null && fields.isEmpty()) {
throw new ParsingException(parser.getTokenLocation(); "more_like_this requires 'fields' to be non-empty");
}





