Examples of IndicesExistsResponse


Examples of org.elasticsearch.action.admin.indices.exists.IndicesExistsResponse

        RefreshResponse refreshResponse = client1.admin().indices().prepareRefresh("test").execute().actionGet();
        assertThat(refreshResponse.successfulShards(), equalTo(10));
        assertThat(refreshResponse.failedShards(), equalTo(0));

        logger.info("--> index exists?");
        IndicesExistsResponse indicesExistsResponse = client1.admin().indices().prepareExists(getConcreteIndexName()).execute().actionGet();
        assertThat(indicesExistsResponse.exists(), equalTo(true));

        logger.info("--> index exists?, fake index");
        indicesExistsResponse = client1.admin().indices().prepareExists("test1234565").execute().actionGet();
        assertThat(indicesExistsResponse.exists(), equalTo(false));

        logger.info("Clearing cache");
        ClearIndicesCacheResponse clearIndicesCacheResponse = client1.admin().indices().clearCache(clearIndicesCacheRequest("test")).actionGet();
        assertThat(clearIndicesCacheResponse.successfulShards(), equalTo(10));
        assertThat(clearIndicesCacheResponse.failedShards(), equalTo(0));
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

    }

    private void createRobotIndex() {
        final String robotIndexName = SingletonS2Container
                .getComponent("robotIndexName");
        final IndicesExistsResponse indicesExistsResponse = client.admin()
                .indices().prepareExists(robotIndexName).execute().actionGet();
        if (!indicesExistsResponse.isExists()) {
            final CreateIndexResponse createIndexResponse = client.admin()
                    .indices().prepareCreate(robotIndexName).execute()
                    .actionGet();
            if (createIndexResponse.isAcknowledged()) {
                try {
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

    @Override
    public String databaseExists(String database) {
        String index = getElasticSearchIndexNameFromDatabase(database);
        IndicesExistsRequestBuilder existsBuilder = client.admin().indices().prepareExists(index);
        IndicesExistsResponse response = existsBuilder.execute().actionGet();
        if(response.isExists()) {
            String uuid = getBucketUUIDFromDatabase(database);
            if(uuid != null) {
                logger.debug("included uuid, validating");
                String actualUUID = getBucketUUID("default", index);
                if(!uuid.equals(actualUUID)) {
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

        }
    }

    public String getVBucketUUID(String pool, String bucket, int vbucket) {
        IndicesExistsRequestBuilder existsBuilder = client.admin().indices().prepareExists(bucket);
        IndicesExistsResponse response = existsBuilder.execute().actionGet();
        if(response.isExists()) {
            int tries = 0;
            String key = String.format("vbucket%dUUID",vbucket);
            String bucketUUID = this.lookupUUID(bucket, key);
            while(bucketUUID == null && tries < 100) {
                logger.debug("vbucket {} UUID doesn't exist yet,  creaating", vbucket);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

            return bucketUUID;
        }

        logger.debug("bucket UUID not in cache, looking up");
        IndicesExistsRequestBuilder existsBuilder = client.admin().indices().prepareExists(bucket);
        IndicesExistsResponse response = existsBuilder.execute().actionGet();
        if(response.isExists()) {
            int tries = 0;
            bucketUUID = this.lookupUUID(bucket, "bucketUUID");
            while(bucketUUID == null && tries < 100) {
                logger.debug("bucket UUID doesn't exist yet, creaating, attempt: {}", tries+1);
                String newUUID = UUID.randomUUID().toString().replace("-", "");
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

            return bucketUUID;
        }

        logger.debug("bucket UUID not in cache, looking up");
        IndicesExistsRequestBuilder existsBuilder = client.admin().indices().prepareExists(bucket);
        IndicesExistsResponse response = existsBuilder.execute().actionGet();
        if(response.isExists()) {
            int tries = 0;
            bucketUUID = this.lookupUUID(bucket, "bucketUUID");
            while(bucketUUID == null && tries < 100) {
                logger.debug("bucket UUID doesn't exist yet, creaating, attempt: {}", tries+1);
                String newUUID = UUID.randomUUID().toString().replace("-", "");
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

        Client client = IndexClient.client;
        AdminClient admin = client.admin();
        IndicesAdminClient indices = admin.indices();
        IndicesExistsRequestBuilder indicesExistsRequestBuilder = indices.prepareExists(indexName);
        IndicesExistsResponse response = indicesExistsRequestBuilder.execute().actionGet();

        return response.isExists();
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

    assertIndex(index);
    _client.addStore(this);
  }

  void assertIndex(Esi4JIndex index) {
    IndicesExistsResponse existsResponse = _client.getClient().admin().indices().prepareExists(_indexName)
        .execute().actionGet();

    if (!existsResponse.isExists()) {
      // create index
      CreateIndexRequestBuilder request = _client.getClient().admin().indices().prepareCreate(_indexName);

      Settings settings = getStoreSettings(index);
      if (settings != null) {
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

  /* Cluster And ES Stats/Client methods */

  protected void initializeIndex() {
    String index = this.getIndexName();

    IndicesExistsResponse indexExistsResponse = client.prepareExists(index).get();
    try {

      if (!indexExistsResponse.isExists()) {
        LOG.debug("Setup of {} for type {}", this.getIndexName(), this.getIndexType());
        client.prepareCreate(index)
          .setSettings(getIndexSettings())
          .get();
      }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

  @Test
  public void creates_domain_index() {
    BaseIndex index = getIndex(this.searchClient);

    IndicesExistsResponse indexExistsResponse = index.getClient().admin().indices()
      .prepareExists(IndexDefinition.TEST.getIndexName()).execute().actionGet();

    assertThat(indexExistsResponse.isExists()).isTrue();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.