Class SearchTemplateRequest.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • allowNoIndices

      public final SearchTemplateRequest.Builder allowNoIndices(@Nullable Boolean value)
      If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

      API name: allow_no_indices

    • ccsMinimizeRoundtrips

      public final SearchTemplateRequest.Builder ccsMinimizeRoundtrips(@Nullable Boolean value)
      If true, network round-trips are minimized for cross-cluster search requests.

      API name: ccs_minimize_roundtrips

    • expandWildcards

      public final SearchTemplateRequest.Builder expandWildcards(List<ExpandWildcard> list)
      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. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

      API name: expand_wildcards

      Adds all elements of list to expandWildcards.

    • expandWildcards

      public final SearchTemplateRequest.Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values)
      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. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

      API name: expand_wildcards

      Adds one or more values to expandWildcards.

    • explain

      public final SearchTemplateRequest.Builder explain(@Nullable Boolean value)
      If true, returns detailed information about score calculation as part of each hit.

      API name: explain

    • id

      public final SearchTemplateRequest.Builder id(@Nullable String value)
      ID of the search template to use. If no source is specified, this parameter is required.

      API name: id

    • ignoreThrottled

      public final SearchTemplateRequest.Builder ignoreThrottled(@Nullable Boolean value)
      If true, specified concrete, expanded, or aliased indices are not included in the response when throttled.

      API name: ignore_throttled

    • ignoreUnavailable

      public final SearchTemplateRequest.Builder ignoreUnavailable(@Nullable Boolean value)
      If false, the request returns an error if it targets a missing or closed index.

      API name: ignore_unavailable

    • index

      public final SearchTemplateRequest.Builder index(List<String> list)
      Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*).

      API name: index

      Adds all elements of list to index.

    • index

      public final SearchTemplateRequest.Builder index(String value, String... values)
      Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*).

      API name: index

      Adds one or more values to index.

    • params

      public final SearchTemplateRequest.Builder params(Map<String,JsonData> map)
      Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value.

      API name: params

      Adds all entries of map to params.

    • params

      public final SearchTemplateRequest.Builder params(String key, JsonData value)
      Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value.

      API name: params

      Adds an entry to params.

    • preference

      public final SearchTemplateRequest.Builder preference(@Nullable String value)
      Specifies the node or shard the operation should be performed on. Random by default.

      API name: preference

    • profile

      public final SearchTemplateRequest.Builder profile(@Nullable Boolean value)
      If true, the query execution is profiled.

      API name: profile

    • routing

      public final SearchTemplateRequest.Builder routing(@Nullable String value)
      Custom value used to route operations to a specific shard.

      API name: routing

    • scroll

      public final SearchTemplateRequest.Builder scroll(@Nullable Time value)
      Specifies how long a consistent view of the index should be maintained for scrolled search.

      API name: scroll

    • scroll

      Specifies how long a consistent view of the index should be maintained for scrolled search.

      API name: scroll

    • searchType

      public final SearchTemplateRequest.Builder searchType(@Nullable SearchType value)
      The type of the search operation.

      API name: search_type

    • source

      public final SearchTemplateRequest.Builder source(@Nullable String value)
      An inline search template. Supports the same parameters as the search API's request body. Also supports Mustache variables. If no id is specified, this parameter is required.

      API name: source

    • self

      Specified by:
      self in class RequestBase.AbstractBuilder<SearchTemplateRequest.Builder>
    • build

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