Unable to Whitelist Java Classes in Elasticsearch 5.0-rc1


(Ravi Teja Meka) #1

Can anyone help me to whitelist joda.time classes in Elasticsearch-5.0-rc1.

I tried whitelisting for elasticsearch user as given here: https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-scripting-security.html#_customising_the_classloader_whitelist

Even after whitelisting like this:

grant {
   permission org.elasticsearch.script.ClassPermission "*";
};

This query is return error:

POST index/_search
{
   "size": 0,
   "aggs": {
      "asdd": {
         "scripted_metric": {
            "map_script": "1",
            "reduce_script": "def b = new DateTime(); b"
         }
      }
   }
}

Here is the response for above query:

{
   "error": {
      "root_cause": [],
      "type": "reduce_search_phase_exception",
      "reason": "[reduce] ",
      "phase": "fetch",
      "grouped": true,
      "failed_shards": [],
      "caused_by": {
         "type": "script_exception",
         "reason": "compile error",
         "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "invalid sequence of tokens near ['DateTime'].",
            "caused_by": {
               "type": "no_viable_alt_exception",
               "reason": null
            }
         },
         "script_stack": [
            "def b = new DateTime(); b",
            "            ^---- HERE"
         ],
         "script": "def b = new DateTime(); b",
         "lang": "painless"
      }
   },
   "status": 503
}

(system) #2