Class Suggestion<TDocument>
java.lang.Object
co.elastic.clients.elasticsearch.core.search.Suggestion<TDocument>
- All Implemented Interfaces:
JsonpSerializable
,TaggedUnion<Suggestion.Kind,SuggestionVariant>
public class Suggestion<TDocument> extends java.lang.Object implements TaggedUnion<Suggestion.Kind,SuggestionVariant>, JsonpSerializable
- See Also:
- API specification
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Suggestion.Builder<TDocument>
static class
Suggestion.Kind
Suggestion
variant kinds. -
Constructor Summary
Constructors Constructor Description Suggestion(SuggestionVariant value)
-
Method Summary
Modifier and Type Method Description SuggestionVariant
_get()
Suggestion.Kind
_kind()
Get the of the kind of variant held by this object.CompletionSuggest<TDocument>
completion()
Get thecompletion
variant value.static <TDocument>
ExternallyTaggedUnion.TypedKeysDeserializer<Suggestion<TDocument>>createSuggestionDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)
Create a JSON deserializer for Suggestionboolean
isCompletion()
Is this variant instance of kindcompletion
?boolean
isPhrase()
Is this variant instance of kindphrase
?boolean
isTerm()
Is this variant instance of kindterm
?static <TDocument>
Suggestion<TDocument>of(java.util.function.Function<Suggestion.Builder<TDocument>,ObjectBuilder<Suggestion<TDocument>>> fn)
PhraseSuggest
phrase()
Get thephrase
variant value.void
serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
TermSuggest
term()
Get theterm
variant value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Suggestion
-
-
Method Details
-
_kind
Description copied from interface:TaggedUnion
Get the of the kind of variant held by this object.- Specified by:
_kind
in interfaceTaggedUnion<Suggestion.Kind,SuggestionVariant>
- Returns:
- the variant kind
-
_get
- Specified by:
_get
in interfaceTaggedUnion<Suggestion.Kind,SuggestionVariant>
-
of
public static <TDocument> Suggestion<TDocument> of(java.util.function.Function<Suggestion.Builder<TDocument>,ObjectBuilder<Suggestion<TDocument>>> fn) -
isCompletion
public boolean isCompletion()Is this variant instance of kindcompletion
? -
completion
Get thecompletion
variant value.- Throws:
java.lang.IllegalStateException
- if the current variant is not of thecompletion
kind.
-
isPhrase
public boolean isPhrase()Is this variant instance of kindphrase
? -
phrase
Get thephrase
variant value.- Throws:
java.lang.IllegalStateException
- if the current variant is not of thephrase
kind.
-
isTerm
public boolean isTerm()Is this variant instance of kindterm
? -
term
Get theterm
variant value.- Throws:
java.lang.IllegalStateException
- if the current variant is not of theterm
kind.
-
serialize
- Specified by:
serialize
in interfaceJsonpSerializable
-
createSuggestionDeserializer
public static <TDocument> ExternallyTaggedUnion.TypedKeysDeserializer<Suggestion<TDocument>> createSuggestionDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)Create a JSON deserializer for Suggestion
-