congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CountRequestBuilder
Code IndexAdd Tabnine to your IDE (free)

How to use
CountRequestBuilder
in
org.elasticsearch.action.count

Best Java code snippets using org.elasticsearch.action.count.CountRequestBuilder (Showing top 20 results out of 315)

Refine searchRefine arrow

  • CountResponse
  • Client
origin: richardwilly98/elasticsearch-river-mongodb

public static long getIndexCount(Client client, MongoDBRiverDefinition definition) {
  if (client.admin().indices().prepareExists(definition.getIndexName()).get().isExists()) {
    if (definition.isImportAllCollections()) {
      return client.prepareCount(definition.getIndexName()).execute().actionGet().getCount();
    } else {
      if (client.admin().indices().prepareTypesExists(definition.getIndexName()).setTypes(definition.getTypeName()).get()
          .isExists()) {
        return client.prepareCount(definition.getIndexName()).setTypes(definition.getTypeName()).get().getCount();
      }
    }
  }
  return 0;
}
origin: sirensolutions/siren-join

public void setupIndex() {
  log("==== INDEX SETUP ====");
  try {
    client.admin().indices().create(createIndexRequest(PARENT_INDEX)).actionGet();
    client.admin().indices().create(createIndexRequest(CHILD_INDEX)).actionGet();
    Thread.sleep(5000);
    int counter = 0;
    for (; i <= ITERS; i++) {
      BulkRequestBuilder request = client.prepareBulk();
      for (int j = 0; j < BATCH_SIZE; j++) {
        String parentId = Integer.toString(counter);
  client.admin().indices().prepareRefresh().execute().actionGet();
  log("Number of docs in index: " + client.prepareCount(PARENT_INDEX, CHILD_INDEX).setQuery(matchAllQuery()).execute().actionGet().getCount());
  log("");
origin: lordofthejars/nosql-unit

  private static long numberOfInsertedDocuments(Client client) {
    final CountResponse numberOfElements = client.prepareCount().execute().actionGet();
    return numberOfElements.getCount();
  }
}
origin: yandex-qatools/embedded-services

protected CountResponse count(String collectionName, QueryBuilder query) {
  return getClient().prepareCount()
      .setTypes(collectionName)
      .setQuery(query)
      .execute()
      .actionGet(initTimeout);
}
origin: com.bazaarvoice.elasticsearch.client/es-client-java-core

@Override public CountRequestBuilder prepareCount(final String... indices) {
  return new CountRequestBuilder(this).setIndices(indices);
}
origin: harbby/presto-connectors

/**
 * Constructs a new builder with a raw search query.
 */
public CountRequestBuilder setQuery(XContentBuilder query) {
  return setQuery(query.bytes());
}
origin: harbby/presto-connectors

  @Override
  public CountRequestBuilder newRequestBuilder(ElasticsearchClient client) {
    return new CountRequestBuilder(client, this);
  }
}
origin: sirensolutions/siren-join

public void setupIndex() {
  log("==== INDEX SETUP ====");
  try {
   client.admin().indices().create(createIndexRequest(PARENT_INDEX).mapping(PARENT_TYPE,
       "id", "type=string,index=not_analyzed,doc_values=true",
       "num", "type=integer,doc_values=true")).actionGet();
   client.admin().indices().create(createIndexRequest(CHILD_INDEX).mapping(CHILD_TYPE,
       "id", "type=string,index=not_analyzed,doc_values=true",
       "pid", "type=string,index=not_analyzed,doc_values=true",
    int counter = 0;
    for (; i <= ITERS; i++) {
      BulkRequestBuilder request = client.prepareBulk();
      for (int j = 0; j < BATCH_SIZE; j++) {
        String parentId = Integer.toString(counter);
  client.admin().indices().prepareRefresh().execute().actionGet();
  log("Number of docs in index: " + client.prepareCount(PARENT_INDEX, CHILD_INDEX).setQuery(matchAllQuery()).execute().actionGet().getCount());
  log("");
origin: com.github.tlrx/elasticsearch-test

@Override
public Long execute(Client client) throws ElasticsearchException {
  CountResponse response = client.prepareCount(indices).execute().actionGet();
  return response.getCount();
}
origin: ru.yandex.qatools.embed/embedded-services

protected CountResponse count(String collectionName, QueryBuilder query) {
  return getClient().prepareCount()
      .setTypes(collectionName)
      .setQuery(query)
      .execute()
      .actionGet(initTimeout);
}
origin: com.bazaarvoice.elasticsearch.client/es-rest-client-core-1.4

@Override public CountRequestBuilder prepareCount(final String... indices) {
  return new CountRequestBuilder(this).setIndices(indices);
}
origin: com.lordofthejars/nosqlunit-elasticsearch2

  private static long numberOfInsertedDocuments(Client client) {
    final CountResponse numberOfElements = client.prepareCount().execute().actionGet();
    return numberOfElements.getCount();
  }
}
origin: ujmp/universal-java-matrix-package

public int size() {
  MatchAllQueryBuilder query = QueryBuilders.matchAllQuery();
  CountResponse response = client.prepareCount(index).setTypes(type).setQuery(query).execute().actionGet();
  return MathUtil.longToInt(response.getCount());
}
origin: harbby/presto-connectors

@Override
public CountRequestBuilder prepareCount(String... indices) {
  deprecationLogger.deprecated("the count api is deprecated and will be removed from the java api in the next major version");
  return new CountRequestBuilder(this, CountAction.INSTANCE).setIndices(indices);
}
origin: com.github.joschi.nosqlunit/nosqlunit-elasticsearch2

  private static long numberOfInsertedDocuments(Client client) {
    final CountResponse numberOfElements = client.prepareCount().execute().actionGet();
    return numberOfElements.getCount();
  }
}
origin: alien4cloud/alien4cloud

@Override
public <T> long count(Class<T> clazz, QueryBuilder query) {
  String indexName = getIndexForType(clazz);
  String typeName = MappingBuilder.indexTypeFromClass(clazz);
  CountRequestBuilder countRequestBuilder = getClient().prepareCount(indexName).setTypes(typeName);
  if (query != null) {
    countRequestBuilder.setQuery(query);
  }
  return countRequestBuilder.execute().actionGet().getCount();
}
origin: lordofthejars/nosql-unit

private boolean isAnyIndexPresent() {
  CountResponse numberOfElements = client.prepareCount().execute().actionGet();
  return numberOfElements.getCount() > 0;
}
origin: ujmp/universal-java-matrix-package

public int count(String string) {
  QueryBuilder query = QueryBuilders.queryString(string).defaultOperator(Operator.AND);
  CountResponse response = client.prepareCount(index).setTypes(type).setQuery(query).execute().actionGet();
  return MathUtil.longToInt(response.getCount());
}
origin: tlrx/elasticsearch-test

@Override
public Long execute(Client client) throws ElasticsearchException {
  CountResponse response = client.prepareCount(indices).execute().actionGet();
  return response.getCount();
}
origin: Yorubaname/yorubaname-website

@Override
public Integer getSearchableNames() {
  try {
    CountResponse response = client.prepareCount(esConfig.getIndexName())
        .setQuery(matchAllQuery())
        .execute()
        .actionGet();
    return Math.toIntExact(response.getCount());
  } catch (Exception e) {
    return 0;
  }
}
org.elasticsearch.action.countCountRequestBuilder

Javadoc

A count action request builder.

Most used methods

  • execute
  • setQuery
  • setTypes
  • <init>
  • setIndices
  • beforeExecute
  • get
  • request
  • sourceBuilder

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JPanel (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now