# TermVector API in Java

**URL:** <https://discuss.elastic.co/t/termvector-api-in-java/22191>\
**Category:** Elasticsearch\
**Created:** [February 16, 2015, 4:08pm UTC](https://discuss.elastic.co/t/termvector-api-in-java/22191 "2015-02-16T16:08:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klausen\_Schaefersinh](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@Klausen\_Schaefersinh](https://discuss.elastic.co/u/Klausen_Schaefersinh)\
**Post date:** [February 16, 2015, 4:08pm UTC](https://discuss.elastic.co/t/termvector-api-in-java/22191/1 "2015-02-16T16:08:34Z")

</div>

Hi,

I would like to use the termvector API in Java , but I have some issues. I  
tried the following code, but didn't get any term vectors in the response  
object.

final TermVectorResponse termVectorResponse = getClient().termVector(new TermVectorRequest()

```
  .index(this.index)

  .type(this.type)

  .id(aContent.getUrl())

  .termStatistics(true)

  .selectedFields(new String[]{"main", "abs", "title"}))

  .actionGet();

```

1. Do I have to define a mapping upfront, or can how does ElastiSearch  
handle string fields

2. Do I have to user another API? I could not find any method like  
"getTerms" or so in the API.

Thanks a lot!

Klaus

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4aeaf3af-bd9d-433e-90d9-a50b1bbbdd8b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4aeaf3af-bd9d-433e-90d9-a50b1bbbdd8b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:32am UTC](https://discuss.elastic.co/t/termvector-api-in-java/22191/2 "2017-07-06T00:32:26Z")

</div>


