Skip to content

Commit c727dad

Browse files
committed
Get/MultiGet API with no type provided and doc does not exists causes a failure, closes elastic#1794.
1 parent f9055ec commit c727dad

File tree

1 file changed

+9
-2
lines changed
  • modules/elasticsearch/src/main/java/org/elasticsearch/index/get

1 file changed

+9
-2
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/index/get/GetResult.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ public static GetResult readGetResult(StreamInput in) throws IOException {
300300

301301
@Override public void readFrom(StreamInput in) throws IOException {
302302
index = in.readUTF();
303-
type = in.readUTF();
303+
if (in.readBoolean()) {
304+
type = in.readUTF();
305+
}
304306
id = in.readUTF();
305307
version = in.readLong();
306308
exists = in.readBoolean();
@@ -323,7 +325,12 @@ public static GetResult readGetResult(StreamInput in) throws IOException {
323325

324326
@Override public void writeTo(StreamOutput out) throws IOException {
325327
out.writeUTF(index);
326-
out.writeUTF(type);
328+
if (type == null) {
329+
out.writeBoolean(false);
330+
} else {
331+
out.writeBoolean(true);
332+
out.writeUTF(type);
333+
}
327334
out.writeUTF(id);
328335
out.writeLong(version);
329336
out.writeBoolean(exists);

0 commit comments

Comments
 (0)