本文整理汇总了Java中org.elasticsearch.client.Requests.clusterHealthRequest方法的典型用法代码示例。如果您正苦于以下问题:Java Requests.clusterHealthRequest方法的具体用法?Java Requests.clusterHealthRequest怎么用?Java Requests.clusterHealthRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.client.Requests
的用法示例。
在下文中一共展示了Requests.clusterHealthRequest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/TwitterUserstreamElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(TwitterUserstreamElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例2: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/MongoElasticsearchSyncIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertFalse(indicesExistsResponse.isExists());
}
示例3: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/HdfsElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(HdfsElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getDestination().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例4: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/TwitterHistoryElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(TwitterHistoryElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例5: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexParentIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertTrue(indicesExistsResponse.isExists());
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
PutIndexTemplateRequestBuilder putTemplateRequestBuilder = testClient.admin().indices().preparePutTemplate("mappings");
URL templateURL = ElasticsearchParentChildWriterIT.class.getResource("/ActivityChildObjectParent.json");
ObjectNode template = MAPPER.readValue(templateURL, ObjectNode.class);
String templateSource = MAPPER.writeValueAsString(template);
putTemplateRequestBuilder.setSource(templateSource);
testClient.admin().indices().putTemplate(putTemplateRequestBuilder.request()).actionGet();
assertThat(count, not(0));
}
示例6: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertThat(count, not(0));
}
示例7: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexChildIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertNotEquals(count, 0);
}
示例8: prepareTest
import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchHdfsIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchHdfsConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertNotEquals(count, 0);
}