diff --git a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java index ca488c946ced6..6eae363df4023 100644 --- a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java +++ b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java @@ -423,6 +423,7 @@ private static BitSet getSparseBitSetOrNull(Bits liveDocs) { private boolean isApproximateableRangeQuery() { boolean isTopLevelRangeQuery = searchContext.query() instanceof IndexOrDocValuesQuery + && ((IndexOrDocValuesQuery) searchContext.query()).getIndexQuery() instanceof ApproximateableQuery && ((ApproximateableQuery) ((IndexOrDocValuesQuery) searchContext.query()).getIndexQuery()) .getOriginalQuery() instanceof PointRangeQuery;