java.lang.Object
org.elasticsearch.xpack.esql.core.type.EsField
All Implemented Interfaces:
Writeable
Direct Known Subclasses:
DateEsField, InvalidMappedField, KeywordEsField, MultiTypeEsField, TextEsField, UnsupportedEsField

public class EsField extends Object implements Writeable
Information about a field in an ES index.
  • Constructor Details

  • Method Details

    • getReader

      public static Writeable.Reader<? extends EsField> getReader(String name)
    • readFrom

      public static <A extends EsField> A readFrom(StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • writeContent

      public void writeContent(StreamOutput out) throws IOException
      This needs to be overridden by subclasses for specific serialization
      Throws:
      IOException
    • getWriteableName

      public String getWriteableName()
      This needs to be overridden by subclasses for specific serialization
    • getName

      public String getName()
      Returns the simple name, but not the full field path. The latter requires knowing the path of the parent field.
    • getDataType

      public DataType getDataType()
      The field type
    • isAggregatable

      public boolean isAggregatable()
      This field can be aggregated
    • getProperties

      @Nullable public Map<String,EsField> getProperties()
      Returns list of properties for the nested and object fields, list of subfield if the field was indexed in a few different ways or null otherwise
    • isAlias

      public boolean isAlias()
      This field is an alias to another field
    • getExactField

      public EsField getExactField()
      Returns the path to the keyword version of this field if this field is text and it has a subfield that is indexed as keyword, throws an exception if such field is not found or the field name itself in all other cases. To avoid the exception getExactInfo() should be used beforehand, to check if an exact field exists and if not get the errorMessage which explains why is that.
    • getExactInfo

      public EsField.Exact getExactInfo()
      Returns and EsField.Exact object with all the necessary info about the field:
      • If it has an exact underlying field or not
      • and if not an error message why it doesn't
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object