Using painless split function in aggregation

Hello,

I am trying to use the painless script split function in my AWS elasticsearch cluster but it does not seem to be working. I get "Unable to find dynamic method [split] with [1] arguments for class [java.lang.String]."

Any idea?

Many thanks

I would recommend doing that kind of processing before you index the data. Even it is possible (not sure it is) it will be quite slow to do this at query time and not scale very well.

The split function for String is not exposed in painless. To use the equivalent, you need to have regexes enabled, and get a Pattern with slashy strings. Something like this iirc:

/?/.split(value)
2 Likes

As I am using elasticsearch through AWS I am not able to configure the elasticsearch.yml to enable regex. I found a way around it by using the substring method.

Thanks for the answer :slight_smile:

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