Class QueryRequest.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • allowPartialSearchResults

      public final QueryRequest.Builder allowPartialSearchResults(@Nullable Boolean value)
      If true, the response has partial results when there are shard request timeouts or shard failures. If false, the API returns an error with no partial results.

      API name: allow_partial_search_results

    • catalog

      public final QueryRequest.Builder catalog(@Nullable String value)
      The default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only.

      API name: catalog

    • columnar

      public final QueryRequest.Builder columnar(@Nullable Boolean value)
      If true, the results are in a columnar fashion: one row represents all the values of a certain column from the current page of results. The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses.

      API name: columnar

    • cursor

      public final QueryRequest.Builder cursor(@Nullable String value)
      The cursor used to retrieve a set of paginated results. If you specify a cursor, the API only uses the columnar and time_zone request body parameters. It ignores other request body parameters.

      API name: cursor

    • fetchSize

      public final QueryRequest.Builder fetchSize(@Nullable Integer value)
      The maximum number of rows (or entries) to return in one response.

      API name: fetch_size

    • fieldMultiValueLeniency

      public final QueryRequest.Builder fieldMultiValueLeniency(@Nullable Boolean value)
      If false, the API returns an exception when encountering multiple values for a field. If true, the API is lenient and returns the first value from the array with no guarantee of consistent results.

      API name: field_multi_value_leniency

    • filter

      public final QueryRequest.Builder filter(@Nullable Query value)
      The Elasticsearch query DSL for additional filtering.

      API name: filter

    • filter

      The Elasticsearch query DSL for additional filtering.

      API name: filter

    • filter

      public final QueryRequest.Builder filter(QueryVariant value)
      The Elasticsearch query DSL for additional filtering.

      API name: filter

    • format

      public final QueryRequest.Builder format(@Nullable SqlFormat value)
      The format for the response. You can also specify a format using the Accept HTTP header. If you specify both this parameter and the Accept HTTP header, this parameter takes precedence.

      API name: format

    • indexUsingFrozen

      public final QueryRequest.Builder indexUsingFrozen(@Nullable Boolean value)
      If true, the search can run on frozen indices.

      API name: index_using_frozen

    • keepAlive

      public final QueryRequest.Builder keepAlive(@Nullable Time value)
      The retention period for an async or saved synchronous search.

      API name: keep_alive

    • keepAlive

      The retention period for an async or saved synchronous search.

      API name: keep_alive

    • keepOnCompletion

      public final QueryRequest.Builder keepOnCompletion(@Nullable Boolean value)
      If true, Elasticsearch stores synchronous searches if you also specify the wait_for_completion_timeout parameter. If false, Elasticsearch only stores async searches that don't finish before the wait_for_completion_timeout.

      API name: keep_on_completion

    • pageTimeout

      public final QueryRequest.Builder pageTimeout(@Nullable Time value)
      The minimum retention period for the scroll cursor. After this time period, a pagination request might fail because the scroll cursor is no longer available. Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of page_timeout in the scroll request.

      API name: page_timeout

    • pageTimeout

      public final QueryRequest.Builder pageTimeout(Function<Time.Builder,ObjectBuilder<Time>> fn)
      The minimum retention period for the scroll cursor. After this time period, a pagination request might fail because the scroll cursor is no longer available. Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of page_timeout in the scroll request.

      API name: page_timeout

    • params

      public final QueryRequest.Builder params(Map<String,JsonData> map)
      The values for parameters in the query.

      API name: params

      Adds all entries of map to params.

    • params

      public final QueryRequest.Builder params(String key, JsonData value)
      The values for parameters in the query.

      API name: params

      Adds an entry to params.

    • query

      public final QueryRequest.Builder query(@Nullable String value)
      The SQL query to run.

      API name: query

    • requestTimeout

      public final QueryRequest.Builder requestTimeout(@Nullable Time value)
      The timeout before the request fails.

      API name: request_timeout

    • requestTimeout

      public final QueryRequest.Builder requestTimeout(Function<Time.Builder,ObjectBuilder<Time>> fn)
      The timeout before the request fails.

      API name: request_timeout

    • runtimeMappings

      public final QueryRequest.Builder runtimeMappings(Map<String,RuntimeField> map)
      One or more runtime fields for the search request. These fields take precedence over mapped fields with the same name.

      API name: runtime_mappings

      Adds all entries of map to runtimeMappings.

    • runtimeMappings

      public final QueryRequest.Builder runtimeMappings(String key, RuntimeField value)
      One or more runtime fields for the search request. These fields take precedence over mapped fields with the same name.

      API name: runtime_mappings

      Adds an entry to runtimeMappings.

    • runtimeMappings

      One or more runtime fields for the search request. These fields take precedence over mapped fields with the same name.

      API name: runtime_mappings

      Adds an entry to runtimeMappings using a builder lambda.

    • timeZone

      public final QueryRequest.Builder timeZone(@Nullable String value)
      The ISO-8601 time zone ID for the search.

      API name: time_zone

    • waitForCompletionTimeout

      public final QueryRequest.Builder waitForCompletionTimeout(@Nullable Time value)
      The period to wait for complete results. It defaults to no timeout, meaning the request waits for complete search results. If the search doesn't finish within this period, the search becomes async.

      To save a synchronous search, you must specify this parameter and the keep_on_completion parameter.

      API name: wait_for_completion_timeout

    • waitForCompletionTimeout

      public final QueryRequest.Builder waitForCompletionTimeout(Function<Time.Builder,ObjectBuilder<Time>> fn)
      The period to wait for complete results. It defaults to no timeout, meaning the request waits for complete search results. If the search doesn't finish within this period, the search becomes async.

      To save a synchronous search, you must specify this parameter and the keep_on_completion parameter.

      API name: wait_for_completion_timeout

    • self

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

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