Skip to content

Commit 4d969ad

Browse files
lindstromhenrikkimchy
authored andcommitted
If types and index mappings are empty consider the mapping as an "empty" mapping and return status 200.
1 parent 2c15041 commit 4d969ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ public void onResponse(ClusterStateResponse response) {
116116
builder.field(mappingMd.type());
117117
builder.map(mappingMd.sourceAsMap());
118118
}
119+
120+
if (indexMetaData.mappings().values().isEmpty() && types.isEmpty()) {
121+
// if no types are specified and no mappings are set for the index, consider this an empty mapping
122+
foundAny = true;
123+
}
119124

120125
builder.endObject();
121126
}

0 commit comments

Comments
 (0)