Skip to content

Commit b7bac25

Browse files
romseygeekSivagurunathanV
authored andcommitted
Fix BWC assertion in GetFieldMappingsResponse (elastic#49706)
Closes elastic#49702
1 parent 2a4860d commit b7bac25

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import java.io.IOException;
3838
import java.io.InputStream;
39+
import java.util.Collections;
3940
import java.util.HashMap;
4041
import java.util.Map;
4142
import java.util.Objects;
@@ -66,7 +67,11 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte
6667
String index = in.readString();
6768
if (in.getVersion().before(Version.V_8_0_0)) {
6869
int typesSize = in.readVInt();
69-
assert typesSize == 1;
70+
assert typesSize == 1 || typesSize == 0 : "Expected 0 or 1 types but got " + typesSize;
71+
if (typesSize == 0) {
72+
indexMapBuilder.put(index, Collections.emptyMap());
73+
continue;
74+
}
7075
in.readString(); // type
7176
}
7277
int fieldSize = in.readVInt();

0 commit comments

Comments
 (0)