diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java index 81992784b41..b74997123c0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.get; +import com.google.common.collect.ImmutableMap; import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.util.Unicode; @@ -66,6 +67,9 @@ public class GetResponse implements ActionResponse, Streamable, Iterable 0) { + if (size == 0) { + fields = ImmutableMap.of(); + } else { fields = newHashMapWithExpectedSize(size); for (int i = 0; i < size; i++) { GetField field = readGetField(in);