本文整理汇总了Java中org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest类的典型用法代码示例。如果您正苦于以下问题:Java IndicesStatsRequest类的具体用法?Java IndicesStatsRequest怎么用?Java IndicesStatsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndicesStatsRequest类属于org.elasticsearch.action.admin.indices.stats包,在下文中一共展示了IndicesStatsRequest类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doCatRequest
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
clusterStateRequest.clear().nodes(true).metaData(true).routingTable(true).indices(indices);
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
@Override
public void processResponse(final ClusterStateResponse clusterStateResponse) {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.all();
indicesStatsRequest.indices(indices);
client.admin().indices().stats(indicesStatsRequest, new RestResponseListener<IndicesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(IndicesStatsResponse indicesStatsResponse) throws Exception {
return RestTable.buildResponse(buildTable(request, clusterStateResponse, indicesStatsResponse), channel);
}
});
}
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:RestShardsAction.java
示例2: doRequest
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
clusterStateRequest.clear().nodes(true).metaData(true).routingTable(true).indices(indices);
client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
@Override
public void processResponse(final ClusterStateResponse clusterStateResponse) {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(indices);
indicesStatsRequest.all();
client.admin().indices().stats(indicesStatsRequest, new RestResponseListener<IndicesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(IndicesStatsResponse indicesStatsResponse) throws Exception {
return RestTable.buildResponse(buildTable(request, clusterStateResponse, indicesStatsResponse), channel);
}
});
}
});
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:RestShardsAction.java
示例3: testNodeBasedClientCanConnectToES
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Test
public void testNodeBasedClientCanConnectToES() {
System.setProperty(ConfigurationConstants.PROPNAME_ES_CLIENT_TYPE, "node");
Configuration config = new SystemPropertiesConfiguration();
esServer = new ElasticSearchServer(clusterName,false);
assertTrue("Unable to start in memory elastic search", esServer.isSetup());
try {
ElasticSearchClientFactory factory = clientFactoryCreator.getElasticSearchClientConnectionFactory(config);
Client c = factory.getClient();
assertEquals(config.getStorageClusterName(), c.admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getClusterName().value());
assertNotNull(c.index(new IndexRequest("test", "test").source("name", "a")).actionGet().getId());
c.admin().indices().refresh(new RefreshRequest("test").force(true)).actionGet();
assertEquals(1, c.admin().indices().stats(new IndicesStatsRequest().indices("test")).actionGet().getTotal().docs.getCount());
} catch(Exception e) {
e.printStackTrace();
fail("Unable to connect to elasticsearch: " + e.getMessage());
}
}
开发者ID:tootedom,项目名称:related,代码行数:23,代码来源:NodeOrTransportBasedElasticSearchClientFactoryCreatorTest.java
示例4: updateIndicesStats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
/**
* Retrieve the latest indices stats, calling the listener when complete
* @return a latch that can be used to wait for the indices stats to complete if desired
*/
protected CountDownLatch updateIndicesStats(final ActionListener<IndicesStatsResponse> listener) {
final CountDownLatch latch = new CountDownLatch(1);
final IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.clear();
indicesStatsRequest.store(true);
client.admin().indices().stats(indicesStatsRequest, new LatchedActionListener<>(listener, latch));
return latch;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:InternalClusterInfoService.java
示例5: testIndicesStats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public void testIndicesStats() {
String indicesStats = IndicesStatsAction.NAME + "[n]";
interceptTransportActions(indicesStats);
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest().indices(randomIndicesOrAliases());
internalCluster().coordOnlyNodeClient().admin().indices().stats(indicesStatsRequest).actionGet();
clearInterceptedActions();
assertSameIndices(indicesStatsRequest, indicesStats);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:IndicesRequestIT.java
示例6: updateIndicesStats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
/**
* Retrieve the latest indices stats, calling the listener when complete
* @return a latch that can be used to wait for the indices stats to complete if desired
*/
protected CountDownLatch updateIndicesStats(final ActionListener<IndicesStatsResponse> listener) {
final CountDownLatch latch = new CountDownLatch(1);
final IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.clear();
indicesStatsRequest.store(true);
transportIndicesStatsAction.execute(indicesStatsRequest, new LatchedActionListener<>(listener, latch));
return latch;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:InternalClusterInfoService.java
示例7: getIndices
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public Set<String> getIndices() {
try {
return client.admin().indices().stats(new IndicesStatsRequest()).actionGet()
.getIndices().keySet();
} catch (NoNodeAvailableException e) {
throw new ODataRuntimeException("Elasticsearch has no node available.", e);
}
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:10,代码来源:ESConfigImpl.java
示例8: hasIndex
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public boolean hasIndex(String indexName) {
Set<String> indices = getClient().admin()
.indices()
.stats(new IndicesStatsRequest())
.actionGet()
.getIndices()
.keySet();
return indices.contains(indexName);
}
开发者ID:cestella,项目名称:streaming_outliers,代码行数:11,代码来源:ElasticSearchComponent.java
示例9: hasIndex
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public boolean hasIndex(String indexName) {
Set<String> indices = getClient().admin()
.indices()
.stats(new IndicesStatsRequest())
.actionGet()
.getIndices()
.keySet();
return indices.contains(indexName);
}
开发者ID:apache,项目名称:metron,代码行数:11,代码来源:ElasticSearchComponent.java
示例10: getIndexCount
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public int getIndexCount() {
try {
IndicesStatsResponse response = esClient.admin().indices().stats(new IndicesStatsRequest()).actionGet();
return response.getIndices().size();
} catch(Exception e) {
e.printStackTrace();
return -1;
}
}
开发者ID:tootedom,项目名称:related,代码行数:10,代码来源:ElasticSearchServer.java
示例11: getDocCount
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public int getDocCount(String indexName) {
try {
IndicesStatsResponse response = esClient.admin().indices().stats(new IndicesStatsRequest()).actionGet();
return (int)response.getIndex(indexName).getTotal().docs.getCount();
} catch(Exception e ) {
e.printStackTrace();
return -1;
}
}
开发者ID:tootedom,项目名称:related,代码行数:10,代码来源:ElasticSearchServer.java
示例12: toXContent
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
protected XContentBuilder toXContent(IndicesStatsRequest request, IndicesStatsResponse response, XContentBuilder builder) throws IOException {
builder.startObject();
builder.field(Fields.OK, true);
buildBroadcastShardsHeader(builder, response);
response.toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
return builder;
}
开发者ID:javanna,项目名称:elasticshell,代码行数:10,代码来源:StatsRequestBuilder.java
示例13: stats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public ActionFuture<IndicesStatsResponse> stats(final IndicesStatsRequest request) {
return execute(IndicesStatsAction.INSTANCE, request);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java
示例14: prepareRequest
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
indicesStatsRequest.types(Strings.splitStringByCommaToArray(request.param("types")));
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
// short cut, if no metrics have been specified in URI
if (metrics.size() == 1 && metrics.contains("_all")) {
indicesStatsRequest.all();
} else if (metrics.contains("_all")) {
throw new IllegalArgumentException(
String.format(Locale.ROOT,
"request [%s] contains _all and individual metrics [%s]",
request.path(),
request.param("metric")));
} else {
indicesStatsRequest.clear();
// use a sorted set so the unrecognized parameters appear in a reliable sorted order
final Set<String> invalidMetrics = new TreeSet<>();
for (final String metric : metrics) {
final Consumer<IndicesStatsRequest> consumer = METRICS.get(metric);
if (consumer != null) {
consumer.accept(indicesStatsRequest);
} else {
invalidMetrics.add(metric);
}
}
if (!invalidMetrics.isEmpty()) {
throw new IllegalArgumentException(unrecognized(request, invalidMetrics, METRICS.keySet(), "metric"));
}
}
if (request.hasParam("groups")) {
indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups")));
}
if (request.hasParam("types")) {
indicesStatsRequest.types(Strings.splitStringByCommaToArray(request.param("types")));
}
if (indicesStatsRequest.completion() && (request.hasParam("fields") || request.hasParam("completion_fields"))) {
indicesStatsRequest.completionFields(
request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY)));
}
if (indicesStatsRequest.fieldData() && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) {
indicesStatsRequest.fieldDataFields(
request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY)));
}
if (indicesStatsRequest.segments()) {
indicesStatsRequest.includeSegmentFileSizes(request.paramAsBoolean("include_segment_file_sizes", false));
}
return channel -> client.admin().indices().stats(indicesStatsRequest, new RestBuilderListener<IndicesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(IndicesStatsResponse response, XContentBuilder builder) throws Exception {
builder.startObject();
buildBroadcastShardsHeader(builder, request, response);
response.toXContent(builder, request);
builder.endObject();
return new BytesRestResponse(OK, builder);
}
});
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:69,代码来源:RestIndicesStatsAction.java
示例15: handleRequest
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
indicesStatsRequest.types(Strings.splitStringByCommaToArray(request.param("types")));
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
// short cut, if no metrics have been specified in URI
if (metrics.size() == 1 && metrics.contains("_all")) {
indicesStatsRequest.all();
} else {
indicesStatsRequest.clear();
indicesStatsRequest.docs(metrics.contains("docs"));
indicesStatsRequest.store(metrics.contains("store"));
indicesStatsRequest.indexing(metrics.contains("indexing"));
indicesStatsRequest.search(metrics.contains("search"));
indicesStatsRequest.get(metrics.contains("get"));
indicesStatsRequest.merge(metrics.contains("merge"));
indicesStatsRequest.refresh(metrics.contains("refresh"));
indicesStatsRequest.flush(metrics.contains("flush"));
indicesStatsRequest.warmer(metrics.contains("warmer"));
indicesStatsRequest.queryCache(metrics.contains("query_cache"));
indicesStatsRequest.percolate(metrics.contains("percolate"));
indicesStatsRequest.segments(metrics.contains("segments"));
indicesStatsRequest.fieldData(metrics.contains("fielddata"));
indicesStatsRequest.completion(metrics.contains("completion"));
indicesStatsRequest.suggest(metrics.contains("suggest"));
indicesStatsRequest.requestCache(metrics.contains("request_cache"));
indicesStatsRequest.recovery(metrics.contains("recovery"));
indicesStatsRequest.translog(metrics.contains("translog"));
}
if (request.hasParam("groups")) {
indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups")));
}
if (request.hasParam("types")) {
indicesStatsRequest.types(Strings.splitStringByCommaToArray(request.param("types")));
}
if (indicesStatsRequest.completion() && (request.hasParam("fields") || request.hasParam("completion_fields"))) {
indicesStatsRequest.completionFields(request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY)));
}
if (indicesStatsRequest.fieldData() && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) {
indicesStatsRequest.fieldDataFields(request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY)));
}
client.admin().indices().stats(indicesStatsRequest, new RestBuilderListener<IndicesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(IndicesStatsResponse response, XContentBuilder builder) throws Exception {
builder.startObject();
buildBroadcastShardsHeader(builder, request, response);
response.toXContent(builder, request);
builder.endObject();
return new BytesRestResponse(OK, builder);
}
});
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:61,代码来源:RestIndicesStatsAction.java
示例16: StatsRequestBuilder
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
public StatsRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
super(client, new IndicesStatsRequest(), jsonToString, stringToJson);
}
开发者ID:javanna,项目名称:elasticshell,代码行数:4,代码来源:StatsRequestBuilder.java
示例17: doExecute
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
@Override
protected ActionFuture<IndicesStatsResponse> doExecute(IndicesStatsRequest request) {
return client.admin().indices().stats(request);
}
开发者ID:javanna,项目名称:elasticshell,代码行数:5,代码来源:StatsRequestBuilder.java
示例18: getDocStats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
protected DocsStats getDocStats() {
IndicesStatsRequest request = new IndicesStatsRequest().docs(true);
IndicesStatsResponse response = client.admin().indices().stats(request).actionGet();
return response.getIndex("musicbrainz").getTotal().docs;
}
开发者ID:arey,项目名称:musicbrainz-elasticsearch,代码行数:6,代码来源:TestMusicAlbumJob.java
示例19: stats
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; //导入依赖的package包/类
/**
* Indices stats.
*/
ActionFuture<IndicesStatsResponse> stats(IndicesStatsRequest request);
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IndicesAdminClient.java
注:本文中的org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论