# Length of a field - Multi-line

**URL:** https://discuss.elastic.co/t/length-of-a-field-multi-line/256300
**Category:** Elasticsearch
**Tags:** painless
**Created:** [November 23, 2020, 4:48am UTC](https://discuss.elastic.co/t/length-of-a-field-multi-line/256300 "2020-11-23T04:48:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bevano](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bevano](https://discuss.elastic.co/u/bevano)
#### Post date: [November 23, 2020, 4:48am UTC](https://discuss.elastic.co/t/length-of-a-field-multi-line/256300/1 "2020-11-23T04:48:20Z")

</div>

Hi All,  
Need some help with writing a query. I have a field called receipttext (mapped as a text and keyword) and it contains data that spans over multiple lines (eg. think of a receipt that you get from a purchase).

I am trying to write a query to brings back all the documents that have over 700 characters (this is an issue I'm troubleshooting). I have this so far, but its not working as expect. Any ideas?

```auto
    {
      "query": {
        "bool": {
          "filter": [
            {
              "script": {
                "script": "doc['receipttext.keyword'].length > 700"
              }
            }
          ]
        }
      }
    }

```

---

<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: [December 21, 2020, 4:48am UTC](https://discuss.elastic.co/t/length-of-a-field-multi-line/256300/2 "2020-12-21T04:48:44Z")

</div>

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