Hi,
I am trying to use the reindex api to create a copy of a set of documents. One of the fields (productId) of the document is a UUID. I need the copied documents to have new UUIDs for the productId field.
Please note, simply using the elastic search _id field is not an option as services using these documents depend on this field being a valid UUID.
According to [1] and [2] the method java.util.UUID.randomUUID() is not whitelisted for use in painless scripts.
Questions:
-
Why is randomUUID() considered an unsafe operation? Or is it just an oversight that it is not whitelisted?
-
What would be the process for whitelisting this method on our ES server? I have read [3] which describes supplying our own java policy file on jvm startup. The problem with this is that I don't really want to overwrite all the existing policies but only add to them. Is there a way to do this?
-
Will the approach described in [3] really work for painless whitelisting. Looking at the source, it seems there is a separate framework for whitelisting java classes for painless here [4].
Cheers
Oliver
Details:
- Elastic Search: 6.4.2
- Deploying to kubernetes with helm (https://github.com/elastic/helm-charts/tree/master/elasticsearch)
References:
[1] - Generate a UUID using randomuuid in painless
[2] - https://www.elastic.co/guide/en/elasticsearch/painless/6.4/painless-api-reference.html
[3] - https://www.elastic.co/guide/en/elasticsearch/reference/6.4/modules-scripting-security.html
[4] - https://github.com/elastic/elasticsearch/blob/master/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/java.util.txt