.filteredIndices(indices);
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
@Override public void onResponse(ClusterStateResponse response) {
try {
MetaData metaData = response.state().metaData();
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
builder.startObject();
if (indices.length == 1 && types.size() == 1) {
if (metaData.indices().isEmpty()) {
channel.sendResponse(new XContentThrowableRestResponse(request, new IndexMissingException(new Index(indices[0]))));
return;
}
boolean foundType = false;
IndexMetaData indexMetaData = metaData.iterator().next();
for (MappingMetaData mappingMd : indexMetaData.mappings().values()) {
if (!types.isEmpty() && !types.contains(mappingMd.type())) {
// filter this type out...
continue;
}