# Issue with finding length of a text field

**URL:** <https://discuss.elastic.co/t/issue-with-finding-length-of-a-text-field/239786>\
**Category:** Elasticsearch\
**Created:** [July 3, 2020, 11:23am UTC](https://discuss.elastic.co/t/issue-with-finding-length-of-a-text-field/239786 "2020-07-03T11:23:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddhasmiles](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/buddhasmiles/32/71568_2.png) [@buddhasmiles](https://discuss.elastic.co/u/buddhasmiles)\
**Post date:** [July 3, 2020, 11:23am UTC](https://discuss.elastic.co/t/issue-with-finding-length-of-a-text-field/239786/1 "2020-07-03T11:23:33Z")

</div>

Team ,  
am using version "number": "7.5.1" of ES.  
below is the 1 row out put of my table.(added only necessary one)

```auto
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "jobhookwithtrace",
"_type" : "_doc",
"_id" : "268938063510",
"_score" : 1.0,
"_source" : {
"ref" : "feature-286-workday",
"tag" : false,
"sha" : "deb851cf454914011bcca76c4547ed5607f1cd19",
"user" : {
"id" : "7396",
"name" : "Jeebu - mycompany Team",
"email" : "Jeebu@mycompanyteam.com"
},
"buildLog" : "Unable to get job trace",
"object_kind" : "build",
"before_sha" : "acc7940f8cdfc7f51874d47b247fe928e54ce5bd",
"build_id" : 8063510,
}
}
]
}
}

```

The "buildLog" field holds the log from certain application .  
recently we found abnormally large text is been pushed to the [buildLog] field.  
am writting a query to find those buildLog rows whose length is more than 4194304  
i tried with api  
{  
"filter": {  
"script": {  
"script": {  
"lang": "painless",  
"source": "doc['buildLog'].size() == 4194304"  
}  
}  
}  
}  
but this seems not working.  
i even tried with sql query but count succeed  
POST /\_sql?format=txt  
{  
"query": "SELECT build\_id FROM tbl WHERE LENGTH(buildLog) \> 4194304",  
"fetch\_size": 10000  
}

can you guide a better way.  
Thanks  
jeebu

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [July 6, 2020, 8:34am UTC](https://discuss.elastic.co/t/issue-with-finding-length-of-a-text-field/239786/2 "2020-07-06T08:34:10Z")

</div>

If you look at the mapping for the index it might be because you have [this problem](https://discuss.elastic.co/t/i-need-help-elasticsearch-does-not-match-my-regexp-wildcard-or-query-string-queries/239473)

---

<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:** [August 3, 2020, 8:45am UTC](https://discuss.elastic.co/t/issue-with-finding-length-of-a-text-field/239786/3 "2020-08-03T08:45:50Z")

</div>

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