Skip to content

Commit 35b41dd

Browse files
committed
Add feature for tests
1 parent 3dd73ee commit 35b41dd

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/500_date_range.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ setup:
126126

127127
---
128128
"test bad dates in range - past":
129+
- requires:
130+
cluster_features: [ "mapper.range.invalid_date_fix" ]
131+
reason: "Fix for invalid date required"
129132
- do:
130133
catch: /illegal_argument_exception/
131134
search:
@@ -141,6 +144,9 @@ setup:
141144

142145
---
143146
"test bad dates in range - future":
147+
- requires:
148+
cluster_features: [ "mapper.range.invalid_date_fix" ]
149+
reason: "Fix for invalid date required"
144150
- do:
145151
catch: /illegal_argument_exception/
146152
search:

server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public final class DateFieldMapper extends FieldMapper {
100100
private static final DateMathParser EPOCH_MILLIS_PARSER = DateFormatter.forPattern("epoch_millis")
101101
.withLocale(DEFAULT_LOCALE)
102102
.toDateMathParser();
103+
public static final NodeFeature INVALID_DATE_FIX = new NodeFeature("mapper.range.invalid_date_fix");
103104

104105
public enum Resolution {
105106
MILLISECONDS(CONTENT_TYPE, NumericType.DATE, DateMillisDocValuesField::new) {

server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public Set<NodeFeature> getTestFeatures() {
5858
SourceFieldMapper.SYNTHETIC_RECOVERY_SOURCE,
5959
ObjectMapper.SUBOBJECTS_FALSE_MAPPING_UPDATE_FIX,
6060
UKNOWN_FIELD_MAPPING_UPDATE_ERROR_MESSAGE,
61-
DOC_VALUES_SKIPPER
61+
DOC_VALUES_SKIPPER,
62+
DateFieldMapper.INVALID_DATE_FIX
6263
);
6364
}
6465
}

0 commit comments

Comments
 (0)