版本: 6.8-7.17
简而言之,当 Elasticsearch 无法为指定的排序键找到合适的比较器时,就会发生此错误。这可能是由于字段不存在、字段名称不正确或字段类型不支持排序所致。要解决此问题,请确保您尝试排序的字段存在于索引中并且是可排序的类型。此外,请检查字段名称中是否存在拼写错误。如果字段类型不可排序,请考虑将其更改为支持排序的类型。
日志上下文 #
日志 “Could not resolve comparator for sort key: [” + sort + “]” 的类名是 TermSuggestion.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考:
case SCORE:
return SCORE;
case FREQUENCY:
return FREQUENCY;
default:
throw new ElasticsearchException("Could not resolve comparator for sort key: [" + sort + "]");
}
} @Override
public void writeTo(StreamOutput out) throws IOException {





