Get multiple term vectors
- POST also GET /{index}/_mtermvectors
- POST also GET /_mtermvectors
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.
- Index privileges:
read
Path Parameters
-
indexstring IndexNameoptional -
The name of the index that contains the documents.
Leave it out to use
/_mtermvectors.
Query Parameters
-
idsstring Id A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
-
fieldsFields 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_fieldsorfielddata_fieldsparameters.-
field_statisticsboolean · default: true If
true, the response includes the document count, sum of document frequencies, and sum of total term frequencies.-
offsetsboolean · default: true If
true, the response includes term offsets.-
payloadsboolean · default: true If
true, the response includes term payloads.-
positionsboolean · default: true If
true, the response includes term positions.-
preferencestring The node or shard the operation should be performed on. It is random by default.
-
realtimeboolean · default: true If true, the request is real-time as opposed to near-real-time.
-
routingRouting A custom value used to route operations to a specific shard. Not allowed when
index.slice.enabledistruefor the target index; use_sliceinstead.-
term_statisticsboolean · default: false If true, the response includes term frequency and document frequency.
-
versionnumber VersionNumber If
true, returns the document version as part of a hit.-
version_typeVersionType 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: Theexternal_gteversion type is meant for special use cases and should be used with care. If used incorrectly, it can result in loss of data.
-
Values:
internalexternalexternal_gte
Request
-
docsOperation -
An array of existing or artificial documents.
-
_idstring Id -
The ID of the document.
-
_indexstring IndexName -
The index of the document.
-
docobject -
An artificial document (a document not present in the index) for which you want to retrieve term vectors.
-
fieldsstring Fields -
Comma-separated list or wildcard expressions of fields to include in the statistics. Used as the default list unless a specific field list is provided in the
completion_fieldsorfielddata_fieldsparameters. -
field_statisticsboolean · default: true -
If
true, the response includes the document count, sum of document frequencies, and sum of total term frequencies. -
filterFilter -
Filter terms based on their tf-idf scores.
-
max_doc_freqnumber -
Ignore words which occur in more than this many docs. Defaults to unbounded.
-
max_num_termsnumber · default: 25 -
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 · default: 0 -
The maximum word length above which words will be ignored. Defaults to unbounded.
-
min_doc_freqnumber · default: 1 -
Ignore terms which do not occur in at least this many docs.
-
min_term_freqnumber · default: 1 -
Ignore words with less than this frequency in the source doc.
-
min_word_lengthnumber · default: 0 -
The minimum word length below which words will be ignored.
-
offsetsboolean · default: true -
If
true, the response includes term offsets. -
payloadsboolean · default: true -
If
true, the response includes term payloads. -
positionsboolean · default: true -
If
true, the response includes term positions. -
routingstring Routing -
Custom value used to route operations to a specific shard.
-
term_statisticsboolean · default: false -
If true, the response includes term frequency and document frequency.
-
versionnumber VersionNumber -
If
true, returns the document version as part of a hit. -
version_typeVersionType -
Specific 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: Theexternal_gteversion type is meant for special use cases and should be used with care. If used incorrectly, it can result in loss of data.
-
Values:
internalexternalexternal_gte -
idsstring Id -
A simplified syntax to specify documents by their ID if they're in the same index.
Response
-
docsTermVectorsResultrequired -
_idstring Id -
_indexstring IndexNamerequired -
_versionnumber VersionNumber -
tooknumber -
foundboolean -
term_vectorsmap string to TermVector -
<string>TermVector -
field_statisticsFieldStatistics -
doc_countnumberrequired -
sum_doc_freqnumberrequired -
sum_ttfnumberrequired -
termsmap string to Termrequired -
<string>Term -
doc_freqnumber -
scorenumber -
term_freqnumberrequired -
tokensToken -
end_offsetnumber -
payloadstring -
positionnumberrequired -
start_offsetnumber -
ttfnumber -
errorErrorCause -
typestringrequired -
The type of error
-
reasonstringnullable -
A human-readable explanation of the error, in English.
-
stack_tracestring -
The server stack trace. Present only if the
error_trace=trueparameter was sent with the request. -
caused_byErrorCause -
root_causeErrorCause -
suppressedErrorCause