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 classSuggestion.Builder<TDocument>static classSuggestion.KindSuggestionvariant 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 thecompletionvariant value.static <TDocument>
ExternallyTaggedUnion.TypedKeysDeserializer<Suggestion<TDocument>>createSuggestionDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)Create a JSON deserializer for SuggestionbooleanisCompletion()Is this variant instance of kindcompletion?booleanisPhrase()Is this variant instance of kindphrase?booleanisTerm()Is this variant instance of kindterm?static <TDocument>
Suggestion<TDocument>of(java.util.function.Function<Suggestion.Builder<TDocument>,ObjectBuilder<Suggestion<TDocument>>> fn)PhraseSuggestphrase()Get thephrasevariant value.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)TermSuggestterm()Get thetermvariant value.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Suggestion
-
-
Method Details
-
_kind
Description copied from interface:TaggedUnionGet the of the kind of variant held by this object.- Specified by:
_kindin interfaceTaggedUnion<Suggestion.Kind,SuggestionVariant>- Returns:
- the variant kind
-
_get
- Specified by:
_getin 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 thecompletionvariant value.- Throws:
java.lang.IllegalStateException- if the current variant is not of thecompletionkind.
-
isPhrase
public boolean isPhrase()Is this variant instance of kindphrase? -
phrase
Get thephrasevariant value.- Throws:
java.lang.IllegalStateException- if the current variant is not of thephrasekind.
-
isTerm
public boolean isTerm()Is this variant instance of kindterm? -
term
Get thetermvariant value.- Throws:
java.lang.IllegalStateException- if the current variant is not of thetermkind.
-
serialize
- Specified by:
serializein interfaceJsonpSerializable
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
createSuggestionDeserializer
public static <TDocument> ExternallyTaggedUnion.TypedKeysDeserializer<Suggestion<TDocument>> createSuggestionDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)Create a JSON deserializer for Suggestion
-