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


Java CountResponse类代码示例

本文整理汇总了Java中org.elasticsearch.action.count.CountResponse的典型用法代码示例。如果您正苦于以下问题:Java CountResponse类的具体用法?Java CountResponse怎么用?Java CountResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CountResponse类属于org.elasticsearch.action.count包,在下文中一共展示了CountResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEsContent

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
protected void testEsContent(Client client) throws SQLException {
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    CountResponse countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "user"))
            .execute().actionGet();
    Assert.assertEquals(11, countResponse.getCount());

    countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "training"))
            .execute().actionGet();
    Assert.assertEquals(55, countResponse.getCount());

    countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "exercise"))
            .execute().actionGet();
    Assert.assertEquals(275, countResponse.getCount());
}
 
开发者ID:presidentio,项目名称:test-data-generator,代码行数:19,代码来源:EsFileTest.java

示例2: testEsContent

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
protected void testEsContent(Client client) {
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    CountResponse countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "user"))
            .execute().actionGet();
    Assert.assertEquals(11, countResponse.getCount());

    countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "training"))
            .execute().actionGet();
    Assert.assertEquals(55, countResponse.getCount());

    countResponse = client.prepareCount(indexName).setQuery(QueryBuilders.termQuery("_type", "exercise"))
            .execute().actionGet();
    Assert.assertEquals(275, countResponse.getCount());
}
 
开发者ID:presidentio,项目名称:test-data-generator,代码行数:19,代码来源:EsDirectTest.java

示例3: existSomeDocs

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
private void existSomeDocs(final String index, final String source, int timetoWaitInSec, final int expectedDocs)
		throws InterruptedException {
	
	assertThat("Documents exist",
			awaitBusy(new Predicate<Object>() {
				@Override
				public boolean apply(Object o) {
					QueryBuilder query;
					if (source == null) {
						query = QueryBuilders.matchAllQuery();
					} else {
						query = QueryBuilders.queryString(source).defaultField("id");
					}
					CountResponse response = client().prepareCount(index)
							.setQuery(query).execute().actionGet();
					System.out.println("FLORIAN: " + response.getCount());
					return response.getCount() == expectedDocs;
				}
			}, timetoWaitInSec, TimeUnit.SECONDS), equalTo(true));
}
 
开发者ID:frosenberg,项目名称:elasticsearch-nvd-river,代码行数:21,代码来源:NvdRiverIntegrationTest.java

示例4: countRequest

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
/**
 * With retry
 */
public static long countRequest(final String index, final QueryBuilder query, final String... types) {
	CountResponse response = withRetry(new ElasticsearchWithRetry<CountResponse>() {
		public CountResponse call(Client client) throws NoNodeAvailableException {
			CountRequestBuilder request_builder = new CountRequestBuilder(client);
			request_builder.setIndices(index);
			request_builder.setTypes(types);
			request_builder.setQuery(query);
			return request_builder.execute().actionGet();
		}
	});
	if (response == null) {
		return 0;
	}
	return response.getCount();
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:19,代码来源:Elasticsearch.java

示例5: count

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@Override
public ActionFuture<CountResponse> count(final CountRequest request) {
    AdapterActionFuture<CountResponse, SearchResponse> actionFuture = new AdapterActionFuture<CountResponse, SearchResponse>() {
        @Override
        protected CountResponse convert(SearchResponse listenerResponse) {
            return new CountResponse(listenerResponse);
        }
    };
    deprecationLogger.deprecated("the count api is deprecated and will be removed from the java api in the next major version");
    execute(SearchAction.INSTANCE, request.toSearchRequest(), actionFuture);
    return actionFuture;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:AbstractClient.java

示例6: count

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
/**
 *
 * @return number of all Assets in the index.
 */
@Override
public long count() {
    CountResponse countResponse = client.prepareCount(indexName)
            .setQuery(termQuery("_type", documentType))
            .execute()
            .actionGet();

    return countResponse.getCount();
}
 
开发者ID:aweisser,项目名称:tdd-dojos.dojo1,代码行数:14,代码来源:EsAssetSearchIndex.java

示例7: getPendingDocuments

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@Override
public int getPendingDocuments() {
    try {
        CountResponse response = client.prepareCount(indexName)
                .setQuery(filteredQuery(matchAllQuery(), orFilter(
                        missingFilter(SearchService.FIELD_INDEXED),
                        termFilter(SearchService.FIELD_INDEXED, false))))
                .execute()
                .actionGet();
        return (int) response.getCount();
    } catch (Exception e) {
        getLog().error("Problem getting pending docs for index builder [" + getName() + "]", e);
    }
    return 0;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:BaseElasticSearchIndexBuilder.java

示例8: getNDocs

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@Override
public int getNDocs() {
    assureIndex();
    CountResponse response = client.prepareCount(indexName)
            .setQuery(filteredQuery(matchAllQuery(),termFilter(SearchService.FIELD_INDEXED, true)))
            .execute()
            .actionGet();
    return (int) response.getCount();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:BaseElasticSearchIndexBuilder.java

示例9: count

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
public long count(BaseQueryBuilder xqb) throws Exception {
  CountResponse response =
      esclient.client.prepareCount(index).
          setQuery(xqb).
          execute().actionGet();
  return response.getCount();
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:8,代码来源:ESObjectClient.java

示例10: infiniteTest

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
/**
 * I use this test for a shell like experience, has to be cancelled manually.
 */
// @Test
public void infiniteTest() throws InterruptedException {
    Thread.sleep(200); // allow river to start
    while (true) {
        Thread.sleep(200); // time for poller to index
        refreshIndex();
        CountResponse
                resp =
                node.client().count(countRequest(index).types(type).source(queryString("mowbray").defaultField("manager").toString())).actionGet();
        logger.debug("How many moggas? {} !", resp.getCount());
    }
}
 
开发者ID:sksamuel,项目名称:elasticsearch-river-neo4j,代码行数:16,代码来源:Neo4jRiverIntTest.java

示例11: waitForUpdateCompletion

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@SneakyThrows({InterruptedException.class})
protected void waitForUpdateCompletion(int inv) {
  while(true){
    CountRequestBuilder countRequestBuilder = client.prepareCount (dummyIndexName (getNUMROWS(), getNUMCOLS(), inv)).setTypes (getDocumentType ());
    CountResponse countResponse = countRequestBuilder.execute ().actionGet ();
    if(countResponse.getCount ()==getNUMROWS ())
      break;
    Thread.sleep (500);
  }
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:11,代码来源:PerfTestNumerify_AllTypes_Base.java

示例12: waitForUpdateCompletion

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@SneakyThrows({InterruptedException.class})
protected void waitForUpdateCompletion() {
  while(true){
    CountRequestBuilder countRequestBuilder = client.prepareCount (adminHelper.dummyName (getNUMROWS(), getNUMCOLS())).setTypes (getDocumentType ());
    CountResponse countResponse = countRequestBuilder.execute ().actionGet ();
    if(countResponse.getCount ()==getNUMROWS ())
      break;
    Thread.sleep (500);
  }
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:11,代码来源:PerfTestNumerify_Touch_Base.java

示例13: testDefaultArgument

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@Test
public void testDefaultArgument() throws IOException {
    String index = "topic";

    createDefaultESSink(index);

    refresh();
    CountResponse countResponse = client().count(new CountRequest(index)).actionGet();
    assertEquals(countResponse.getCount(), 100);
}
 
开发者ID:Netflix,项目名称:suro,代码行数:11,代码来源:TestElasticSearchSink.java

示例14: count

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
@Override
public CountResponse count(String[] indices, String... types) {
    CountRequestBuilder countRequestBuilder = esClient.getClient().prepareCount(indices);
    if (types != null && types.length > 0) {
        countRequestBuilder.setTypes(types);
    }
    countRequestBuilder.setQuery(this.queryBuilder);
    return countRequestBuilder.execute().actionGet();
}
 
开发者ID:alien4cloud,项目名称:elasticsearch-mapping-parent,代码行数:10,代码来源:QueryHelper.java

示例15: getDocumentCount

import org.elasticsearch.action.count.CountResponse; //导入依赖的package包/类
public long getDocumentCount() throws Exception {
    try (Client client = getClient()) {
        client.admin().indices().refresh(new RefreshRequest(INDEX_NAME)).actionGet();

        ActionFuture<CountResponse> response = client.count(new CountRequest(INDEX_NAME).types(DOCUMENT_TYPE));
        CountResponse countResponse = response.get();
        return countResponse.getCount();
    }
}
 
开发者ID:datacleaner,项目名称:extension_elasticsearch,代码行数:10,代码来源:ElasticSearchTestServer.java


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