diff --git a/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java index aece93b90aa18..6ae2f7608f875 100644 --- a/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/DateFieldMapper.java @@ -612,6 +612,12 @@ public Relation isFieldWithinQuery( if (isSearchable() == false && hasDocValues()) { return Relation.INTERSECTS; } + + if (PointValues.size(reader, name()) == 0) { + // no points, so nothing matches + return Relation.DISJOINT; + } + if (dateParser == null) { dateParser = this.dateMathParser; } @@ -638,11 +644,6 @@ public Relation isFieldWithinQuery( } } - if (PointValues.size(reader, name()) == 0) { - // no points, so nothing matches - return Relation.DISJOINT; - } - long minValue = LongPoint.decodeDimension(PointValues.getMinPackedValue(reader, name()), 0); long maxValue = LongPoint.decodeDimension(PointValues.getMaxPackedValue(reader, name()), 0);