# \[Resolved\]Kibana -issue with defining a string scripted field based on 3 fields

**URL:** <https://discuss.elastic.co/t/resolved-kibana-issue-with-defining-a-string-scripted-field-based-on-3-fields/177024>\
**Category:** Kibana\
**Created:** [April 16, 2019, 8:23am UTC](https://discuss.elastic.co/t/resolved-kibana-issue-with-defining-a-string-scripted-field-based-on-3-fields/177024 "2019-04-16T08:23:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheriemilk](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cheriemilk](https://discuss.elastic.co/u/cheriemilk)\
**Post date:** [April 16, 2019, 8:23am UTC](https://discuss.elastic.co/t/resolved-kibana-issue-with-defining-a-string-scripted-field-based-on-3-fields/177024/1 "2019-04-16T08:23:23Z")

</div>

Hi team,

I have below 3 fields in elasticsearch.

- companyId whose type is text&keyword
- userId whose type is text&keyword
- actionType whose type is text&keyword

I want to connect create a new script fields with connecting the values of 2 fields, and the type of new field should be text&keyword as well.

my script : doc['companyId'].values + doc['userId'].values + doc['actionType'].values.  
But there is error in Kibana UI. How should I get rid of it if + is not supported, what is the correct syntax??

```
class_cast_exception: Cannot apply [+] operation to types [org.elasticsearch.index.fielddata.ScriptDocValues.Strings] and [org.elasticsearch.index.fielddata.ScriptDocValues.Strings].
```

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [April 16, 2019, 8:54am UTC](https://discuss.elastic.co/t/resolved-kibana-issue-with-defining-a-string-scripted-field-based-on-3-fields/177024/2 "2019-04-16T08:54:55Z")

</div>

Hi @cheriemilk,

I guess it should look like this instead `doc['companyId.keyword'].value + doc['userId.keyword'].value + doc['actionType.keyword'].value`? IIRC the field should be searchable and aggregatable to use it in a scripted field, so you can't use `text`.

Best,  
Oleg

---

<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:** [May 14, 2019, 8:55am UTC](https://discuss.elastic.co/t/resolved-kibana-issue-with-defining-a-string-scripted-field-based-on-3-fields/177024/3 "2019-05-14T08:55:03Z")

</div>

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