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

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

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

origin: javanna/elasticshell

public CountRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
  super(client, new CountRequest(), jsonToString, stringToJson);
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> indices(String... indices) {
  request.indices(indices);
  return this;
}
origin: harbby/presto-connectors

/**
 * The minimum score of the documents to include in the count. Defaults to <tt>-1</tt> which means all
 * documents will be included in the count.
 */
public CountRequestBuilder setMinScore(float minScore) {
  request.minScore(minScore);
  return this;
}
origin: harbby/presto-connectors

@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
  CountRequest countRequest = new CountRequest(Strings.splitStringByCommaToArray(request.param("index")));
  countRequest.indicesOptions(IndicesOptions.fromRequest(request, countRequest.indicesOptions()));
  if (RestActions.hasBodyContent(request)) {
    countRequest.source(RestActions.getRestContent(request));
  } else {
    QuerySourceBuilder querySourceBuilder = RestActions.parseQuerySource(request);
    if (querySourceBuilder != null) {
      countRequest.source(querySourceBuilder);
  countRequest.routing(request.param("routing"));
  countRequest.minScore(request.paramAsFloat("min_score", DEFAULT_MIN_SCORE));
  countRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
  countRequest.preference(request.param("preference"));
    throw new IllegalArgumentException("terminateAfter must be > 0");
  } else if (terminateAfter > 0) {
    countRequest.terminateAfter(terminateAfter);
  client.search(countRequest.toSearchRequest(), new RestBuilderListener<SearchResponse>(channel) {
    @Override
    public RestResponse buildResponse(SearchResponse response, XContentBuilder builder) throws Exception {
origin: harbby/presto-connectors

  public SearchRequest toSearchRequest() {
    SearchRequest searchRequest = new SearchRequest(indices());
    searchRequest.indicesOptions(indicesOptions());
    searchRequest.types(types());
    searchRequest.routing(routing());
    searchRequest.preference(preference());
    searchRequest.source(source());
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    searchSourceBuilder.size(0);
    if (minScore() != DEFAULT_MIN_SCORE) {
      searchSourceBuilder.minScore(minScore());
    }
    if (terminateAfter() != DEFAULT_TERMINATE_AFTER) {
      searchSourceBuilder.terminateAfter(terminateAfter());
    }
    searchRequest.extraSource(searchSourceBuilder);
    return searchRequest;
  }
}
origin: harbby/presto-connectors

@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
  String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
  CountRequest countRequest = new CountRequest(indices);
  String source = request.param("source");
  if (source != null) {
    countRequest.source(source);
  } else {
    QuerySourceBuilder querySourceBuilder = RestActions.parseQuerySource(request);
    if (querySourceBuilder != null) {
      countRequest.source(querySourceBuilder);
    }
  }
  client.search(countRequest.toSearchRequest(), new RestResponseListener<SearchResponse>(channel) {
    @Override
    public RestResponse buildResponse(SearchResponse countResponse) throws Exception {
      return RestTable.buildResponse(buildTable(request, countResponse), channel);
    }
  });
}
origin: harbby/presto-connectors

/**
 * The routing values to control the shards that the search will be executed on.
 */
public CountRequestBuilder setRouting(String... routing) {
  request.routing(routing);
  return this;
}
origin: harbby/presto-connectors

/**
 * The types of documents the query will run against. Defaults to all types.
 */
public CountRequestBuilder setTypes(String... types) {
  request.types(types);
  return this;
}
origin: harbby/presto-connectors

/**
 * Sets the preference to execute the search. Defaults to randomize across shards. Can be set to
 * <tt>_local</tt> to prefer local shards, <tt>_primary</tt> to execute only on primary shards,
 * _shards:x,y to operate on shards x &amp; y, or a custom value, which guarantees that the same order
 * will be used across different requests.
 */
public CountRequestBuilder setPreference(String preference) {
  request.preference(preference);
  return this;
}
origin: harbby/presto-connectors

/**
 * The query source to execute.
 */
public CountRequestBuilder setSource(byte[] querySource) {
  request.source(querySource);
  return this;
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> queryBuilder(QueryBuilder queryBuilder) {
  request.query(queryBuilder);
  return this;
}
origin: harbby/presto-connectors

/**
 * A comma separated list of routing values to control the shards the search will be executed on.
 */
public CountRequestBuilder setRouting(String routing) {
  request.routing(routing);
  return this;
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> types(String... types) {
  request.types(types);
  return this;
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> preference(String preference) {
  request.preference(preference);
  return this;
}
origin: harbby/presto-connectors

@Override
protected CountRequest beforeExecute(CountRequest request) {
  if (sourceBuilder != null) {
    request.source(sourceBuilder);
  }
  return request;
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> query(JsonInput query) {
  request.query(jsonToString(query));
  return this;
}
origin: harbby/presto-connectors

public CountRequestBuilder(ElasticsearchClient client, CountAction action) {
  super(client, action, new CountRequest());
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> routing(String... routing) {
  request.routing(routing);
  return this;
}
origin: javanna/elasticshell

public CountRequestBuilder<JsonInput, JsonOutput> minScore(float minScore) {
  request.minScore(minScore);
  return this;
}
origin: harbby/presto-connectors

/**
 * The source to execute.
 */
public CountRequest source(byte[] querySource) {
  return source(querySource, 0, querySource.length);
}
org.elasticsearch.action.countCountRequest

Javadoc

A request to count the number of documents matching a specific query. Best created with org.elasticsearch.client.Requests#countRequest(String...).

The request requires the query source to be set either using #source(QuerySourceBuilder), or #source(byte[]).

Most used methods

  • <init>
    Constructs a new count request against the provided indices. No indices provided means it will run a
  • indices
  • minScore
    The minimum score of the documents to include in the count. Defaults to -1 which means all documents
  • preference
  • routing
    The routing values to control the shards that the search will be executed on.
  • types
    The types of documents the query will run against. Defaults to all types.
  • indicesOptions
  • query
  • source
    The source to execute.
  • terminateAfter
    Upon reaching terminateAfter counts, the count request will early terminate
  • toSearchRequest
  • toSearchRequest

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Path (java.nio.file)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top plugins for WebStorm
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