# Termvector api fails for artificial document

**URL:** <https://discuss.elastic.co/t/termvector-api-fails-for-artificial-document/261761>\
**Category:** Elasticsearch\
**Created:** [January 21, 2021, 10:09am UTC](https://discuss.elastic.co/t/termvector-api-fails-for-artificial-document/261761 "2021-01-21T10:09:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![murari\_tikmani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murari_tikmani/32/82655_2.png) [@murari\_tikmani](https://discuss.elastic.co/u/murari_tikmani)\
**Post date:** [January 21, 2021, 10:09am UTC](https://discuss.elastic.co/t/termvector-api-fails-for-artificial-document/261761/1 "2021-01-21T10:09:54Z")

</div>

I have a use case where I want to find the score of each word in my artificial document when compared against existing corpus.

For that I am using termvector api on an artificial document.  
The api fails if we use "filter" AND "there are words in the artificial document that doesn't exist in the index"

ex:

{  
"doc" : {  
"PROB\_DESC": " My Name is Murari Tikmani "  
},  
"fields":["PROB\_DESC"],  
"term\_statistics": true,  
"field\_statistics": true,  
"positions": false,  
"offsets": false,  
"filter" : {  
"min\_term\_freq": 0,  
"min\_doc\_freq": 2  
}  
}

The above returns error. If I remove the "filter" from the above, I get term statistics in which I see that for Murari {tf=1} and there is no df mentioned.

filter is a must for me because only after i provide the filter, I can get the score

---

<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:** [February 18, 2021, 10:09am UTC](https://discuss.elastic.co/t/termvector-api-fails-for-artificial-document/261761/2 "2021-02-18T10:09:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
