String manipulation in painless script


(Misbah Uddin) #1

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?


(Alexander Reelsen) #2

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


(system) #4

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