java.lang.Object
co.elastic.clients.elasticsearch.core.search.Context
All Implemented Interfaces:
JsonpSerializable, TaggedUnion<Context.Kind,​java.lang.Object>

@JsonpDeserializable
public class Context
extends java.lang.Object
implements TaggedUnion<Context.Kind,​java.lang.Object>, JsonpSerializable
Text or location that we want similar documents for or a lookup to a document's field for the text.
See Also:
Documentation on elastic.co, API specification
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  Context.Builder  
    static class  Context.Kind  
  • Field Summary

    Fields
    Modifier and Type Field Description
    static JsonpDeserializer<Context> _DESERIALIZER  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object _get()  
    Context.Kind _kind()
    Get the of the kind of variant held by this object.
    java.lang.String category()
    Get the category variant value.
    boolean isCategory()
    Is this variant instance of kind category?
    boolean isLocation()
    Is this variant instance of kind location?
    GeoLocation location()
    Get the location variant value.
    static Context of​(java.util.function.Function<Context.Builder,​ObjectBuilder<Context>> fn)  
    void serialize​(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • _kind

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

      public final java.lang.Object _get()
      Specified by:
      _get in interface TaggedUnion<Context.Kind,​java.lang.Object>
    • of

      public static Context of​(java.util.function.Function<Context.Builder,​ObjectBuilder<Context>> fn)
    • isLocation

      public boolean isLocation()
      Is this variant instance of kind location?
    • location

      public GeoLocation location()
      Get the location variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the location kind.
    • isCategory

      public boolean isCategory()
      Is this variant instance of kind category?
    • category

      public java.lang.String category()
      Get the category variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the category 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