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

版本: 6.8-6.8

简而言之,当您尝试在同一个Elasticsearch查询中同时使用’sort’选项和’rescore’时,会发生此错误。Elasticsearch不支持这种组合,因为’rescore’会对查询返回的顶部结果进行重新排序,而’sort’会对所有结果进行排序,这可能导致不一致性。要解决此问题,如果’rescore’对您的用例更重要,您可以移除’sort’选项,反之亦然。或者,您可以在从Elasticsearch检索结果后,在应用程序中执行排序操作。

日志上下文 #

日志"Cannot use [sort] option in conjunction with [rescore].“的类名是 DefaultSearchContext.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:

+ "]. Scroll batch sizes cost as much memory as result windows so they are controlled by the ["
 + IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey() + "] index level setting.");
 }
 if (rescore != null) {
 if (sort != null) {
 throw new QueryPhaseExecutionException(this; "Cannot use [sort] option in conjunction with [rescore].");
 }
 int maxWindow = indexService.getIndexSettings().getMaxRescoreWindow();
 for (RescoreContext rescoreContext: rescore) {
 if (rescoreContext.getWindowSize() > maxWindow) {
 throw new QueryPhaseExecutionException(this; "Rescore window [" + rescoreContext.getWindowSize() + "] is too large. "