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
  • Constructor Details

  • Method Details

    • _kind

      public final Suggestion.Kind _kind()
      Description copied from interface: TaggedUnion
      Get the of the kind of variant held by this object.
      Specified by:
      _kind in interface TaggedUnion<Suggestion.Kind,​SuggestionVariant>
      Returns:
      the variant kind
    • _get

      public final SuggestionVariant _get()
      Specified by:
      _get in interface TaggedUnion<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 kind completion?
    • completion

      public CompletionSuggest<TDocument> completion()
      Get the completion variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the completion kind.
    • isPhrase

      public boolean isPhrase()
      Is this variant instance of kind phrase?
    • phrase

      public PhraseSuggest phrase()
      Get the phrase variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the phrase kind.
    • isTerm

      public boolean isTerm()
      Is this variant instance of kind term?
    • term

      public TermSuggest term()
      Get the term variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the term kind.
    • serialize

      public void serialize​(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Specified by:
      serialize in interface JsonpSerializable
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • createSuggestionDeserializer

      public static <TDocument> ExternallyTaggedUnion.TypedKeysDeserializer<Suggestion<TDocument>> createSuggestionDeserializer​(JsonpDeserializer<TDocument> tDocumentDeserializer)
      Create a JSON deserializer for Suggestion