Type to search.

Get multiple term vectors

  • POST also GET /{index}/_mtermvectors
  • POST also GET /_mtermvectors
Auth

Get multiple term vectors with a single request. You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a docs array with all the fetched termvectors. Each element has the structure provided by the termvectors API.

Artificial documents

You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified _index.

Required privileges

Index privileges read

Path parameters

index string optional

The name of the index that contains the documents.

Leave it out to use /_mtermvectors.

Query parameters

ids string[]

A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body

fields union string | string[]

A comma-separated list or wildcard expressions of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the completion_fields or fielddata_fields parameters.

field_statistics boolean · default: true

If true, the response includes the document count, sum of document frequencies, and sum of total term frequencies.

offsets boolean · default: true

If true, the response includes term offsets.

payloads boolean · default: true

If true, the response includes term payloads.

positions boolean · default: true

If true, the response includes term positions.

preference string

The node or shard the operation should be performed on. It is random by default.

realtime boolean · default: true

If true, the request is real-time as opposed to near-real-time.

routing union string | string[]

A custom value used to route operations to a specific shard. Not allowed when index.slice.enabled is true for the target index; use _slice instead.

term_statistics boolean · default: false

If true, the response includes term frequency and document frequency.

version number

If true, returns the document version as part of a hit.

version_type enum

The version type.

Supported values include:

  • internal: Use internal versioning that starts at 1 and increments with each update or delete.
  • external: Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.
  • external_gte: Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document. NOTE: The external_gte version type is meant for special use cases and should be used with care. If used incorrectly, it can result in loss of data.
Values: internal external external_gte

Request body

ids string[]

A simplified syntax to specify documents by their ID if they're in the same index.

Response

application/json
docs object[] required
_id string
_index string required
_version number
took number
found boolean
term_vectors map string to object