diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java index 9a3ce9d79d1..d07d515b391 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java @@ -521,9 +521,11 @@ public class XContentDocumentMapper implements DocumentMapper, ToXContent { @Override public void processDocumentAfterIndex(Document doc) { for (Fieldable field : doc.getFields()) { FieldMappers fieldMappers = mappers().indexName(field.name()); - FieldMapper mapper = fieldMappers.mapper(); - if (mapper != null) { - mapper.processFieldAfterIndex(field); + if (fieldMappers != null) { + FieldMapper mapper = fieldMappers.mapper(); + if (mapper != null) { + mapper.processFieldAfterIndex(field); + } } } }