Interface ValueFetcher

All Known Implementing Classes:
ArraySourceValueFetcher, DocValueFetcher, NestedValueFetcher, SourceValueFetcher

public interface ValueFetcher
A helper class for fetching field values during the FetchFieldsPhase. Each MappedFieldType is in charge of defining a value fetcher through MappedFieldType.valueFetcher(org.elasticsearch.index.query.SearchExecutionContext, java.lang.String).
  • Method Summary

    Modifier and Type Method Description
    java.util.List<java.lang.Object> fetchValues​(SourceLookup lookup)
    Given access to a document's _source, return this field's values.
    default void setNextReader​(org.apache.lucene.index.LeafReaderContext context)
    Update the leaf reader used to fetch values.
  • Method Details

    • fetchValues

      java.util.List<java.lang.Object> fetchValues​(SourceLookup lookup) throws java.io.IOException
      Given access to a document's _source, return this field's values. In addition to pulling out the values, they will be parsed into a standard form. For example numeric field mappers make sure to parse the source value into a number of the right type. Note that for array values, the order in which values are returned is undefined and should not be relied on.
      Parameters:
      lookup - a lookup structure over the document's source.
      Returns:
      a list a standardized field values.
      Throws:
      java.io.IOException
    • setNextReader

      default void setNextReader​(org.apache.lucene.index.LeafReaderContext context)
      Update the leaf reader used to fetch values.