How can I do date-calculation/conversion in an MVEL script in ES 1.0.0?


I'm considering upgrading from 0.90.3 to 1.0.0, but I've hit a snag with
one of the MVEL scripts I use to update documents through the update api.
My update-script uses Joda to parse/format/manipulate dates, but it appears
that Joda is no longer available to MVEL scripts in version 1.0.0. (I think
it changed in commit c7f6c52 from november 24th, so it's been like that for
a while)

Here are some code-snippets of how it currently works

parser = Joda.forPattern('dateOptionalTime').parser();
lastdate = parser.parseMillis(;
prevdate = parser.parseMillis(ctx._source.published);
timediff = lastdate-prevdate;
ctx._source.nextupdate =

Is there some way to do similar date/time calculations in ES 1.0.0?

I've considered I could use a native script to do these updates; however,
when I wrote the update-script I tested this, and to my surprise using a
native script proved to be significantly slower than using the MVEL script
for this use-case.

Any help would be much appreciated,
-- Harmen

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit