Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field
} else {
XContentParser parser = context.parser();
final XContentParser.Token start = parser.currentToken();
if (start == XContentParser.Token.START_OBJECT) {
if (start == XContentParser.Token.VALUE_NULL) {
return;
} else if (start == XContentParser.Token.START_OBJECT) {
RangeFieldType fieldType = fieldType();
RangeType rangeType = fieldType.rangeType;
String fieldName = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@ protected void doTestNullValue(String type) throws IOException {
+ InetAddresses.toAddrString(InetAddresses.forString("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
}
assertThat(storedField.stringValue(), containsString(strVal));

// test null range
doc = mapper.parse(SourceToParse.source("test", "type", "1", XContentFactory.jsonBuilder()
.startObject()
.nullField("field")
.endObject()
.bytes(),
XContentType.JSON));
assertNull(doc.rootDoc().get("field"));
}

public void testNoBounds() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ setup:
id: 3
body: { "integer_range" : { "gte": 4, "lte": 5 } }

- do:
index:
index: test
type: doc
id: 4
body: { "integer_range" : null }

- do:
indices.refresh: {}
Expand Down Expand Up @@ -79,6 +85,12 @@ setup:

- match: { hits.total: 0 }

- do:
search:
body: { "query" : { "match_all": {} } }

- match: { hits.total: 4 }

---
"Long range":

Expand Down