Skip to content

Commit

Permalink
change mapping toXContent
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Büscher committed Jan 7, 2019
1 parent d169030 commit 296f2bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,18 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}
builder.endObject();
} else {
if (indexMappings != null && indexMappings.size() > 0) {
builder.field("mappings");
for (final ObjectObjectCursor<String, MappingMetaData> typeEntry : indexMappings) {
builder.map(typeEntry.value.sourceAsMap());
MappingMetaData mappings = null;
for (final ObjectObjectCursor<String, MappingMetaData> typeEntry : indexMappings) {
if (typeEntry.key.equals(MapperService.DEFAULT_MAPPING) == false) {
assert mappings == null;
mappings = typeEntry.value;
}
if (mappings == null) {
// no mappings yet
builder.startObject("mappings").endObject();
} else {
builder.field("mappings", mappings.sourceAsMap());
}
} else {
// we always want to output a mappings object, even if empty
builder.startObject("mappings");
builder.endObject();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public class RestGetIndicesAction extends BaseRestHandler {
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using `include_type_name` in get indices requests is deprecated. "
+ "The parameter will be removed in the next major version.";

private static final Set<String> allowedResponseParameters = Collections.unmodifiableSet(Stream
.concat(Collections.singleton(INCLUDE_TYPE_NAME_PARAMETER).stream(), Settings.FORMAT_PARAMS.stream()).collect(Collectors.toSet()));
private static final Set<String> allowedResponseParameters = Collections
.unmodifiableSet(Stream.concat(Collections.singleton(INCLUDE_TYPE_NAME_PARAMETER).stream(), Settings.FORMAT_PARAMS.stream())
.collect(Collectors.toSet()));

public RestGetIndicesAction(
final Settings settings,
Expand Down

0 comments on commit 296f2bc

Please sign in to comment.