Class TermVectorsRequest

All Implemented Interfaces:
IndicesRequest, RealtimeRequest, Writeable, RefCounted, TaskAwareRequest

public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> implements RealtimeRequest
Request returning the term vector (doc frequency, positions, offsets) for a document.

Note, the SingleShardRequest.index(), type(String) and id(String) are required.

  • Field Details

    • preference

      protected String preference
  • Constructor Details

    • TermVectorsRequest

      public TermVectorsRequest()
    • TermVectorsRequest

      public TermVectorsRequest(String index, String type, String id)
      Constructs a new term vector request for a document that will be fetch from the provided index. Use type(String) and id(String) to specify the document to load.
    • TermVectorsRequest

      public TermVectorsRequest(TermVectorsRequest other)
      Constructs a new term vector request for a document that will be fetch from the provided index. Use type(String) and id(String) to specify the document to load.
    • TermVectorsRequest

      public TermVectorsRequest(MultiGetRequest.Item item)
  • Method Details

    • getFlags

      public EnumSet<TermVectorsRequest.Flag> getFlags()
    • type

      public TermVectorsRequest type(String type)
      Sets the type of document to get the term vector for.
    • type

      public String type()
      Returns the type of document to get the term vector for.
    • id

      public String id()
      Returns the id of document the term vector is requested for.
    • id

      public TermVectorsRequest id(String id)
      Sets the id of document the term vector is requested for.
    • doc

      public BytesReference doc()
      Returns the artificial document from which term vectors are requested for.
    • xContentType

      public XContentType xContentType()
    • doc

      public TermVectorsRequest doc(XContentBuilder documentBuilder)
      Sets an artificial document from which term vectors are requested for.
    • doc

      @Deprecated public TermVectorsRequest doc(BytesReference doc, boolean generateRandomId)
      Deprecated.
      use doc(BytesReference, boolean, XContentType) to avoid content auto detection
      Sets an artificial document from which term vectors are requested for.
    • doc

      public TermVectorsRequest doc(BytesReference doc, boolean generateRandomId, XContentType xContentType)
      Sets an artificial document from which term vectors are requested for.
    • routing

      public String routing()
      Returns:
      The routing for this request.
    • routing

      public TermVectorsRequest routing(String routing)
    • preference

      public String preference()
    • preference

      public TermVectorsRequest preference(String preference)
      Sets the preference to execute the search. Defaults to randomize across shards. Can be set to _local to prefer local shards or a custom value, which guarantees that the same order will be used across different requests.
    • offsets

      public TermVectorsRequest offsets(boolean offsets)
      Return the start and stop offsets for each term if they were stored or skip offsets.
    • offsets

      public boolean offsets()
      Returns:
      true if term offsets should be returned. Otherwise false
    • positions

      public TermVectorsRequest positions(boolean positions)
      Return the positions for each term if stored or skip.
    • positions

      public boolean positions()
      Returns:
      Returns if the positions for each term should be returned if stored or skip.
    • payloads

      public boolean payloads()
      Returns:
      true if term payloads should be returned. Otherwise false
    • payloads

      public TermVectorsRequest payloads(boolean payloads)
      Return the payloads for each term or skip.
    • termStatistics

      public boolean termStatistics()
      Returns:
      true if term statistics should be returned. Otherwise false
    • termStatistics

      public TermVectorsRequest termStatistics(boolean termStatistics)
      Return the term statistics for each term in the shard or skip.
    • fieldStatistics

      public boolean fieldStatistics()
      Returns:
      true if field statistics should be returned. Otherwise false
    • fieldStatistics

      public TermVectorsRequest fieldStatistics(boolean fieldStatistics)
      Return the field statistics for each term in the shard or skip.
    • selectedFields

      public Set<String> selectedFields()
      Return only term vectors for special selected fields. Returns for term vectors for all fields if selectedFields == null
    • selectedFields

      public TermVectorsRequest selectedFields(String... fields)
      Return only term vectors for special selected fields. Returns the term vectors for all fields if selectedFields == null
    • realtime

      public boolean realtime()
      Return whether term vectors should be generated real-time (default to true).
    • realtime

      public TermVectorsRequest realtime(boolean realtime)
      Specified by:
      realtime in interface RealtimeRequest
      Parameters:
      realtime - Controls whether this request should be realtime by reading from the translog.
    • perFieldAnalyzer

      public Map<String,String> perFieldAnalyzer()
      Return the overridden analyzers at each field.
    • perFieldAnalyzer

      public TermVectorsRequest perFieldAnalyzer(Map<String,String> perFieldAnalyzer)
      Override the analyzer used at each field when generating term vectors.
    • filterSettings

      public TermVectorsRequest.FilterSettings filterSettings()
      Return the settings for filtering out terms.
    • filterSettings

      public TermVectorsRequest filterSettings(TermVectorsRequest.FilterSettings settings)
      Sets the settings for filtering out terms.
    • version

      public long version()
    • version

      public TermVectorsRequest version(long version)
    • versionType

      public VersionType versionType()
    • versionType

      public TermVectorsRequest versionType(VersionType versionType)
    • validate

      Specified by:
      validate in class ActionRequest
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class SingleShardRequest<TermVectorsRequest>
      Throws:
      IOException
    • parseRequest

      public static void parseRequest(TermVectorsRequest termVectorsRequest, XContentParser parser) throws IOException
      populates a request object (pre-populated with defaults) based on a parser.
      Throws:
      IOException
    • readPerFieldAnalyzer

      public static Map<String,String> readPerFieldAnalyzer(Map<String,Object> map)