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

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].

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.


1 Like

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