Record Class StoredFieldsSpec

java.lang.Object
java.lang.Record
org.elasticsearch.search.fetch.StoredFieldsSpec
Record Components:
requiresSource - should source be loaded
requiredStoredFields - a set of stored fields to load

public record StoredFieldsSpec(boolean requiresSource, boolean requiresMetadata, Set<String> requiredStoredFields) extends Record
Defines which stored fields need to be loaded during a fetch
  • Field Details

    • NO_REQUIREMENTS

      public static final StoredFieldsSpec NO_REQUIREMENTS
      Use when no stored fields are required
    • NEEDS_SOURCE

      public static final StoredFieldsSpec NEEDS_SOURCE
      Use when the source should be loaded but no other stored fields are required
  • Constructor Details

    • StoredFieldsSpec

      public StoredFieldsSpec(boolean requiresSource, boolean requiresMetadata, Set<String> requiredStoredFields)
      Creates an instance of a StoredFieldsSpec record class.
      Parameters:
      requiresSource - the value for the requiresSource record component
      requiresMetadata - the value for the requiresMetadata record component
      requiredStoredFields - the value for the requiredStoredFields record component
  • Method Details

    • noRequirements

      public boolean noRequirements()
    • merge

      public StoredFieldsSpec merge(StoredFieldsSpec other)
      Combine these stored field requirements with those from another StoredFieldsSpec
    • build

      public static <T> StoredFieldsSpec build(Collection<T> sources, Function<T,StoredFieldsSpec> converter)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • requiresSource

      public boolean requiresSource()
      Returns the value of the requiresSource record component.
      Returns:
      the value of the requiresSource record component
    • requiresMetadata

      public boolean requiresMetadata()
      Returns the value of the requiresMetadata record component.
      Returns:
      the value of the requiresMetadata record component
    • requiredStoredFields

      public Set<String> requiredStoredFields()
      Returns the value of the requiredStoredFields record component.
      Returns:
      the value of the requiredStoredFields record component