Class CountRequest.Builder

All Implemented Interfaces:
WithJson<CountRequest.Builder>, ObjectBuilder<CountRequest>
Enclosing class:
CountRequest

public static class CountRequest.Builder extends RequestBase.AbstractBuilder<CountRequest.Builder> implements ObjectBuilder<CountRequest>
Builder for CountRequest.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • allowNoIndices

      public final CountRequest.Builder allowNoIndices(@Nullable Boolean value)
      A setting that does two separate checks on the index expression. If false, the request returns an error (1) if any wildcard expression (including _all and *) resolves to zero matching indices or (2) if the complete set of resolved indices, aliases or data streams is empty after all expressions are evaluated. If true, index expressions that resolve to no indices are allowed and the request returns an empty result.

      API name: allow_no_indices

    • analyzeWildcard

      public final CountRequest.Builder analyzeWildcard(@Nullable Boolean value)
      If true, wildcard and prefix queries are analyzed. This parameter can be used only when the q query string parameter is specified.

      API name: analyze_wildcard

    • analyzer

      public final CountRequest.Builder analyzer(@Nullable String value)
      The analyzer to use for the query string. This parameter can be used only when the q query string parameter is specified.

      API name: analyzer

    • defaultOperator

      public final CountRequest.Builder defaultOperator(@Nullable Operator value)
      The default operator for query string query: and or or. This parameter can be used only when the q query string parameter is specified.

      API name: default_operator

    • df

      public final CountRequest.Builder df(@Nullable String value)
      The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the q query string parameter is specified.

      API name: df

    • expandWildcards

      public final CountRequest.Builder expandWildcards(List<ExpandWildcard> list)
      The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as open,hidden.

      API name: expand_wildcards

      Adds all elements of list to expandWildcards.

    • expandWildcards

      public final CountRequest.Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values)
      The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such as open,hidden.

      API name: expand_wildcards

      Adds one or more values to expandWildcards.

    • ignoreThrottled

      @Deprecated public final CountRequest.Builder ignoreThrottled(@Nullable Boolean value)
      Deprecated.
      7.16.0
      If true, concrete, expanded, or aliased indices are ignored when frozen.

      API name: ignore_throttled

    • ignoreUnavailable

      public final CountRequest.Builder ignoreUnavailable(@Nullable Boolean value)
      If false, the request returns an error if it targets a concrete (non-wildcarded) index, alias, or data stream that is missing, closed, or otherwise unavailable. If true, unavailable concrete targets are silently ignored.

      API name: ignore_unavailable

    • index

      public final CountRequest.Builder index(List<String> list)
      A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use * or _all.

      API name: index

      Adds all elements of list to index.

    • index

      public final CountRequest.Builder index(String value, String... values)
      A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use * or _all.

      API name: index

      Adds one or more values to index.

    • lenient

      public final CountRequest.Builder lenient(@Nullable Boolean value)
      If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the q query string parameter is specified.

      API name: lenient

    • minScore

      public final CountRequest.Builder minScore(@Nullable Double value)
      The minimum _score value that documents must have to be included in the result.

      API name: min_score

    • preference

      public final CountRequest.Builder preference(@Nullable String value)
      The node or shard the operation should be performed on. By default, it is random.

      API name: preference

    • projectRouting

      public final CountRequest.Builder projectRouting(@Nullable String value)
      Specifies a subset of projects to target using project metadata tags in a subset of Lucene query syntax. Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project _alias:_origin _alias:pr Supported in serverless only.

      API name: project_routing

    • q

      public final CountRequest.Builder q(@Nullable String value)
      The query in Lucene query string syntax. This parameter cannot be used with a request body.

      API name: q

    • query

      public final CountRequest.Builder query(@Nullable Query value)
      Defines the search query using Query DSL. A request body query cannot be used with the q query string parameter.

      API name: query

    • query

      Defines the search query using Query DSL. A request body query cannot be used with the q query string parameter.

      API name: query

    • query

      public final CountRequest.Builder query(QueryVariant value)
      Defines the search query using Query DSL. A request body query cannot be used with the q query string parameter.

      API name: query

    • routeSlice

      public final CountRequest.Builder routeSlice(@Nullable String value)
      The slice identifier used to route the operation to a specific slice. Use the special value _all to target all slices without restricting to a routing value. Required when index.slice.enabled is true for the target index; not allowed when index.slice.enabled is false.

      API name: _slice

    • routing

      public final CountRequest.Builder routing(List<String> list)
      A custom value used to route operations to a specific shard. Not allowed when index.slice.enabled is true for the target index; use _slice instead.

      API name: routing

      Adds all elements of list to routing.

    • routing

      public final CountRequest.Builder routing(String value, String... values)
      A custom value used to route operations to a specific shard. Not allowed when index.slice.enabled is true for the target index; use _slice instead.

      API name: routing

      Adds one or more values to routing.

    • stats

      public final CountRequest.Builder stats(List<String> list)
      Specific tag of the request for logging and statistical purposes.

      API name: stats

      Adds all elements of list to stats.

    • stats

      public final CountRequest.Builder stats(String value, String... values)
      Specific tag of the request for logging and statistical purposes.

      API name: stats

      Adds one or more values to stats.

    • terminateAfter

      public final CountRequest.Builder terminateAfter(@Nullable Long value)
      The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.

      IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.

      API name: terminate_after

    • self

      protected CountRequest.Builder self()
      Specified by:
      self in class RequestBase.AbstractBuilder<CountRequest.Builder>
    • build

      public CountRequest build()
      Builds a CountRequest.
      Specified by:
      build in interface ObjectBuilder<CountRequest>
      Throws:
      NullPointerException - if some of the required fields are null.