# Doc.length starts counting approximately starting from 41 tokens

**URL:** <https://discuss.elastic.co/t/doc-length-starts-counting-approximately-starting-from-41-tokens/244215>\
**Category:** Elasticsearch\
**Created:** [August 7, 2020, 7:37pm UTC](https://discuss.elastic.co/t/doc-length-starts-counting-approximately-starting-from-41-tokens/244215 "2020-08-07T19:37:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_D](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Alex\_D](https://discuss.elastic.co/u/Alex_D)\
**Post date:** [August 7, 2020, 7:37pm UTC](https://discuss.elastic.co/t/doc-length-starts-counting-approximately-starting-from-41-tokens/244215/1 "2020-08-07T19:37:08Z")

</div>

Hi all !

I founded that doc.length variable starts counting approximately starting from 41 tokens in a document.  
Could anyone prompt, is it expected behavior ?  
I am trying to use scripted similarity and it's important to get exact count of tokens in a document.  
I also attach a diagram with the results of my testing.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/7/b7224c168d6ec98e7c1bb8598f1cfd28c0e03a0b.png)  
Thanks !

My ES version: 7.8.1

---

<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:** [September 4, 2020, 7:37pm UTC](https://discuss.elastic.co/t/doc-length-starts-counting-approximately-starting-from-41-tokens/244215/2 "2020-09-04T19:37:19Z")

</div>

Closed on September 4, 2020, 7:37pm UTC

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