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

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


            WriteResult result = mongoDB.getCollection(collection1).insert(dbObject);
            Thread.sleep(wait);
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(index1);

            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices().exists(new IndicesExistsRequest(index1));
            assertThat(response.actionGet().isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().count(countRequest(index1)).actionGet();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(0l));
            mongoDB.getCollection(collection1).remove(dbObject);

            mongoDocument = copyToStringFromClasspath(TEST_SIMPLE_MONGODB_DOCUMENT_JSON);
            dbObject = (DBObject) JSON.parse(mongoDocument);
            result = mongoDB.getCollection(collection2).insert(dbObject);
            Thread.sleep(wait);
            String id = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(index2);

            response = getNode().client().admin().indices().exists(new IndicesExistsRequest(index2));
            assertThat(response.actionGet().isExists(), equalTo(true));

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


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

            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices().exists(new IndicesExistsRequest(index));
            assertThat(response.actionGet().isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().count(countRequest(index)).actionGet();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(2l));
View Full Code Here

            String authorId = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(INDEX_NAME);

            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                    .exists(new IndicesExistsRequest(INDEX_NAME));
            assertThat(response.actionGet().isExists(), equalTo(true));

            SearchResponse sr = getNode().client().prepareSearch(INDEX_NAME).setQuery(QueryBuilders.queryString(authorId).defaultField("_id")).execute().actionGet();
            logger.debug("SearchResponse {}", sr.toString());
            long totalHits = sr.getHits().getTotalHits();
            logger.debug("TotalHits: {}", totalHits);
            assertThat(totalHits, equalTo(1l));

            String book1Document = copyToStringFromClasspath(BOOK1_DOCUMENT_JSON);
            dbObject = (DBObject) JSON.parse(book1Document);
            result = mongoBooksCollection.insert(dbObject);
            Thread.sleep(wait);
            String bookId = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            refreshIndex(INDEX_NAME);

            response = getNode().client().admin().indices().exists(new IndicesExistsRequest(INDEX_NAME));
            assertThat(response.actionGet().isExists(), equalTo(true));

            sr = getNode().client().prepareSearch(INDEX_NAME).setQuery(QueryBuilders.queryString(bookId).defaultField("_id")).execute().actionGet();
            logger.debug("SearchResponse {}", sr.toString());
            totalHits = sr.getHits().getTotalHits();
View Full Code Here

            WriteResult result = mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            String id = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                    .exists(new IndicesExistsRequest(getIndex()));
            assertThat(response.actionGet().isExists(), equalTo(true));
            refreshIndex();
            SearchRequest search = getNode().client().prepareSearch(getIndex())
                    .setQuery(QueryBuilders.queryString("5194272CFDEA65E5D6000021").defaultField("category.id")).request();
            SearchResponse searchResponse = getNode().client().search(search).actionGet();
View Full Code Here

            String mongoDocument = copyToStringFromClasspath(TEST_SIMPLE_MONGODB_DOCUMENT_JSON);
            DBObject dbObject = (DBObject) JSON.parse(mongoDocument);
            mongoCollection.insert(dbObject);
            Thread.sleep(wait);

            assertThat(getNode().client().admin().indices().exists(new IndicesExistsRequest(getIndex())).actionGet().isExists(),
                    equalTo(true));
            assertThat(getNode().client().admin().indices().prepareTypesExists(getIndex()).setTypes(getDatabase()).execute().actionGet()
                    .isExists(), equalTo(true));
            String collectionName = mongoCollection.getName();
            long countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
View Full Code Here

            String mongoDocument = copyToStringFromClasspath(TEST_SIMPLE_MONGODB_DOCUMENT_JSON);
            DBObject dbObject = (DBObject) JSON.parse(mongoDocument);
            mongoCollection.insert(dbObject);
            Thread.sleep(wait);

            assertThat(getNode().client().admin().indices().exists(new IndicesExistsRequest(getIndex())).actionGet().isExists(),
                    equalTo(true));
            assertThat(getNode().client().admin().indices().prepareTypesExists(getIndex()).setTypes(getDatabase()).execute().actionGet()
                    .isExists(), equalTo(true));
            String collectionName = mongoCollection.getName();
            long countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
            mongoCollection.drop();
            Thread.sleep(wait);
            assertThat(mongoDB.collectionExists(collectionName), equalTo(false));
            Thread.sleep(wait);
            refreshIndex();
            if (!dropCollectionOption) {
                countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
                assertThat(countRequest, greaterThan(0L));
            } else {
                countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
                assertThat(countRequest, equalTo(0L));
            }
            dbObject = (DBObject) JSON.parse(mongoDocument);
            String value = String.valueOf(System.currentTimeMillis());
            dbObject.put("attribute1", value);
            mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            assertThat(getNode().client().admin().indices().exists(new IndicesExistsRequest(getIndex())).actionGet().isExists(),
                    equalTo(true));
            assertThat(getNode().client().admin().indices().prepareTypesExists(getIndex()).setTypes(getDatabase()).execute().actionGet()
                    .isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().prepareCount(getIndex())
                    .setQuery(QueryBuilders.queryString(value).defaultField("attribute1")).get();
View Full Code Here

            String mongoDocument = copyToStringFromClasspath(TEST_SIMPLE_MONGODB_DOCUMENT_JSON);
            DBObject dbObject = (DBObject) JSON.parse(mongoDocument);
            mongoCollection.insert(dbObject);
            Thread.sleep(wait);

            assertThat(getNode().client().admin().indices().exists(new IndicesExistsRequest(getIndex())).actionGet().isExists(),
                    equalTo(true));
            assertThat(getNode().client().admin().indices().prepareTypesExists(getIndex()).setTypes(getDatabase()).execute().actionGet()
                    .isExists(), equalTo(true));
            long countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
            mongoDB.dropDatabase();
            Thread.sleep(wait);
            assertThat(databaseExists(getDatabase()), equalTo(false));
            Thread.sleep(wait);
            refreshIndex();

            if (!dropCollectionOption) {
                countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
                assertThat(countRequest, greaterThan(0L));
            } else {
                countRequest = getNode().client().count(countRequest(getIndex())).actionGet().getCount();
                assertThat(countRequest, equalTo(0L));
            }
            mongoDB = getMongo().getDB(getDatabase());
            mongoCollection = mongoDB.createCollection(getCollection(), null);
            dbObject = (DBObject) JSON.parse(mongoDocument);
            String value = String.valueOf(System.currentTimeMillis());
            dbObject.put("attribute1", value);
            mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            assertThat(getNode().client().admin().indices().exists(new IndicesExistsRequest(getIndex())).actionGet().isExists(),
                    equalTo(true));
            assertThat(getNode().client().admin().indices().prepareTypesExists(getIndex()).setTypes(getDatabase()).execute().actionGet()
                    .isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().prepareCount(getIndex())
                    .setQuery(QueryBuilders.queryString(value).defaultField("attribute1")).get();
View Full Code Here

            WriteResult result = mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                    .exists(new IndicesExistsRequest(getIndex()));
            assertThat(response.actionGet().isExists(), equalTo(true));
            refreshIndex();
            SearchRequest search = getNode().client().prepareSearch(getIndex()).setQuery(new QueryStringQueryBuilder("Richard").defaultField("name"))
                    .request();
            SearchResponse searchResponse = getNode().client().search(search).actionGet();
View Full Code Here

            WriteResult result = mongoCollection.insert(dbObject);
            Thread.sleep(wait);
            String id = dbObject.get("_id").toString();
            logger.info("WriteResult: {}", result.toString());
            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                    .exists(new IndicesExistsRequest(getIndex()));
            assertThat(response.actionGet().isExists(), equalTo(true));
            refreshIndex();
            SearchRequest search = getNode().client().prepareSearch(getIndex()).setQuery(QueryBuilders.queryString("Richard").defaultField("name"))
                    .request();
            SearchResponse searchResponse = getNode().client().search(search).actionGet();
View Full Code Here

            createRiver(filter);
            Thread.sleep(wait);

            ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                    .exists(new IndicesExistsRequest(getIndex()));
            assertThat(response.actionGet().isExists(), equalTo(true));
            refreshIndex();
            assertThat(getNode().client().count(countRequest(getIndex())).actionGet().getCount(), equalTo(1l));
        } catch (Throwable t) {
            logger.error("CollectionFilter failed.", t);
View Full Code Here

TOP

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

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.