Package org.elasticsearch.action.count

Examples of org.elasticsearch.action.count.CountResponse


            sink.writeTo(new DefaultMessageContainer(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();

        node.client().admin().indices().prepareRefresh(index).execute().actionGet();
        CountResponse response = node.client().prepareCount(index).execute().actionGet();
        assertEquals(response.getCount(), 100);
    }
View Full Code Here


        for (int i = 0; i < msgCount; ++i) {
            sink.recover(i, request);
        }

        node.client().admin().indices().prepareRefresh(index).execute().actionGet();
        CountResponse response = node.client().prepareCount(index).execute().actionGet();
        assertEquals(response.getCount(), 100);
    }
View Full Code Here

  @Override
  public IndexStat getIndexStat() {
    CountRequestBuilder countRequest = client.prepareCount(this.getIndexName())
      .setTypes(this.getIndexType())
      .setQuery(QueryBuilders.matchAllQuery());
    CountResponse response = countRequest.get();
    return new IndexStat(getLastSynchronization(), response.getCount());
  }
View Full Code Here

        ShardOperationFailedException[] shardFailures = new ShardOperationFailedException[] {
                new DefaultShardOperationFailedException("dummy", 2,
                        new IndexShardException(new ShardId("dummy", 2), "dummy message"))
        };
        CountResponse countResponse = mock(CountResponse.class);
        when(countResponse.getFailedShards()).thenReturn(1);
        when(countResponse.getShardFailures()).thenReturn(shardFailures);

        listener.onResponse(countResponse);

        try {
            result.get();
View Full Code Here

        logger.info("  -> Wait for some docs");
        assertThat(awaitBusy(new Predicate<Object>() {
            public boolean apply(Object obj) {
                try {
                    refresh();
                    CountResponse response = client().prepareCount(getDbName()).get();
                    logger.info("  -> got {} docs in {} index", response.getCount(), getDbName());
                    return response.getCount() >= numDocs;
                } catch (IndexMissingException e) {
                    return false;
                }
            }
        }, 5, TimeUnit.MINUTES), equalTo(true));
View Full Code Here

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

            assertThat(getNode().client().admin().indices().prepareExists(getIndex()).get().isExists(), equalTo(true));
            CountResponse countResponse = getNode().client().count(countRequest(getIndex())).actionGet();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(0l));

            mongoCollection.remove(dbObject);

        } catch (Throwable t) {
            logger.error("testIgnoreScript failed.", t);
View Full Code Here

            mongoCollection.save(dbObject);

            Thread.sleep(wait);
            refreshIndex(getIndex());

            CountResponse countResponse = getNode().client().count(countRequest(getIndex())).actionGet();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(0l));

            mongoCollection.remove(dbObject);
        } catch (Throwable t) {
            logger.error("testDeleteDocument failed.", t);
            t.printStackTrace();
View Full Code Here

            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);
            t.printStackTrace();
            throw t;
        } finally {
View Full Code Here

            mongoCollection.save(dbObject);

            Thread.sleep(wait);
            refreshIndex(getIndex());

            CountResponse countResponse = getNode().client().count(countRequest(getIndex())).get();
            logger.info("Document count: {}", countResponse.getCount());
            assertThat(countResponse.getCount(), equalTo(0l));
        } catch (Throwable t) {
            logger.error("testDeleteDocument failed.", t);
            t.printStackTrace();
            throw t;
        } finally {
View Full Code Here

        Thread.sleep(wait);
        ActionFuture<IndicesExistsResponse> response = getNode().client().admin().indices()
                .exists(new IndicesExistsRequest(getIndex()));
        assertThat(response.actionGet().isExists(), equalTo(true));
        refreshIndex();
        CountResponse countResponse = getNode().client().count(countRequest(getIndex())).actionGet();
        assertThat(countResponse.getCount(), Matchers.equalTo(1L));
        try (DBCursor cursor = mongoDB.getSisterDB(LOCAL_DATABASE_NAME).getCollection(OPLOG_COLLECTION)
                .find().sort(new BasicDBObject("$natural", -1)).limit(1)) {
            DBObject lastOplog = cursor.toArray().get(0);
            assertThat(lastOplog.containsField("ref"), Matchers.is(Boolean.TRUE));
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.count.CountResponse

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.