Class KnnSearchResponse.Builder<TDocument>
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<KnnSearchResponse.Builder<TDocument>>
co.elastic.clients.elasticsearch.core.KnnSearchResponse.Builder<TDocument>
- All Implemented Interfaces:
WithJson<KnnSearchResponse.Builder<TDocument>>
,ObjectBuilder<KnnSearchResponse<TDocument>>
- Enclosing class:
- KnnSearchResponse<TDocument>
public static class KnnSearchResponse.Builder<TDocument> extends WithJsonObjectBuilderBase<KnnSearchResponse.Builder<TDocument>> implements ObjectBuilder<KnnSearchResponse<TDocument>>
Builder for
KnnSearchResponse
.-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description KnnSearchResponse<TDocument>
build()
Builds aKnnSearchResponse
.KnnSearchResponse.Builder<TDocument>
fields(java.lang.String key, JsonData value)
Contains field values for the documents.KnnSearchResponse.Builder<TDocument>
fields(java.util.Map<java.lang.String,JsonData> map)
Contains field values for the documents.KnnSearchResponse.Builder<TDocument>
hits(HitsMetadata<TDocument> value)
Required - Contains returned documents and metadata.KnnSearchResponse.Builder<TDocument>
hits(java.util.function.Function<HitsMetadata.Builder<TDocument>,ObjectBuilder<HitsMetadata<TDocument>>> fn)
Required - Contains returned documents and metadata.KnnSearchResponse.Builder<TDocument>
maxScore(java.lang.Double value)
Highest returned document score.protected KnnSearchResponse.Builder<TDocument>
self()
KnnSearchResponse.Builder<TDocument>
shards(ShardStatistics value)
Required - Contains a count of shards used for the request.KnnSearchResponse.Builder<TDocument>
shards(java.util.function.Function<ShardStatistics.Builder,ObjectBuilder<ShardStatistics>> fn)
Required - Contains a count of shards used for the request.KnnSearchResponse.Builder<TDocument>
tDocumentSerializer(JsonpSerializer<TDocument> value)
Serializer for TDocument.KnnSearchResponse.Builder<TDocument>
timedOut(boolean value)
Required - If true, the request timed out before completion; returned results may be partial or empty.KnnSearchResponse.Builder<TDocument>
took(long value)
Required - Milliseconds it took Elasticsearch to execute the request.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
-
took
Required - Milliseconds it took Elasticsearch to execute the request.API name:
took
-
timedOut
Required - If true, the request timed out before completion; returned results may be partial or empty.API name:
timed_out
-
shards
Required - Contains a count of shards used for the request.API name:
_shards
-
shards
public final KnnSearchResponse.Builder<TDocument> shards(java.util.function.Function<ShardStatistics.Builder,ObjectBuilder<ShardStatistics>> fn)Required - Contains a count of shards used for the request.API name:
_shards
-
hits
Required - Contains returned documents and metadata.API name:
hits
-
hits
public final KnnSearchResponse.Builder<TDocument> hits(java.util.function.Function<HitsMetadata.Builder<TDocument>,ObjectBuilder<HitsMetadata<TDocument>>> fn)Required - Contains returned documents and metadata.API name:
hits
-
fields
public final KnnSearchResponse.Builder<TDocument> fields(java.util.Map<java.lang.String,JsonData> map)Contains field values for the documents. These fields must be specified in the request using thefields
parameter.API name:
fields
Adds all entries of
map
tofields
. -
fields
Contains field values for the documents. These fields must be specified in the request using thefields
parameter.API name:
fields
Adds an entry to
fields
. -
maxScore
Highest returned document score. This value is null for requests that do not sort by score.API name:
max_score
-
tDocumentSerializer
public final KnnSearchResponse.Builder<TDocument> tDocumentSerializer(@Nullable JsonpSerializer<TDocument> value)Serializer for TDocument. If not set, an attempt will be made to find a serializer from the JSON context. -
self
- Specified by:
self
in classWithJsonObjectBuilderBase<KnnSearchResponse.Builder<TDocument>>
-
build
Builds aKnnSearchResponse
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
java.lang.NullPointerException
- if some of the required fields are null.
-