builder.field(Fields.MAX_DOC, indexStatus.docs().maxDoc());
builder.field(Fields.DELETED_DOCS, indexStatus.docs().deletedDocs());
builder.endObject();
}
MergeStats mergeStats = indexStatus.mergeStats();
if (mergeStats != null) {
mergeStats.toXContent(builder, params);
}
RefreshStats refreshStats = indexStatus.refreshStats();
if (refreshStats != null) {
refreshStats.toXContent(builder, params);
}
builder.startObject(Fields.SHARDS);
for (IndexShardStatus indexShardStatus : indexStatus) {
builder.startArray(Integer.toString(indexShardStatus.shardId().id()));
for (ShardStatus shardStatus : indexShardStatus) {
builder.startObject();
builder.startObject(Fields.ROUTING)
.field(Fields.STATE, shardStatus.shardRouting().state())
.field(Fields.PRIMARY, shardStatus.shardRouting().primary())
.field(Fields.NODE, shardStatus.shardRouting().currentNodeId())
.field(Fields.RELOCATING_NODE, shardStatus.shardRouting().relocatingNodeId())
.field(Fields.SHARD, shardStatus.shardRouting().shardId().id())
.field(Fields.INDEX, shardStatus.shardRouting().shardId().index().name())
.endObject();
builder.field(Fields.STATE, shardStatus.state());
if (shardStatus.storeSize() != null) {
builder.startObject(Fields.INDEX);
builder.field(Fields.SIZE, shardStatus.storeSize().toString());
builder.field(Fields.SIZE_IN_BYTES, shardStatus.storeSize().bytes());
builder.endObject();
}
if (shardStatus.translogId() != -1) {
builder.startObject(Fields.TRANSLOG);
builder.field(Fields.ID, shardStatus.translogId());
builder.field(Fields.OPERATIONS, shardStatus.translogOperations());
builder.endObject();
}
if (shardStatus.docs() != null) {
builder.startObject(Fields.DOCS);
builder.field(Fields.NUM_DOCS, shardStatus.docs().numDocs());
builder.field(Fields.MAX_DOC, shardStatus.docs().maxDoc());
builder.field(Fields.DELETED_DOCS, shardStatus.docs().deletedDocs());
builder.endObject();
}
mergeStats = shardStatus.mergeStats();
if (mergeStats != null) {
mergeStats.toXContent(builder, params);
}
refreshStats = shardStatus.refreshStats();
if (refreshStats != null) {
refreshStats.toXContent(builder, params);