Based on some guidance in IRC I came across an article to perform a script aggregation based on converting a date field to put results into buckets based on day of week and hour.
This was precisely what I was looking for at the time and tried to leverage the Groovy script in ES but ran into trouble.
I'm running ES 2.3.5 and attempting to use a file-based script as follows:
$ cat /etc/elasticsearch/scripts/dateConversion.groovy Date date = new Date(doc[date_field].value); java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(format); format.format(date)
Once the file is copied to that directory I get the following error in my ES log.
[2016-10-03 21:49:51,633][WARN ][script ] [test.local] failed to load/compile script [dateConversion] ScriptException[failed to compile groovy script]; nested: MultipleCompilationErrorsException[startup failed: 90a12f64b30292c6e82909a8299f6e502d162b9c: 2: unable to resolve class java.text.SimpleDateFormat @ line 2, column 28. java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(format);
This tells me (not a Java or Groovy programmer) that SimpleDateFormat isn't present. However, the following example code compiles and runs fine from the ES node:
I'm clearly missing something, and I'm sure it's painfully obvious to others, but I'd appreciate a bit of guidance if you can. Thanks.