# Scripted field is not showing value of destination.domain field

**URL:** <https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499>\
**Category:** Kibana\
**Created:** [September 30, 2020, 12:01pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499 "2020-09-30T12:01:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dubru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dubru/32/45511_2.png) [@Dubru](https://discuss.elastic.co/u/Dubru)\
**Post date:** [September 30, 2020, 12:01pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499/1 "2020-09-30T12:01:47Z")

</div>

Hi,

I am using ElasticSearch and Kibana 7x version, I am trying to concatenate two fields values.

Before I write actual concatenation painless script, I tried accessing field values from scripted field.

when I run the query `doc['destination.domain'].value` it is not giving any values instead it is showing `[]`  
But the actual values of `destination.domain` field is something like `test.mydomain.com`.

What could be the issue causing this error?

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [October 5, 2020, 5:33pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499/2 "2020-10-05T17:33:17Z")

</div>

hello,  
Can you show us the entire script and a sample document?

---

<div class="post-metadata">

**Author:** ![Dubru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dubru/32/45511_2.png) [@Dubru](https://discuss.elastic.co/u/Dubru)\
**Post date:** [October 6, 2020, 1:58pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499/3 "2020-10-06T13:58:23Z")

</div>

Somehow it is showing the null value `[]` in preview results. But when I create the field and access the value from discover section, the value is coming properly. The script I wrote like

```auto
if (doc['destination.domain'].size()!=0 && doc['file.val'].size()!=0){ 
    return doc['destination.domain'].value + '' + doc['file.val''].value
}

```

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [October 11, 2020, 9:10pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499/4 "2020-10-11T21:10:58Z")

</div>

If it shows `[]` in the preview results is due to there being no documents in the last 10 that match your script, for example those with `destination.domain` being empty.

---

<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:** [November 8, 2020, 9:11pm UTC](https://discuss.elastic.co/t/scripted-field-is-not-showing-value-of-destination-domain-field/250499/5 "2020-11-08T21:11:00Z")

</div>

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