I am trying to whitelist some additional Java functions in painless.
I am using the ExampleWhitelistExtension as example. I compiled it and installed it on to my elasticsearch server.
But it doesn't seem to work, I cannot perform the queries that are in tests on this commit
So I am not sure what else I need to do, do I need to restart elasticsearch for the plugin to be loaded? I am pretty sure my version of elasticsearch should contain this new whilelisting ability. But there is not much in the documentation that I can see regarding any of this.
Okay so now I know what is going on.... and I may need to open up a issue instead.
So the reboot helped and I can useExampleWhitelistedClass in scripted_fields like the test in the commit but does not work in Terms Aggregations like the following.
The example whitelist plugin is only an example. Specifically, it adds the whitelisted classes and methods to the SearchScript context. Each place in Elasticsearch which use scripts have different variables they expect to be available. For example, in a search script, a _score is provided to the script (note that scripted fields use the SearchScript context due to legacy reasons, but this will eventually be corrected). In order to add the example whitelist to aggregations, you would need to add it to SearchScript.AGGS_CONTEXT (again, the fact this is also a "search script" is for legacy reasons and will eventually be fixed). See ExampleWhitelistExtension.java in the example plugin for where it maps the context to the whitelist.
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.