Class KnnSearchRequest.Builder
- All Implemented Interfaces:
WithJson<KnnSearchRequest.Builder>
,ObjectBuilder<KnnSearchRequest>
- Enclosing class:
- KnnSearchRequest
public static class KnnSearchRequest.Builder extends WithJsonObjectBuilderBase<KnnSearchRequest.Builder> implements ObjectBuilder<KnnSearchRequest>
KnnSearchRequest
.-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description KnnSearchRequest
build()
Builds aKnnSearchRequest
.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.KnnSearchRequest.Builder
docvalueFields(java.util.function.Function<FieldAndFormat.Builder,ObjectBuilder<FieldAndFormat>> fn)
The request returns doc values for field names matching these patterns in the hits.fields property of the response.KnnSearchRequest.Builder
docvalueFields(java.util.List<FieldAndFormat> list)
The request returns doc values for field names matching these patterns in the hits.fields property of the response.KnnSearchRequest.Builder
fields(java.lang.String value, java.lang.String... values)
The request returns values for field names matching these patterns in the hits.fields property of the response.KnnSearchRequest.Builder
fields(java.util.List<java.lang.String> list)
The request returns values for field names matching these patterns in the hits.fields property of the response.KnnSearchRequest.Builder
filter(Query value, Query... values)
Query to filter the documents that can match.KnnSearchRequest.Builder
filter(java.util.function.Function<Query.Builder,ObjectBuilder<Query>> fn)
Query to filter the documents that can match.KnnSearchRequest.Builder
filter(java.util.List<Query> list)
Query to filter the documents that can match.KnnSearchRequest.Builder
index(java.lang.String value, java.lang.String... values)
Required - A comma-separated list of index names to search; use_all
or to perform the operation on all indicesKnnSearchRequest.Builder
index(java.util.List<java.lang.String> list)
Required - A comma-separated list of index names to search; use_all
or to perform the operation on all indicesKnnSearchRequest.Builder
knn(KnnSearchQuery value)
Required - kNN query to executeKnnSearchRequest.Builder
knn(java.util.function.Function<KnnSearchQuery.Builder,ObjectBuilder<KnnSearchQuery>> fn)
Required - kNN query to executeKnnSearchRequest.Builder
routing(java.lang.String value)
A comma-separated list of specific routing valuesprotected KnnSearchRequest.Builder
self()
KnnSearchRequest.Builder
source(SourceConfig value)
Indicates which source fields are returned for matching documents.KnnSearchRequest.Builder
source(java.util.function.Function<SourceConfig.Builder,ObjectBuilder<SourceConfig>> fn)
Indicates which source fields are returned for matching documents.KnnSearchRequest.Builder
storedFields(java.lang.String value, java.lang.String... values)
List of stored fields to return as part of a hit.KnnSearchRequest.Builder
storedFields(java.util.List<java.lang.String> list)
List of stored fields to return as part of a hit.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJson
Methods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
-
source
public final KnnSearchRequest.Builder source(java.util.function.Function<SourceConfig.Builder,ObjectBuilder<SourceConfig>> fn)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
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
todocvalueFields
. -
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
public final KnnSearchRequest.Builder docvalueFields(java.util.function.Function<FieldAndFormat.Builder,ObjectBuilder<FieldAndFormat>> fn)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
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
tofields
. -
fields
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
Query to filter the documents that can match. The kNN search will return the topk
documents that also match this filter. The value can be a single query or a list of queries. Iffilter
isn't provided, all documents are allowed to match.API name:
filter
Adds all elements of
list
tofilter
. -
filter
Query to filter the documents that can match. The kNN search will return the topk
documents that also match this filter. The value can be a single query or a list of queries. Iffilter
isn't provided, all documents are allowed to match.API name:
filter
Adds one or more values to
filter
. -
filter
public final KnnSearchRequest.Builder filter(java.util.function.Function<Query.Builder,ObjectBuilder<Query>> fn)Query to filter the documents that can match. The kNN search will return the topk
documents that also match this filter. The value can be a single query or a list of queries. Iffilter
isn't provided, all documents are allowed to match.API name:
filter
Adds a value to
filter
using a builder lambda. -
index
Required - A comma-separated list of index names to search; use_all
or to perform the operation on all indicesAPI name:
index
Adds all elements of
list
toindex
. -
index
Required - A comma-separated list of index names to search; use_all
or to perform the operation on all indicesAPI name:
index
Adds one or more values to
index
. -
knn
Required - kNN query to executeAPI name:
knn
-
knn
public final KnnSearchRequest.Builder knn(java.util.function.Function<KnnSearchQuery.Builder,ObjectBuilder<KnnSearchQuery>> fn)Required - kNN query to executeAPI name:
knn
-
routing
A comma-separated list of specific routing valuesAPI name:
routing
-
storedFields
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
tostoredFields
. -
storedFields
public final KnnSearchRequest.Builder storedFields(java.lang.String value, java.lang.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
- Specified by:
self
in classWithJsonObjectBuilderBase<KnnSearchRequest.Builder>
-
build
Builds aKnnSearchRequest
.- Specified by:
build
in interfaceObjectBuilder<KnnSearchRequest>
- Throws:
java.lang.NullPointerException
- if some of the required fields are null.
-