Random function in Painless?


#1

Hello,
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.


(Igor Motov) #2

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.


#3

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


(system) #4

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