Path parameters

  • indexstring Required

    The name of the index that contains the documents.

Query parameters

  • idsarray[string]

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

  • fieldsstring | array[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_statisticsboolean

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

  • offsetsboolean

    If true, the response includes term offsets.

  • payloadsboolean

    If true, the response includes term payloads.

  • positionsboolean

    If true, the response includes term positions.

  • preferencestring

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

  • realtimeboolean

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

  • routingstring

    A custom value used to route operations to a specific shard.

  • term_statisticsboolean

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

  • versionnumber

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

  • version_typestring

    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.
    • force: This option is deprecated because it can cause primary and replica shards to diverge.

    Values are internal, external, external_gte, or force.

application/json

Body

  • docsarray[object]

    An array of existing or artificial documents.

    Hide docs attributes Show docs attributes object
    • _idstring
    • _indexstring
    • docobject

      An artificial document (a document not present in the index) for which you want to retrieve term vectors.

    • fieldsstring | array[string]
    • field_statisticsboolean

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

    • filterobject
      Hide filter attributes Show filter attributes object
      • max_doc_freqnumber

        Ignore words which occur in more than this many docs. Defaults to unbounded.

      • max_num_termsnumber

        The maximum number of terms that must be returned per field.

      • max_term_freqnumber

        Ignore words with more than this frequency in the source doc. It defaults to unbounded.

      • max_word_lengthnumber

        The maximum word length above which words will be ignored. Defaults to unbounded.

      • min_doc_freqnumber

        Ignore terms which do not occur in at least this many docs.

      • min_term_freqnumber

        Ignore words with less than this frequency in the source doc.

      • min_word_lengthnumber

        The minimum word length below which words will be ignored.

    • offsetsboolean

      If true, the response includes term offsets.

    • payloadsboolean

      If true, the response includes term payloads.

    • positionsboolean

      If true, the response includes term positions.

    • routingstring
    • term_statisticsboolean

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

    • versionnumber
    • version_typestring

      Values are internal, external, external_gte, or force.

  • idsarray[string]

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

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • docsarray[object] Required
      Hide docs attributes Show docs attributes object
      • _idstring
      • _indexstring Required
      • _versionnumber
      • tooknumber
      • foundboolean
      • term_vectorsobject
        Hide term_vectors attribute Show term_vectors attribute object
        • *object Additional properties
          Hide * attributes Show * attributes object
          • field_statisticsobject
            Hide field_statistics attributes Show field_statistics attributes object
            • doc_countnumber Required
            • sum_doc_freqnumber Required
            • sum_ttfnumber Required
          • termsobject Required
            Hide terms attribute Show terms attribute object
            • *object Additional properties
      • errorobject
        Hide error attributes Show error attributes object
        • typestring Required

          The type of error

        • reasonstring | null

          A human-readable explanation of the error, in English.

        • stack_tracestring

          The server stack trace. Present only if the error_trace=true parameter was sent with the request.

        • caused_byobject
        • root_causearray[object]
        • suppressedarray[object]
GET /{index}/_mtermvectors
POST /my-index-000001/_mtermvectors
{
  "docs": [
      {
        "_id": "2",
        "fields": [
            "message"
        ],
        "term_statistics": true
      },
      {
        "_id": "1"
      }
  ]
}
curl \
 --request GET 'http://api.example.com/{index}/_mtermvectors' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '"{\n  \"docs\": [\n      {\n        \"_id\": \"2\",\n        \"fields\": [\n            \"message\"\n        ],\n        \"term_statistics\": true\n      },\n      {\n        \"_id\": \"1\"\n      }\n  ]\n}"'
Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.
{
  "docs": [
      {
        "_id": "2",
        "fields": [
            "message"
        ],
        "term_statistics": true
      },
      {
        "_id": "1"
      }
  ]
}
Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.
{
  "ids": [ "1", "2" ],
  "fields": [
    "message"
  ],
  "term_statistics": true
}
Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.
{
  "docs": [
      {
        "_index": "my-index-000001",
        "doc" : {
            "message" : "test test test"
        }
      },
      {
        "_index": "my-index-000001",
        "doc" : {
          "message" : "Another test ..."
        }
      }
  ]
}