Get multiple term vectors
Generally available
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 authorization
- Index privileges:
read
Query parameters
-
A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
-
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
orfielddata_fields
parameters. -
If
true
, the response includes the document count, sum of document frequencies, and sum of total term frequencies. -
If
true
, the response includes term offsets. -
If
true
, the response includes term payloads. -
If
true
, the response includes term positions. -
The node or shard the operation should be performed on. It is random by default.
-
If true, the request is real-time as opposed to near-real-time.
-
A custom value used to route operations to a specific shard.
-
If true, the response includes term frequency and document frequency.
-
If
true
, returns the document version as part of a hit. -
The version type.
Values are
internal
,external
,external_gte
, orforce
.
curl \
--request GET 'http://api.example.com/_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}"'
{
"docs": [
{
"_id": "2",
"fields": [
"message"
],
"term_statistics": true
},
{
"_id": "1"
}
]
}
{
"ids": [ "1", "2" ],
"fields": [
"message"
],
"term_statistics": true
}
{
"docs": [
{
"_index": "my-index-000001",
"doc" : {
"message" : "test test test"
}
},
{
"_index": "my-index-000001",
"doc" : {
"message" : "Another test ..."
}
}
]
}