| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | [[docs-multi-termvectors]]== Multi termvectors APIMulti termvectors API allows to get multiple termvectors at once. Thedocuments from which to retrieve the term vectors are specified by an index,type and id. But the documents could also be artificially providedThe response includes a `docs`array with all the fetched termvectors, each element having the structureprovided by the <<docs-termvectors,termvectors>>API. Here is an example:[source,js]--------------------------------------------------curl 'localhost:9200/_mtermvectors' -d '{   "docs": [      {         "_index": "testidx",         "_type": "test",         "_id": "2",         "term_statistics": true      },      {         "_index": "testidx",         "_type": "test",         "_id": "1",         "fields": [            "text"         ]      }   ]}'--------------------------------------------------See the <<docs-termvectors,termvectors>> API for a description of possible parameters.The `_mtermvectors` endpoint can also be used against an index (in which case itis not required in the body):[source,js]--------------------------------------------------curl 'localhost:9200/testidx/_mtermvectors' -d '{   "docs": [      {         "_type": "test",         "_id": "2",         "fields": [            "text"         ],         "term_statistics": true      },      {         "_type": "test",         "_id": "1"      }   ]}'--------------------------------------------------And type:[source,js]--------------------------------------------------curl 'localhost:9200/testidx/test/_mtermvectors' -d '{   "docs": [      {         "_id": "2",         "fields": [            "text"         ],         "term_statistics": true      },      {         "_id": "1"      }   ]}'--------------------------------------------------If all requested documents are on same index and have same type and also the parameters are the same, the request can be simplified:[source,js]--------------------------------------------------curl 'localhost:9200/testidx/test/_mtermvectors' -d '{    "ids" : ["1", "2"],    "parameters": {    	"fields": [         	"text"      	],      	"term_statistics": true,      	…    }}'--------------------------------------------------Additionally, just like for the <<docs-termvectors,termvectors>>API, term vectors could be generated for user provided documents. The syntaxis similar to the <<search-percolate,percolator>> API. The mapping used isdetermined by `_index` and `_type`.[source,js]--------------------------------------------------curl 'localhost:9200/_mtermvectors' -d '{   "docs": [      {         "_index": "testidx",         "_type": "test",         "doc" : {            "fullname" : "John Doe",            "text" : "twitter test test test"         }      },      {         "_index": "testidx",         "_type": "test",         "doc" : {           "fullname" : "Jane Doe",           "text" : "Another twitter test ..."         }      }   ]}'--------------------------------------------------
 |