Class FetchSourceContext

java.lang.Object
org.elasticsearch.search.fetch.subphase.FetchSourceContext
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class FetchSourceContext extends Object implements Writeable, org.elasticsearch.common.xcontent.ToXContentObject
Context used to fetch the _source.
  • Field Details

    • INCLUDES_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField INCLUDES_FIELD
    • EXCLUDES_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField EXCLUDES_FIELD
    • FETCH_SOURCE

      public static final FetchSourceContext FETCH_SOURCE
    • DO_NOT_FETCH_SOURCE

      public static final FetchSourceContext DO_NOT_FETCH_SOURCE
  • Constructor Details

    • FetchSourceContext

      public FetchSourceContext(boolean fetchSource, String[] includes, String[] excludes)
    • FetchSourceContext

      public FetchSourceContext(boolean fetchSource)
    • FetchSourceContext

      public FetchSourceContext(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • fetchSource

      public boolean fetchSource()
    • includes

      public String[] includes()
    • excludes

      public String[] excludes()
    • parseFromRestRequest

      public static FetchSourceContext parseFromRestRequest(RestRequest request)
    • fromXContent

      public static FetchSourceContext fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getFilter

      public Function<Map<String,?>,Map<String,Object>> getFilter()
      Returns a filter function that expects the source map as an input and returns the filtered map.