Class FetchSourceContext

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

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

    • INCLUDES_FIELD

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

      public static final org.elasticsearch.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.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.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.