String manipulation in painless script

I need to compute some scores using query string and title of a document, which are not exposed by elasticsearch. I need to split a string to a list as follows: 'applie pie' --> ['apple', 'pie'] . I am using custom script scoring by painless scripts.

How can I do that?

Hey,

you can try sth like "ctx._source.foo = /,/.split(ctx._source.foo)" - but this requires you to explicitely enable regexes, as those are not considered secure.

--Alex

1 Like

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