Random function in Painless?

What is the way to genereate a random value in Painless?

Being able to draw one value from a set would be particularly great - I want to use it to add a new field to my mock data and I need a possibility to add one of the statuses ('Working', 'Archived', 'InReview') to my documents at random.

You have access to Random in painless. Alternatively, if you have something like a timestamp in your mock data, you can calculate something like timestamp % 3 and assign 'Working', 'Archived', or 'InReview' based on the value.

1 Like

Thank you, that's what I was looking for!

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