diff --git a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java index 25165f8ff2e..c74212476a6 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java @@ -26,6 +26,7 @@ import org.apache.lucene.search.NumericRangeFilter; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.util.NumericUtils; +import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Numbers; import org.elasticsearch.common.Strings; import org.elasticsearch.common.joda.FormatDateTimeFormatter; @@ -38,6 +39,7 @@ import org.elasticsearch.index.analysis.NumericDateAnalyzer; import org.elasticsearch.index.cache.field.data.FieldDataCache; import org.elasticsearch.index.field.data.FieldDataType; import org.elasticsearch.index.mapper.*; +import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.index.search.NumericRangeFieldDataFilter; import org.joda.time.DateTimeZone; import org.joda.time.MutableDateTime; @@ -227,6 +229,13 @@ public class DateFieldMapper extends NumberFieldMapper { true, true); } + @Override + public Query fieldQuery(String value, @Nullable QueryParseContext context) { + long lValue = parseStringValue(value); + return NumericRangeQuery.newLongRange(names.indexName(), precisionStep, + lValue, lValue, true, true); + } + @Override public Query rangeQuery(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) { return NumericRangeQuery.newLongRange(names.indexName(), precisionStep, @@ -235,6 +244,13 @@ public class DateFieldMapper extends NumberFieldMapper { includeLower, includeUpper); } + @Override + public Filter fieldFilter(String value, @Nullable QueryParseContext context) { + long lValue = parseStringValue(value); + return NumericRangeFilter.newLongRange(names.indexName(), precisionStep, + lValue, lValue, true, true); + } + @Override public Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) { return NumericRangeFilter.newLongRange(names.indexName(), precisionStep,