Package org.elasticsearch.action.admin.indices.exists.indices

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


    /**
     * Returns <code>true</code> iff the given index exists otherwise <code>false</code>
     */
    protected boolean indexExists(String index) {
        IndicesExistsResponse actionGet = client().admin().indices().prepareExists(index).execute().actionGet();
        return actionGet.isExists();
    }
View Full Code Here


  @Test
  public void test_settings_without_mapping() {
    Client client = checkClient();

    // We should have an existing index here
        IndicesExistsResponse ier = client.admin().indices().prepareExists("twitter").execute().actionGet();
        assertThat(ier.isExists(), is(true));
    }
View Full Code Here

            WriteResult result = mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(getIndex());

            IndicesExistsResponse response = getNode().client().admin().indices().prepareExists(getIndex()).get();
            assertThat(response.isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().count(countRequest(getIndex())).get();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(0l));
        } catch (Throwable t) {
            logger.error("testIgnoreScript failed.", t);
View Full Code Here

            Thread.sleep(wait);
            String id = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(getIndex());

            IndicesExistsResponse response = getNode().client().admin().indices().prepareExists(getIndex()).get();
            assertThat(response.isExists(), equalTo(true));

            SearchResponse sr = getNode().client().prepareSearch(getIndex()).setQuery(QueryBuilders.queryString(id).defaultField("_id")).get();
            logger.debug("SearchResponse {}", sr.toString());
            long totalHits = sr.getHits().getTotalHits();
            logger.debug("TotalHits: {}", totalHits);
View Full Code Here

            Thread.sleep(wait);
            String id = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(getIndex());

            IndicesExistsResponse response = getNode().client().admin().indices().prepareExists(getIndex()).get();
            assertThat(response.isExists(), equalTo(true));

            SearchResponse sr = getNode().client().prepareSearch(getIndex()).setQuery(QueryBuilders.queryString(id).defaultField("_id")).get();
            logger.debug("SearchResponse {}", sr.toString());
            long totalHits = sr.getHits().getTotalHits();
            logger.debug("TotalHits: {}", totalHits);
View Full Code Here

    protected void deleteIndex(String name) {
        int max = 5;
        int count = 0;
        logger.info("Delete index [{}]", name);
        IndicesExistsResponse response = node.client().admin().indices().prepareExists(name).get();
        if (!response.isExists()) {
            logger.info("Index {} does not exist", name);
            return;
        }
        if (!node.client().admin().indices().prepareDelete(name).execute().actionGet().isAcknowledged()) {
            response = node.client().admin().indices().prepareExists(name).get();
            while (response.isExists()) {
                logger.debug("Index {} not deleted. Try waiting 1 sec...", name);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
View Full Code Here

        }
    }

    private void canIndexExists(String index) {
        try {
            IndicesExistsResponse r = client().admin().indices().prepareExists(index).execute().actionGet();
            assertThat(r, notNullValue());
        } catch (ClusterBlockException e) {
            fail();
        }
    }
View Full Code Here

        }
    }

    private void canNotIndexExists(String index) {
        try {
            IndicesExistsResponse r = client().admin().indices().prepareExists(index).execute().actionGet();
            fail();
        } catch (ClusterBlockException e) {
            // all is well
        }
    }
View Full Code Here

        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

TOP

Related Classes of org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse

Copyright © 2018 www.massapicom. 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.