I wasn't sure where to post this, since it's specific to the painless language, but given that I'm using thing from Alerting I figured this was the appropriate category.
I'm trying to URLencode a string, which should be possible with the following code:
However, Painless does not seem to include the method .getBytes() on java.lang.String, which makes the encodeToString a bit useless. Is there any way to convert a string to a byte-array (the parameter type of encodeToString) in Painless.
That does not produce a URL encoded string. Base64.getUrlEncoder() returns a URL-safe base64 encoder - that is, it is a Base64 encoder that only uses characters that are "url-safe". Specifically it uses _ and - for the 2 non-alphnumeric characters and doesn't include newlines.
That is not a URL encoder.
Unfortunately, I don't believe painless includes support for URL encoding.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.