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

版本: 6.8-8.9

简而言之,当 Elasticsearch 在预期只包含 token 的位置遇到嵌套规则时,就会出现此错误。这通常是由于 Elasticsearch 查询或映射配置错误导致的。要解决此问题,你应该检查 Elasticsearch 查询或映射,确保其格式正确。请确保你没有在只期望 token 的位置使用嵌套规则。如有必要,你可能需要重构数据或调整查询,以避免在此上下文中使用嵌套规则。

日志上下文 #

日志 “nonReserved can only contain tokens. Found nested rule:” 的类名是 SqlParser.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入了解上下文的人参考:

@Override
 public void exitNonReserved(SqlBaseParser.NonReservedContext context) {
 // tree cannot be modified during rule enter/exit _unless_ it's a terminal node
 if ((context.getChild(0) instanceof TerminalNode) == false) {
 int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex();
 throw new ParsingException("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule));
 }  // replace nonReserved words with IDENT tokens
 context.getParent().removeLastChild();