# How to get tokens for a document?

**URL:** <https://discuss.elastic.co/t/how-to-get-tokens-for-a-document/110083>\
**Category:** Elasticsearch\
**Created:** [December 4, 2017, 3:06am UTC](https://discuss.elastic.co/t/how-to-get-tokens-for-a-document/110083 "2017-12-04T03:06:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![effendisusanto](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@effendisusanto](https://discuss.elastic.co/u/effendisusanto)\
**Post date:** [December 5, 2017, 5:12am UTC](https://discuss.elastic.co/t/how-to-get-tokens-for-a-document/110083/2 "2017-12-05T05:12:40Z")

</div>

Hi Vidy,

Yesterday I asked the same question, you can read the answer on the elasticsearch guide,

[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html)

Based on that guide, you can retrive the token on document by the following query :

GET /twitter/tweet/1/\_termvectors  
{  
"fields" : ["text"],  
"offsets" : true,  
"payloads" : true,  
"positions" : true,  
"term\_statistics" : true,  
"field\_statistics" : true  
}

Hope it save your night 😃

---

_[View the full topic](https://discuss.elastic.co/t/how-to-get-tokens-for-a-document/110083)._
