# How to get data in Painless script variable

**URL:** <https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960>\
**Category:** Elasticsearch\
**Created:** [May 8, 2017, 5:06pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960 "2017-05-08T17:06:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnallapati](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cnallapati](https://discuss.elastic.co/u/cnallapati)\
**Post date:** [May 8, 2017, 5:06pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/1 "2017-05-08T17:06:59Z")

</div>

Hi,

One of a field(url) stores 'url' information and I am trying to get it's value from painless script by doc['url.keyword'].value .Sometimes if the value is less then 100 characters it's getting but not for more than 100 characters.

What's the maximum length to get value in painless script variable and how to get field value if it's length exceeds.

I am using Kibana 5.1

Please advise.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [May 8, 2017, 6:16pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/2 "2017-05-08T18:16:24Z")

</div>

Hi

As far as Painless script is concerned, there should be no limit. But I on't think this is directly a painless issue actually. Can you let us know know what your index settings/ field\_mappings are, that would be helpful. Painless should be pulling over exactly what is in that field.

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![cnallapati](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cnallapati](https://discuss.elastic.co/u/cnallapati)\
**Post date:** [May 8, 2017, 8:48pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/3 "2017-05-08T20:48:47Z")

</div>

Hi Rashmi,

Please see attached screen shot for fielmapping value.

Thanks,  
Chaitanya.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/3/e/3e86bbfb27ff8b97c7c33839ad30341a3e4d369a.JPG)

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [May 8, 2017, 9:10pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/4 "2017-05-08T21:10:22Z")

</div>

Hi

Can you please return the results of a search for specifically that field with examples of both urls under 100 characters and urls over 100 characters. Without using painless do a search just use that as a return field. That would help to ensure the field is behaving as you believe it is. Let us know the results.

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![cnallapati](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cnallapati](https://discuss.elastic.co/u/cnallapati)\
**Post date:** [May 8, 2017, 9:20pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/5 "2017-05-08T21:20:21Z")

</div>

Hi,

I tested with painless script and it's handling upto 256 characters.

If I holding url values, I can extract data from it. I think it's not possible in regular search.

Thanks,  
Chaitanya.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [May 8, 2017, 9:38pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/6 "2017-05-08T21:38:52Z")

</div>

So I'll move your post to ES forum. Some one can take a look there.

Thanks  
Rashmi

---

<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:** [June 5, 2017, 9:50pm UTC](https://discuss.elastic.co/t/how-to-get-data-in-painless-script-variable/84960/7 "2017-06-05T21:50:44Z")

</div>

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