Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Pass index settings to system ingest processor factories. ([#18708](https://github.com/opensearch-project/OpenSearch/pull/18708))
- Include named queries from rescore contexts in matched_queries array ([#18697](https://github.com/opensearch-project/OpenSearch/pull/18697))
- Add the configurable limit on rule cardinality ([#18663](https://github.com/opensearch-project/OpenSearch/pull/18663))
- Disable approximation framework when dealing with multiple sorts ([#18763](https://github.com/opensearch-project/OpenSearch/pull/18763))

### Changed
- Update Subject interface to use CheckedRunnable ([#18570](https://github.com/opensearch-project/OpenSearch/issues/18570))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ protected boolean canApproximate(SearchContext context) {
}

if (context.request() != null && context.request().source() != null && context.innerHits().getInnerHits().isEmpty()) {
if (context.request().source().sorts() != null && context.request().source().sorts().size() > 1) {
return false;
}
FieldSortBuilder primarySortField = FieldSortBuilder.getPrimaryFieldSortOrNull(context.request().source());
if (primarySortField != null
&& primarySortField.missing() == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ public boolean canApproximate(SearchContext context) {
this.setSize(Math.max(context.from() + context.size(), context.trackTotalHitsUpTo()) + 1);
}
if (context.request() != null && context.request().source() != null) {
if (context.request().source().sorts() != null && context.request().source().sorts().size() > 1) {
return false;
}
FieldSortBuilder primarySortField = FieldSortBuilder.getPrimaryFieldSortOrNull(context.request().source());
if (primarySortField != null) {
if (!primarySortField.fieldName().equals(pointRangeQuery.getField())) {
Expand Down
Loading