当前位置: 首页>>代码示例>>Java>>正文


Java Requests.indicesExistsRequest方法代码示例

本文整理汇总了Java中org.elasticsearch.client.Requests.indicesExistsRequest方法的典型用法代码示例。如果您正苦于以下问题:Java Requests.indicesExistsRequest方法的具体用法?Java Requests.indicesExistsRequest怎么用?Java Requests.indicesExistsRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.client.Requests的用法示例。


在下文中一共展示了Requests.indicesExistsRequest方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
  };

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:25,代码来源:TwitterUserstreamElasticsearchIT.java

示例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());
}
 
开发者ID:apache,项目名称:streams-examples,代码行数:20,代码来源:MongoElasticsearchSyncIT.java

示例3: testSync

import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@Test
public void testSync() throws Exception {

  MongoElasticsearchSync sync = new MongoElasticsearchSync(testConfiguration);

  sync.run();

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertTrue(indicesExistsResponse.isExists());

  // assert lines in file
  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getDestination().getIndex())
      .setTypes(testConfiguration.getDestination().getType());
  SearchResponse countResponse = countRequest.execute().actionGet();

  assertEquals(89, (int)countResponse.getHits().getTotalHits());

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:21,代码来源:MongoElasticsearchSyncIT.java

示例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/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());
  };
}
 
开发者ID:apache,项目名称:streams-examples,代码行数:24,代码来源:HdfsElasticsearchIT.java

示例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/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());
  };
}
 
开发者ID:apache,项目名称:streams-examples,代码行数:24,代码来源:TwitterHistoryElasticsearchIT.java

示例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/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));

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:38,代码来源:ElasticsearchReindexParentIT.java

示例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/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));

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:30,代码来源:ElasticsearchReindexIT.java

示例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/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);

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:30,代码来源:ElasticsearchReindexChildIT.java

示例9: 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);
}
 
开发者ID:apache,项目名称:streams-examples,代码行数:29,代码来源:ElasticsearchHdfsIT.java

示例10: ElasticsearchHdfsIT

import org.elasticsearch.client.Requests; //导入方法依赖的package包/类
@Test
public void ElasticsearchHdfsIT() throws Exception {

  HdfsElasticsearch restore = new HdfsElasticsearch(testConfiguration);

  restore.run();

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertTrue(indicesExistsResponse.isExists());

  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getDestination().getIndex())
      .setTypes(testConfiguration.getDestination().getType());
  SearchResponse countResponse = countRequest.execute().actionGet();

  assertEquals(countResponse.getHits().getTotalHits(), 89);

}
 
开发者ID:apache,项目名称:streams-examples,代码行数:20,代码来源:HdfsElasticsearchIT.java


注:本文中的org.elasticsearch.client.Requests.indicesExistsRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。