diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataType.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataType.java index c96eef52e01..7a23f5de51e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataType.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataType.java @@ -43,14 +43,14 @@ public class DoubleFieldDataType implements FieldDataType { if (missing.equals("_last")) { return new FieldComparatorSource() { @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { - return new DoubleFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Double.MIN_VALUE : Double.MAX_VALUE); + return new DoubleFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY); } }; } if (missing.equals("_first")) { return new FieldComparatorSource() { @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { - return new DoubleFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Double.MAX_VALUE : Double.MIN_VALUE); + return new DoubleFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY); } }; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/floats/FloatFieldDataType.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/floats/FloatFieldDataType.java index f58362bf263..a2e7408554f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/floats/FloatFieldDataType.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/floats/FloatFieldDataType.java @@ -43,14 +43,14 @@ public class FloatFieldDataType implements FieldDataType { if (missing.equals("_last")) { return new FieldComparatorSource() { @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { - return new FloatFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Float.MIN_VALUE : Float.MAX_VALUE); + return new FloatFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY); } }; } if (missing.equals("_first")) { return new FieldComparatorSource() { @Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { - return new FloatFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Float.MAX_VALUE : Float.MIN_VALUE); + return new FloatFieldDataMissingComparator(numHits, fieldname, cache, reversed ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY); } }; }