Class KnnSearchRequest.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • source

      public final KnnSearchRequest.Builder source(@Nullable SourceConfig value)
      Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.

      API name: _source

    • source

      Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.

      API name: _source

    • docvalueFields

      public final KnnSearchRequest.Builder docvalueFields(List<FieldAndFormat> list)
      The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

      API name: docvalue_fields

      Adds all elements of list to docvalueFields.

    • docvalueFields

      public final KnnSearchRequest.Builder docvalueFields(FieldAndFormat value, FieldAndFormat... values)
      The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

      API name: docvalue_fields

      Adds one or more values to docvalueFields.

    • docvalueFields

      The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

      API name: docvalue_fields

      Adds a value to docvalueFields using a builder lambda.

    • fields

      public final KnnSearchRequest.Builder fields(List<String> list)
      The request returns values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

      API name: fields

      Adds all elements of list to fields.

    • fields

      public final KnnSearchRequest.Builder fields(String value, String... values)
      The request returns values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

      API name: fields

      Adds one or more values to fields.

    • filter

      public final KnnSearchRequest.Builder filter(List<Query> list)
      Query to filter the documents that can match. The kNN search will return the top k documents that also match this filter. The value can be a single query or a list of queries. If filter isn't provided, all documents are allowed to match.

      API name: filter

      Adds all elements of list to filter.

    • filter

      public final KnnSearchRequest.Builder filter(Query value, Query... values)
      Query to filter the documents that can match. The kNN search will return the top k documents that also match this filter. The value can be a single query or a list of queries. If filter isn't provided, all documents are allowed to match.

      API name: filter

      Adds one or more values to filter.

    • filter

      Query to filter the documents that can match. The kNN search will return the top k documents that also match this filter. The value can be a single query or a list of queries. If filter isn't provided, all documents are allowed to match.

      API name: filter

      Adds a value to filter using a builder lambda.

    • index

      public final KnnSearchRequest.Builder index(List<String> list)
      Required - A comma-separated list of index names to search; use _all or to perform the operation on all indices

      API name: index

      Adds all elements of list to index.

    • index

      public final KnnSearchRequest.Builder index(String value, String... values)
      Required - A comma-separated list of index names to search; use _all or to perform the operation on all indices

      API name: index

      Adds one or more values to index.

    • knn

      public final KnnSearchRequest.Builder knn(KnnSearchQuery value)
      Required - kNN query to execute

      API name: knn

    • knn

      Required - kNN query to execute

      API name: knn

    • routing

      public final KnnSearchRequest.Builder routing(@Nullable String value)
      A comma-separated list of specific routing values

      API name: routing

    • storedFields

      public final KnnSearchRequest.Builder storedFields(List<String> list)
      List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the _source parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response.

      API name: stored_fields

      Adds all elements of list to storedFields.

    • storedFields

      public final KnnSearchRequest.Builder storedFields(String value, String... values)
      List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the _source parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response.

      API name: stored_fields

      Adds one or more values to storedFields.

    • self

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

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