use of org.elasticsearch.index.mapper.DocumentMapper in project crate by crate.
the class ArrayMapperTest method testParseDynamicNullArray.
@Test
public void testParseDynamicNullArray() throws Exception {
String mapping = Strings.toString(XContentFactory.jsonBuilder().startObject().startObject(TYPE).startObject("properties").endObject().endObject().endObject());
DocumentMapper mapper = mapper(INDEX, mapping);
// parse source with null array
BytesReference bytesReference = BytesReference.bytes(XContentFactory.jsonBuilder().startObject().startArray("new_array_field").nullValue().endArray().endObject());
SourceToParse sourceToParse = new SourceToParse(INDEX, "abc", bytesReference, XContentType.JSON);
ParsedDocument doc = mapper.parse(sourceToParse);
assertThat(doc.docs().get(0).getField("new_array_field"), is(nullValue()));
assertThat(mapper.mappers().getMapper("new_array_field"), is(nullValue()));
}
Aggregations