Add getWarmer and getTranslog method to NodeIndicesStats (#28092)

When calling the node stats action via the Java API it was not able to return
information about warmers and translog even though that is available through 
the REST API. This change adds methods to make the responses more 
consistent.
This commit is contained in:
Scott Somerville 2018-01-05 08:19:09 -05:00 committed by Christoph Büscher
parent a38f70b5dd
commit 7180e539de
1 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,6 @@ import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent.Params;
import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.ToXContentFragment;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
@ -43,6 +42,8 @@ import org.elasticsearch.index.search.stats.SearchStats;
import org.elasticsearch.index.shard.DocsStats; import org.elasticsearch.index.shard.DocsStats;
import org.elasticsearch.index.shard.IndexingStats; import org.elasticsearch.index.shard.IndexingStats;
import org.elasticsearch.index.store.StoreStats; import org.elasticsearch.index.store.StoreStats;
import org.elasticsearch.index.translog.TranslogStats;
import org.elasticsearch.index.warmer.WarmerStats;
import org.elasticsearch.search.suggest.completion.CompletionStats; import org.elasticsearch.search.suggest.completion.CompletionStats;
import java.io.IOException; import java.io.IOException;
@ -117,6 +118,11 @@ public class NodeIndicesStats implements Streamable, ToXContentFragment {
return stats.getFlush(); return stats.getFlush();
} }
@Nullable
public WarmerStats getWarmer() {
return stats.getWarmer();
}
@Nullable @Nullable
public FieldDataStats getFieldData() { public FieldDataStats getFieldData() {
return stats.getFieldData(); return stats.getFieldData();
@ -142,6 +148,11 @@ public class NodeIndicesStats implements Streamable, ToXContentFragment {
return stats.getSegments(); return stats.getSegments();
} }
@Nullable
public TranslogStats getTranslog() {
return stats.getTranslog();
}
@Nullable @Nullable
public RecoveryStats getRecoveryStats() { public RecoveryStats getRecoveryStats() {
return stats.getRecoveryStats(); return stats.getRecoveryStats();