Using painless split function in aggregation


(Mamadou Diop) #1

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


(Christian Dahlqvist) #2

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.


(Ryan Ernst) #3

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)

(Mamadou Diop) #4

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:


(system) #5

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