mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-07 21:48:39 +00:00
Node Stats: Allow to explicitly get specific indices level node stats element
closes #2871
This commit is contained in:
parent
15d7ae5983
commit
5fa66cd592
@ -19,6 +19,7 @@
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.node.stats;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.action.support.nodes.NodesOperationRequest;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
@ -30,7 +31,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest> {
|
||||
|
||||
private boolean indices = true;
|
||||
private CommonStatsFlags indices = new CommonStatsFlags();
|
||||
private boolean os;
|
||||
private boolean process;
|
||||
private boolean jvm;
|
||||
@ -55,7 +56,7 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
||||
* Sets all the request flags.
|
||||
*/
|
||||
public NodesStatsRequest all() {
|
||||
this.indices = true;
|
||||
this.indices.all();
|
||||
this.os = true;
|
||||
this.process = true;
|
||||
this.jvm = true;
|
||||
@ -71,7 +72,7 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
||||
* Clears all the request flags.
|
||||
*/
|
||||
public NodesStatsRequest clear() {
|
||||
this.indices = false;
|
||||
this.indices.clear();
|
||||
this.os = false;
|
||||
this.process = false;
|
||||
this.jvm = false;
|
||||
@ -83,18 +84,24 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should indices stats be returned.
|
||||
*/
|
||||
public boolean indices() {
|
||||
return this.indices;
|
||||
public CommonStatsFlags indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public NodesStatsRequest indices(CommonStatsFlags indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should indices stats be returned.
|
||||
*/
|
||||
public NodesStatsRequest indices(boolean indices) {
|
||||
this.indices = indices;
|
||||
if (indices) {
|
||||
this.indices.all();
|
||||
} else {
|
||||
this.indices.clear();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -221,7 +228,7 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
indices = in.readBoolean();
|
||||
indices = CommonStatsFlags.readCommonStatsFlags(in);
|
||||
os = in.readBoolean();
|
||||
process = in.readBoolean();
|
||||
jvm = in.readBoolean();
|
||||
@ -235,7 +242,7 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeBoolean(indices);
|
||||
indices.writeTo(out);
|
||||
out.writeBoolean(os);
|
||||
out.writeBoolean(process);
|
||||
out.writeBoolean(jvm);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.action.admin.cluster.node.stats;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
|
||||
import org.elasticsearch.client.ClusterAdminClient;
|
||||
import org.elasticsearch.client.internal.InternalClusterAdminClient;
|
||||
@ -57,6 +58,14 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node indices stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setIndices(CommonStatsFlags indices) {
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node OS stats be returned.
|
||||
*/
|
||||
|
@ -45,40 +45,40 @@ import java.io.IOException;
|
||||
public class CommonStats implements Streamable, ToXContent {
|
||||
|
||||
@Nullable
|
||||
DocsStats docs;
|
||||
public DocsStats docs;
|
||||
|
||||
@Nullable
|
||||
StoreStats store;
|
||||
public StoreStats store;
|
||||
|
||||
@Nullable
|
||||
IndexingStats indexing;
|
||||
public IndexingStats indexing;
|
||||
|
||||
@Nullable
|
||||
GetStats get;
|
||||
public GetStats get;
|
||||
|
||||
@Nullable
|
||||
SearchStats search;
|
||||
public SearchStats search;
|
||||
|
||||
@Nullable
|
||||
MergeStats merge;
|
||||
public MergeStats merge;
|
||||
|
||||
@Nullable
|
||||
RefreshStats refresh;
|
||||
public RefreshStats refresh;
|
||||
|
||||
@Nullable
|
||||
FlushStats flush;
|
||||
public FlushStats flush;
|
||||
|
||||
@Nullable
|
||||
WarmerStats warmer;
|
||||
public WarmerStats warmer;
|
||||
|
||||
@Nullable
|
||||
FilterCacheStats filterCache;
|
||||
public FilterCacheStats filterCache;
|
||||
|
||||
@Nullable
|
||||
IdCacheStats idCache;
|
||||
public IdCacheStats idCache;
|
||||
|
||||
@Nullable
|
||||
FieldDataStats fieldData;
|
||||
public FieldDataStats fieldData;
|
||||
|
||||
public void add(CommonStats stats) {
|
||||
if (docs == null) {
|
||||
|
@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. ElasticSearch licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.stats;
|
||||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CommonStatsFlags implements Streamable {
|
||||
|
||||
private boolean docs = true;
|
||||
private boolean store = true;
|
||||
private boolean indexing = true;
|
||||
private boolean get = true;
|
||||
private boolean search = true;
|
||||
private boolean merge = false;
|
||||
private boolean refresh = false;
|
||||
private boolean flush = false;
|
||||
private boolean warmer = false;
|
||||
private boolean filterCache = false;
|
||||
private boolean idCache = false;
|
||||
private boolean fieldData = false;
|
||||
private String[] types = null;
|
||||
private String[] groups = null;
|
||||
|
||||
/**
|
||||
* Sets all flags to return all stats.
|
||||
*/
|
||||
public CommonStatsFlags all() {
|
||||
docs = true;
|
||||
store = true;
|
||||
get = true;
|
||||
indexing = true;
|
||||
search = true;
|
||||
merge = true;
|
||||
refresh = true;
|
||||
flush = true;
|
||||
warmer = true;
|
||||
filterCache = true;
|
||||
idCache = true;
|
||||
fieldData = true;
|
||||
types = null;
|
||||
groups = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all stats.
|
||||
*/
|
||||
public CommonStatsFlags clear() {
|
||||
docs = false;
|
||||
store = false;
|
||||
get = false;
|
||||
indexing = false;
|
||||
search = false;
|
||||
merge = false;
|
||||
refresh = false;
|
||||
flush = false;
|
||||
warmer = false;
|
||||
filterCache = false;
|
||||
idCache = false;
|
||||
fieldData = false;
|
||||
types = null;
|
||||
groups = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean anySet() {
|
||||
return docs || store || get || indexing || search || merge || refresh || flush || warmer || filterCache || idCache || fieldData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document types to return stats for. Mainly affects {@link #indexing(boolean)} when
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public CommonStatsFlags types(String... types) {
|
||||
this.types = types;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document types to return stats for. Mainly affects {@link #indexing(boolean)} when
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public String[] types() {
|
||||
return this.types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets specific search group stats to retrieve the stats for. Mainly affects search
|
||||
* when enabled.
|
||||
*/
|
||||
public CommonStatsFlags groups(String... groups) {
|
||||
this.groups = groups;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] groups() {
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
public CommonStatsFlags docs(boolean docs) {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean docs() {
|
||||
return this.docs;
|
||||
}
|
||||
|
||||
public CommonStatsFlags store(boolean store) {
|
||||
this.store = store;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean store() {
|
||||
return this.store;
|
||||
}
|
||||
|
||||
public CommonStatsFlags indexing(boolean indexing) {
|
||||
this.indexing = indexing;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean indexing() {
|
||||
return this.indexing;
|
||||
}
|
||||
|
||||
public CommonStatsFlags get(boolean get) {
|
||||
this.get = get;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
return this.get;
|
||||
}
|
||||
|
||||
public CommonStatsFlags search(boolean search) {
|
||||
this.search = search;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean search() {
|
||||
return this.search;
|
||||
}
|
||||
|
||||
public CommonStatsFlags merge(boolean merge) {
|
||||
this.merge = merge;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean merge() {
|
||||
return this.merge;
|
||||
}
|
||||
|
||||
public CommonStatsFlags refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
}
|
||||
|
||||
public CommonStatsFlags flush(boolean flush) {
|
||||
this.flush = flush;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean flush() {
|
||||
return this.flush;
|
||||
}
|
||||
|
||||
public CommonStatsFlags warmer(boolean warmer) {
|
||||
this.warmer = warmer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean warmer() {
|
||||
return this.warmer;
|
||||
}
|
||||
|
||||
public CommonStatsFlags filterCache(boolean filterCache) {
|
||||
this.filterCache = filterCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean filterCache() {
|
||||
return this.filterCache;
|
||||
}
|
||||
|
||||
public CommonStatsFlags idCache(boolean idCache) {
|
||||
this.idCache = idCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean idCache() {
|
||||
return this.idCache;
|
||||
}
|
||||
|
||||
public CommonStatsFlags fieldData(boolean fieldData) {
|
||||
this.fieldData = fieldData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean fieldData() {
|
||||
return this.fieldData;
|
||||
}
|
||||
|
||||
public static CommonStatsFlags readCommonStatsFlags(StreamInput in) throws IOException {
|
||||
CommonStatsFlags flags = new CommonStatsFlags();
|
||||
flags.readFrom(in);
|
||||
return flags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeBoolean(docs);
|
||||
out.writeBoolean(store);
|
||||
out.writeBoolean(indexing);
|
||||
out.writeBoolean(get);
|
||||
out.writeBoolean(search);
|
||||
out.writeBoolean(merge);
|
||||
out.writeBoolean(flush);
|
||||
out.writeBoolean(refresh);
|
||||
out.writeBoolean(warmer);
|
||||
out.writeBoolean(filterCache);
|
||||
out.writeBoolean(idCache);
|
||||
out.writeBoolean(fieldData);
|
||||
if (types == null) {
|
||||
out.writeVInt(0);
|
||||
} else {
|
||||
out.writeVInt(types.length);
|
||||
for (String type : types) {
|
||||
out.writeString(type);
|
||||
}
|
||||
}
|
||||
if (groups == null) {
|
||||
out.writeVInt(0);
|
||||
} else {
|
||||
out.writeVInt(groups.length);
|
||||
for (String group : groups) {
|
||||
out.writeString(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
docs = in.readBoolean();
|
||||
store = in.readBoolean();
|
||||
indexing = in.readBoolean();
|
||||
get = in.readBoolean();
|
||||
search = in.readBoolean();
|
||||
merge = in.readBoolean();
|
||||
flush = in.readBoolean();
|
||||
refresh = in.readBoolean();
|
||||
warmer = in.readBoolean();
|
||||
filterCache = in.readBoolean();
|
||||
idCache = in.readBoolean();
|
||||
fieldData = in.readBoolean();
|
||||
int size = in.readVInt();
|
||||
if (size > 0) {
|
||||
types = new String[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
types[i] = in.readString();
|
||||
}
|
||||
}
|
||||
size = in.readVInt();
|
||||
if (size > 0) {
|
||||
groups = new String[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
groups[i] = in.readString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -36,39 +36,13 @@ import java.io.IOException;
|
||||
*/
|
||||
public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsRequest> {
|
||||
|
||||
private boolean docs = true;
|
||||
private boolean store = true;
|
||||
private boolean indexing = true;
|
||||
private boolean get = true;
|
||||
private boolean search = true;
|
||||
private boolean merge = false;
|
||||
private boolean refresh = false;
|
||||
private boolean flush = false;
|
||||
private boolean warmer = false;
|
||||
private boolean filterCache = false;
|
||||
private boolean idCache = false;
|
||||
private boolean fieldData = false;
|
||||
private String[] types = null;
|
||||
private String[] groups = null;
|
||||
private CommonStatsFlags flags = new CommonStatsFlags();
|
||||
|
||||
/**
|
||||
* Sets all flags to return all stats.
|
||||
*/
|
||||
public IndicesStatsRequest all() {
|
||||
docs = true;
|
||||
store = true;
|
||||
get = true;
|
||||
indexing = true;
|
||||
search = true;
|
||||
merge = true;
|
||||
refresh = true;
|
||||
flush = true;
|
||||
warmer = true;
|
||||
filterCache = true;
|
||||
idCache = true;
|
||||
fieldData = true;
|
||||
types = null;
|
||||
groups = null;
|
||||
flags.all();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -76,20 +50,7 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
||||
* Clears all stats.
|
||||
*/
|
||||
public IndicesStatsRequest clear() {
|
||||
docs = false;
|
||||
store = false;
|
||||
get = false;
|
||||
indexing = false;
|
||||
search = false;
|
||||
merge = false;
|
||||
refresh = false;
|
||||
flush = false;
|
||||
warmer = false;
|
||||
filterCache = false;
|
||||
idCache = false;
|
||||
fieldData = false;
|
||||
types = null;
|
||||
groups = null;
|
||||
flags.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -98,7 +59,7 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public IndicesStatsRequest types(String... types) {
|
||||
this.types = types;
|
||||
flags.types(types);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -107,7 +68,7 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public String[] types() {
|
||||
return this.types;
|
||||
return this.flags.types();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,183 +76,131 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
||||
* when enabled.
|
||||
*/
|
||||
public IndicesStatsRequest groups(String... groups) {
|
||||
this.groups = groups;
|
||||
flags.groups(groups);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] groups() {
|
||||
return this.groups;
|
||||
return this.flags.groups();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest docs(boolean docs) {
|
||||
this.docs = docs;
|
||||
flags.docs(docs);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean docs() {
|
||||
return this.docs;
|
||||
return flags.docs();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest store(boolean store) {
|
||||
this.store = store;
|
||||
flags.store(store);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean store() {
|
||||
return this.store;
|
||||
return flags.store();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest indexing(boolean indexing) {
|
||||
this.indexing = indexing;
|
||||
flags.indexing(indexing);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean indexing() {
|
||||
return this.indexing;
|
||||
return flags.indexing();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest get(boolean get) {
|
||||
this.get = get;
|
||||
flags.get(get);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
return this.get;
|
||||
return flags.get();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest search(boolean search) {
|
||||
this.search = search;
|
||||
flags.search(search);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean search() {
|
||||
return this.search;
|
||||
return flags.search();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest merge(boolean merge) {
|
||||
this.merge = merge;
|
||||
flags.merge(merge);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean merge() {
|
||||
return this.merge;
|
||||
return flags.merge();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
flags.refresh(refresh);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
return flags.refresh();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest flush(boolean flush) {
|
||||
this.flush = flush;
|
||||
flags.flush(flush);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean flush() {
|
||||
return this.flush;
|
||||
return flags.flush();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest warmer(boolean warmer) {
|
||||
this.warmer = warmer;
|
||||
flags.warmer(warmer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean warmer() {
|
||||
return this.warmer;
|
||||
return flags.warmer();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest filterCache(boolean filterCache) {
|
||||
this.filterCache = filterCache;
|
||||
flags.filterCache(filterCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean filterCache() {
|
||||
return this.filterCache;
|
||||
return flags.filterCache();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest idCache(boolean idCache) {
|
||||
this.idCache = idCache;
|
||||
flags.idCache(idCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean idCache() {
|
||||
return this.idCache;
|
||||
return flags.idCache();
|
||||
}
|
||||
|
||||
public IndicesStatsRequest fieldData(boolean fieldData) {
|
||||
this.fieldData = fieldData;
|
||||
flags.fieldData(fieldData);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean fieldData() {
|
||||
return this.fieldData;
|
||||
return flags.fieldData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeBoolean(docs);
|
||||
out.writeBoolean(store);
|
||||
out.writeBoolean(indexing);
|
||||
out.writeBoolean(get);
|
||||
out.writeBoolean(search);
|
||||
out.writeBoolean(merge);
|
||||
out.writeBoolean(flush);
|
||||
out.writeBoolean(refresh);
|
||||
out.writeBoolean(warmer);
|
||||
out.writeBoolean(filterCache);
|
||||
out.writeBoolean(idCache);
|
||||
out.writeBoolean(fieldData);
|
||||
if (types == null) {
|
||||
out.writeVInt(0);
|
||||
} else {
|
||||
out.writeVInt(types.length);
|
||||
for (String type : types) {
|
||||
out.writeString(type);
|
||||
}
|
||||
}
|
||||
if (groups == null) {
|
||||
out.writeVInt(0);
|
||||
} else {
|
||||
out.writeVInt(groups.length);
|
||||
for (String group : groups) {
|
||||
out.writeString(group);
|
||||
}
|
||||
}
|
||||
flags.writeTo(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
docs = in.readBoolean();
|
||||
store = in.readBoolean();
|
||||
indexing = in.readBoolean();
|
||||
get = in.readBoolean();
|
||||
search = in.readBoolean();
|
||||
merge = in.readBoolean();
|
||||
flush = in.readBoolean();
|
||||
refresh = in.readBoolean();
|
||||
warmer = in.readBoolean();
|
||||
filterCache = in.readBoolean();
|
||||
idCache = in.readBoolean();
|
||||
fieldData = in.readBoolean();
|
||||
int size = in.readVInt();
|
||||
if (size > 0) {
|
||||
types = new String[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
types[i] = in.readString();
|
||||
}
|
||||
}
|
||||
size = in.readVInt();
|
||||
if (size > 0) {
|
||||
groups = new String[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
groups[i] = in.readString();
|
||||
}
|
||||
}
|
||||
flags = CommonStatsFlags.readCommonStatsFlags(in);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.indices;
|
||||
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.service.IndexService;
|
||||
@ -43,6 +44,8 @@ public interface IndicesService extends Iterable<IndexService>, LifecycleCompone
|
||||
*/
|
||||
NodeIndicesStats stats(boolean includePrevious);
|
||||
|
||||
NodeIndicesStats stats(boolean includePrevious, CommonStatsFlags flags);
|
||||
|
||||
boolean hasIndex(String index);
|
||||
|
||||
IndicesLifecycle indicesLifecycle();
|
||||
|
@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.ElasticSearchIllegalStateException;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.*;
|
||||
@ -181,43 +183,48 @@ public class InternalIndicesService extends AbstractLifecycleComponent<IndicesSe
|
||||
|
||||
@Override
|
||||
public NodeIndicesStats stats(boolean includePrevious) {
|
||||
DocsStats docsStats = new DocsStats();
|
||||
StoreStats storeStats = new StoreStats();
|
||||
IndexingStats indexingStats = new IndexingStats();
|
||||
GetStats getStats = new GetStats();
|
||||
SearchStats searchStats = new SearchStats();
|
||||
FieldDataStats fieldDataStats = new FieldDataStats();
|
||||
FilterCacheStats filterCacheStats = new FilterCacheStats();
|
||||
IdCacheStats idCacheStats = new IdCacheStats();
|
||||
MergeStats mergeStats = new MergeStats();
|
||||
RefreshStats refreshStats = new RefreshStats();
|
||||
FlushStats flushStats = new FlushStats();
|
||||
return stats(true, new CommonStatsFlags().all());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeIndicesStats stats(boolean includePrevious, CommonStatsFlags flags) {
|
||||
CommonStats stats = new CommonStats();
|
||||
if (flags.docs()) stats.docs = new DocsStats();
|
||||
if (flags.store()) stats.store = new StoreStats();
|
||||
if (flags.get()) stats.get = new GetStats();
|
||||
if (flags.indexing()) stats.indexing = new IndexingStats();
|
||||
if (flags.search()) stats.search = new SearchStats();
|
||||
if (flags.merge()) stats.merge = new MergeStats();
|
||||
if (flags.refresh()) stats.refresh = new RefreshStats();
|
||||
if (flags.flush()) stats.flush = new FlushStats();
|
||||
if (flags.fieldData()) stats.fieldData = new FieldDataStats();
|
||||
if (flags.idCache()) stats.idCache = new IdCacheStats();
|
||||
if (flags.filterCache()) stats.filterCache = new FilterCacheStats();
|
||||
if (includePrevious) {
|
||||
getStats.add(oldShardsStats.getStats);
|
||||
indexingStats.add(oldShardsStats.indexingStats);
|
||||
searchStats.add(oldShardsStats.searchStats);
|
||||
mergeStats.add(oldShardsStats.mergeStats);
|
||||
refreshStats.add(oldShardsStats.refreshStats);
|
||||
flushStats.add(oldShardsStats.flushStats);
|
||||
if (flags.get()) stats.get.add(oldShardsStats.getStats);
|
||||
if (flags.indexing()) stats.indexing.add(oldShardsStats.indexingStats);
|
||||
if (flags.search()) stats.search.add(oldShardsStats.searchStats);
|
||||
if (flags.merge()) stats.merge.add(oldShardsStats.mergeStats);
|
||||
if (flags.refresh()) stats.refresh.add(oldShardsStats.refreshStats);
|
||||
if (flags.flush()) stats.flush.add(oldShardsStats.flushStats);
|
||||
}
|
||||
|
||||
for (IndexService indexService : indices.values()) {
|
||||
for (IndexShard indexShard : indexService) {
|
||||
storeStats.add(indexShard.storeStats());
|
||||
docsStats.add(indexShard.docStats());
|
||||
getStats.add(indexShard.getStats());
|
||||
indexingStats.add(indexShard.indexingStats());
|
||||
searchStats.add(indexShard.searchStats());
|
||||
mergeStats.add(indexShard.mergeStats());
|
||||
refreshStats.add(indexShard.refreshStats());
|
||||
flushStats.add(indexShard.flushStats());
|
||||
filterCacheStats.add(indexShard.filterCacheStats());
|
||||
idCacheStats.add(indexShard.idCacheStats());
|
||||
fieldDataStats.add(indexShard.fieldDataStats());
|
||||
if (flags.store()) stats.store.add(indexShard.storeStats());
|
||||
if (flags.docs()) stats.docs.add(indexShard.docStats());
|
||||
if (flags.get()) stats.get.add(indexShard.getStats());
|
||||
if (flags.indexing()) stats.indexing.add(indexShard.indexingStats());
|
||||
if (flags.search()) stats.search.add(indexShard.searchStats());
|
||||
if (flags.merge()) stats.merge.add(indexShard.mergeStats());
|
||||
if (flags.refresh()) stats.refresh.add(indexShard.refreshStats());
|
||||
if (flags.flush()) stats.flush.add(indexShard.flushStats());
|
||||
if (flags.filterCache()) stats.filterCache.add(indexShard.filterCacheStats());
|
||||
if (flags.idCache()) stats.idCache.add(indexShard.idCacheStats());
|
||||
if (flags.fieldData()) stats.fieldData.add(indexShard.fieldDataStats());
|
||||
}
|
||||
}
|
||||
return new NodeIndicesStats(storeStats, docsStats, indexingStats, getStats, searchStats, fieldDataStats, mergeStats, refreshStats, flushStats, filterCacheStats, idCacheStats);
|
||||
return new NodeIndicesStats(stats);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package org.elasticsearch.indices;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStats;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
@ -45,80 +47,68 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class NodeIndicesStats implements Streamable, Serializable, ToXContent {
|
||||
|
||||
private StoreStats storeStats;
|
||||
private DocsStats docsStats;
|
||||
private IndexingStats indexingStats;
|
||||
private GetStats getStats;
|
||||
private SearchStats searchStats;
|
||||
private FieldDataStats fieldDataStats;
|
||||
private MergeStats mergeStats;
|
||||
private RefreshStats refreshStats;
|
||||
private FlushStats flushStats;
|
||||
private FilterCacheStats filterCacheStats;
|
||||
private IdCacheStats idCacheStats;
|
||||
private CommonStats stats;
|
||||
|
||||
NodeIndicesStats() {
|
||||
}
|
||||
|
||||
public NodeIndicesStats(StoreStats storeStats, DocsStats docsStats, IndexingStats indexingStats, GetStats getStats, SearchStats searchStats, FieldDataStats fieldDataStats, MergeStats mergeStats, RefreshStats refreshStats, FlushStats flushStats, FilterCacheStats filterCacheStats, IdCacheStats idCacheStats) {
|
||||
this.storeStats = storeStats;
|
||||
this.docsStats = docsStats;
|
||||
this.indexingStats = indexingStats;
|
||||
this.getStats = getStats;
|
||||
this.searchStats = searchStats;
|
||||
this.fieldDataStats = fieldDataStats;
|
||||
this.mergeStats = mergeStats;
|
||||
this.refreshStats = refreshStats;
|
||||
this.flushStats = flushStats;
|
||||
this.filterCacheStats = filterCacheStats;
|
||||
this.idCacheStats = idCacheStats;
|
||||
public NodeIndicesStats(CommonStats stats) {
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the index storage taken on the node.
|
||||
*/
|
||||
@Nullable
|
||||
public StoreStats getStore() {
|
||||
return storeStats;
|
||||
return stats.getStore();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DocsStats getDocs() {
|
||||
return this.docsStats;
|
||||
return stats.getDocs();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IndexingStats getIndexing() {
|
||||
return indexingStats;
|
||||
return stats.getIndexing();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public GetStats getGet() {
|
||||
return this.getStats;
|
||||
return stats.getGet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SearchStats getSearch() {
|
||||
return this.searchStats;
|
||||
return stats.getSearch();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MergeStats getMerge() {
|
||||
return this.mergeStats;
|
||||
return stats.getMerge();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RefreshStats getRefresh() {
|
||||
return refreshStats;
|
||||
return stats.getRefresh();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FlushStats getFlush() {
|
||||
return this.flushStats;
|
||||
return stats.getFlush();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FieldDataStats getFieldData() {
|
||||
return fieldDataStats;
|
||||
return stats.getFieldData();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FilterCacheStats getFilterCache() {
|
||||
return this.filterCacheStats;
|
||||
return stats.getFilterCache();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IdCacheStats getIdCache() {
|
||||
return this.idCacheStats;
|
||||
return stats.getIdCache();
|
||||
}
|
||||
|
||||
public static NodeIndicesStats readIndicesStats(StreamInput in) throws IOException {
|
||||
@ -129,50 +119,18 @@ public class NodeIndicesStats implements Streamable, Serializable, ToXContent {
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
storeStats = StoreStats.readStoreStats(in);
|
||||
docsStats = DocsStats.readDocStats(in);
|
||||
indexingStats = IndexingStats.readIndexingStats(in);
|
||||
getStats = GetStats.readGetStats(in);
|
||||
searchStats = SearchStats.readSearchStats(in);
|
||||
fieldDataStats = FieldDataStats.readFieldDataStats(in);
|
||||
mergeStats = MergeStats.readMergeStats(in);
|
||||
refreshStats = RefreshStats.readRefreshStats(in);
|
||||
flushStats = FlushStats.readFlushStats(in);
|
||||
filterCacheStats = FilterCacheStats.readFilterCacheStats(in);
|
||||
idCacheStats = IdCacheStats.readIdCacheStats(in);
|
||||
stats = CommonStats.readCommonStats(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
storeStats.writeTo(out);
|
||||
docsStats.writeTo(out);
|
||||
indexingStats.writeTo(out);
|
||||
getStats.writeTo(out);
|
||||
searchStats.writeTo(out);
|
||||
fieldDataStats.writeTo(out);
|
||||
mergeStats.writeTo(out);
|
||||
refreshStats.writeTo(out);
|
||||
flushStats.writeTo(out);
|
||||
filterCacheStats.writeTo(out);
|
||||
idCacheStats.writeTo(out);
|
||||
stats.writeTo(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(Fields.INDICES);
|
||||
|
||||
storeStats.toXContent(builder, params);
|
||||
docsStats.toXContent(builder, params);
|
||||
indexingStats.toXContent(builder, params);
|
||||
getStats.toXContent(builder, params);
|
||||
searchStats.toXContent(builder, params);
|
||||
filterCacheStats.toXContent(builder, params);
|
||||
idCacheStats.toXContent(builder, params);
|
||||
fieldDataStats.toXContent(builder, params);
|
||||
mergeStats.toXContent(builder, params);
|
||||
refreshStats.toXContent(builder, params);
|
||||
flushStats.toXContent(builder, params);
|
||||
|
||||
stats.toXContent(builder, params);
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class IndicesFieldDataCache extends AbstractComponent implements RemovalL
|
||||
|
||||
@Override
|
||||
public void onRemoval(RemovalNotification<Key, AtomicFieldData> notification) {
|
||||
if (notification.getKey() != null) {
|
||||
if (notification.getKey() != null && notification.getKey().listener != null) {
|
||||
IndexFieldCache indexCache = notification.getKey().indexCache;
|
||||
notification.getKey().listener.onUnload(indexCache.fieldNames, indexCache.fieldDataType, notification.wasEvicted(), notification.getKey().sizeInBytes, notification.getValue());
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
@ -159,11 +160,11 @@ public class NodeService extends AbstractComponent {
|
||||
);
|
||||
}
|
||||
|
||||
public NodeStats stats(boolean indices, boolean os, boolean process, boolean jvm, boolean threadPool, boolean network, boolean fs, boolean transport, boolean http) {
|
||||
public NodeStats stats(CommonStatsFlags indices, boolean os, boolean process, boolean jvm, boolean threadPool, boolean network, boolean fs, boolean transport, boolean http) {
|
||||
// for indices stats we want to include previous allocated shards stats as well (it will
|
||||
// only be applied to the sensible ones to use, like refresh/merge/flush/indexing stats)
|
||||
return new NodeStats(clusterService.state().nodes().localNode(), System.currentTimeMillis(), hostname,
|
||||
indices ? indicesService.stats(true) : null,
|
||||
indices.anySet() ? indicesService.stats(true, indices) : null,
|
||||
os ? monitorService.osService().stats() : null,
|
||||
process ? monitorService.processService().stats() : null,
|
||||
jvm ? monitorService.jvmService().stats() : null,
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.stats;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
@ -46,12 +47,84 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats", this);
|
||||
|
||||
RestIndicesHandler indicesHandler = new RestIndicesHandler();
|
||||
RestIndicesHandler indicesHandler = new RestIndicesHandler(new CommonStatsFlags().all());
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().docs(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/docs", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/docs", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/docs/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/docs/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().store(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/store", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/store", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/store/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/store/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().merge(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/merge", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/merge", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/merge/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/merge/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().refresh(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/refresh", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/refresh", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/refresh/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/refresh/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().flush(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/flush", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/flush", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/flush/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/flush/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().warmer(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/warmer", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/warmer", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/warmer/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/warmer/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().filterCache(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/filter_cache", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/filter_cache", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/filter_cache/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/filter_cache/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().fieldData(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/fielddata", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/fielddata", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/fielddata/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/fielddata/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().idCache(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/id_cache", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/id_cache", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/id_cache/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/id_cache/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().indexing(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/indexing", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/indexing", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/indexing/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/indexing/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().search(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/search", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/search", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/search/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/search/stats", indicesHandler);
|
||||
|
||||
indicesHandler = new RestIndicesHandler(new CommonStatsFlags().clear().get(true));
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/indices/get", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/indices/get", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/indices/get/stats", indicesHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/indices/get/stats", indicesHandler);
|
||||
|
||||
RestOsHandler osHandler = new RestOsHandler();
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/stats/os", osHandler);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_nodes/{nodeId}/stats/os", osHandler);
|
||||
@ -113,7 +186,9 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
||||
if (all) {
|
||||
nodesStatsRequest.all();
|
||||
}
|
||||
nodesStatsRequest.indices(request.paramAsBoolean("indices", nodesStatsRequest.indices()));
|
||||
if (request.hasParam("indices")) {
|
||||
nodesStatsRequest.indices(request.paramAsBoolean("indices", false));
|
||||
}
|
||||
nodesStatsRequest.os(request.paramAsBoolean("os", nodesStatsRequest.os()));
|
||||
nodesStatsRequest.process(request.paramAsBoolean("process", nodesStatsRequest.process()));
|
||||
nodesStatsRequest.jvm(request.paramAsBoolean("jvm", nodesStatsRequest.jvm()));
|
||||
@ -153,10 +228,17 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
||||
}
|
||||
|
||||
class RestIndicesHandler implements RestHandler {
|
||||
|
||||
private CommonStatsFlags flags;
|
||||
|
||||
RestIndicesHandler(CommonStatsFlags flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||
NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId")));
|
||||
nodesStatsRequest.clear().indices(true);
|
||||
nodesStatsRequest.clear().indices(flags);
|
||||
executeNodeStats(request, channel, nodesStatsRequest);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user