本文整理汇总了Java中org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest.clear方法的典型用法代码示例。如果您正苦于以下问题:Java NodesStatsRequest.clear方法的具体用法?Java NodesStatsRequest.clear怎么用?Java NodesStatsRequest.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest
的用法示例。
在下文中一共展示了NodesStatsRequest.clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRequest
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入方法依赖的package包/类
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
nodesStatsRequest.clear();
nodesStatsRequest.indices(true);
String[] fields = request.paramAsStringArray("fields", null);
nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);
client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
}
});
}
示例2: doCatRequest
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入方法依赖的package包/类
@Override
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
nodesStatsRequest.clear();
nodesStatsRequest.indices(true);
String[] fields = request.paramAsStringArray("fields", null);
nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);
return channel -> client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
}
});
}
示例3: updateNodeStats
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入方法依赖的package包/类
/**
* Retrieve the latest nodes stats, calling the listener when complete
* @return a latch that can be used to wait for the nodes stats to complete if desired
*/
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
final CountDownLatch latch = new CountDownLatch(1);
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
nodesStatsRequest.clear();
nodesStatsRequest.fs(true);
nodesStatsRequest.timeout(fetchTimeout);
client.admin().cluster().nodesStats(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
return latch;
}
示例4: updateNodeStats
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入方法依赖的package包/类
/**
* Retrieve the latest nodes stats, calling the listener when complete
* @return a latch that can be used to wait for the nodes stats to complete if desired
*/
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
final CountDownLatch latch = new CountDownLatch(1);
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
nodesStatsRequest.clear();
nodesStatsRequest.fs(true);
nodesStatsRequest.timeout(fetchTimeout);
transportNodesStatsAction.execute(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
return latch;
}
示例5: handleRequest
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入方法依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(nodesIds);
nodesStatsRequest.timeout(request.param("timeout"));
if (metrics.size() == 1 && metrics.contains("_all")) {
nodesStatsRequest.all();
nodesStatsRequest.indices(CommonStatsFlags.ALL);
} else {
nodesStatsRequest.clear();
nodesStatsRequest.os(metrics.contains("os"));
nodesStatsRequest.jvm(metrics.contains("jvm"));
nodesStatsRequest.threadPool(metrics.contains("thread_pool"));
nodesStatsRequest.fs(metrics.contains("fs"));
nodesStatsRequest.transport(metrics.contains("transport"));
nodesStatsRequest.http(metrics.contains("http"));
nodesStatsRequest.indices(metrics.contains("indices"));
nodesStatsRequest.process(metrics.contains("process"));
nodesStatsRequest.breaker(metrics.contains("breaker"));
nodesStatsRequest.script(metrics.contains("script"));
// check for index specific metrics
if (metrics.contains("indices")) {
Set<String> indexMetrics = Strings.splitStringByCommaToSet(request.param("indexMetric", "_all"));
if (indexMetrics.size() == 1 && indexMetrics.contains("_all")) {
nodesStatsRequest.indices(CommonStatsFlags.ALL);
} else {
CommonStatsFlags flags = new CommonStatsFlags();
for (Flag flag : CommonStatsFlags.Flag.values()) {
flags.set(flag, indexMetrics.contains(flag.getRestName()));
}
nodesStatsRequest.indices(flags);
}
}
}
if (nodesStatsRequest.indices().isSet(Flag.FieldData) && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) {
nodesStatsRequest.indices().fieldDataFields(request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", null)));
}
if (nodesStatsRequest.indices().isSet(Flag.Completion) && (request.hasParam("fields") || request.hasParam("completion_fields"))) {
nodesStatsRequest.indices().completionDataFields(request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", null)));
}
if (nodesStatsRequest.indices().isSet(Flag.Search) && (request.hasParam("groups"))) {
nodesStatsRequest.indices().groups(request.paramAsStringArray("groups", null));
}
if (nodesStatsRequest.indices().isSet(Flag.Indexing) && (request.hasParam("types"))) {
nodesStatsRequest.indices().types(request.paramAsStringArray("types", null));
}
client.admin().cluster().nodesStats(nodesStatsRequest, new RestToXContentListener<NodesStatsResponse>(channel));
}