From 3fb68d62de7dc1864a8c97f25305f6a8ea973a90 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 2 Apr 2010 22:11:56 +0300 Subject: [PATCH] Get response should have fields always set, even when there are none --- .../java/org/elasticsearch/action/get/GetResponse.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);