Include empty mappings in GET /{index}/_mappings requests (#25118)
Previously this would output: ``` GET /test-1/_mappings { } ``` And after this change: ``` GET /test-1/_mappings { "test-1": { "mappings": {} } } ``` To bring parity back to the REST output after #24723. Relates to #25090
This commit is contained in:
parent
5b2ab96364
commit
050b7cd0f9
|
@ -89,9 +89,6 @@ public class RestGetMappingAction extends BaseRestHandler {
|
||||||
|
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexEntry : mappingsByIndex) {
|
for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexEntry : mappingsByIndex) {
|
||||||
if (indexEntry.value.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
builder.startObject(indexEntry.key);
|
builder.startObject(indexEntry.key);
|
||||||
builder.startObject(Fields.MAPPINGS);
|
builder.startObject(Fields.MAPPINGS);
|
||||||
for (ObjectObjectCursor<String, MappingMetaData> typeEntry : indexEntry.value) {
|
for (ObjectObjectCursor<String, MappingMetaData> typeEntry : indexEntry.value) {
|
||||||
|
|
|
@ -19,6 +19,19 @@ setup:
|
||||||
type_2: {}
|
type_2: {}
|
||||||
type_3: {}
|
type_3: {}
|
||||||
|
|
||||||
|
---
|
||||||
|
"Get /{index}/_mapping with empty mappings":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.create:
|
||||||
|
index: t
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.get_mapping:
|
||||||
|
index: t
|
||||||
|
|
||||||
|
- match: { t.mappings: {}}
|
||||||
|
|
||||||
---
|
---
|
||||||
"Get /_mapping":
|
"Get /_mapping":
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue