diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/strings/StringFieldData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/strings/StringFieldData.java index e2b98dec722..9a091360be3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/strings/StringFieldData.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/data/strings/StringFieldData.java @@ -43,7 +43,9 @@ public abstract class StringFieldData extends FieldData { @Override protected long computeSizeInBytes() { long size = RamUsage.NUM_BYTES_ARRAY_HEADER; for (String value : values) { - size += RamUsage.NUM_BYTES_OBJECT_HEADER + value.length() * RamUsage.NUM_BYTES_CHAR + (3 * RamUsage.NUM_BYTES_INT); + if (value != null) { + size += RamUsage.NUM_BYTES_OBJECT_HEADER + ((value.length() * RamUsage.NUM_BYTES_CHAR) + (3 * RamUsage.NUM_BYTES_INT)); + } } return size; }