Comparison (<) not supported on datetime fields anymore since upgrade to 6.1

I have a scripted field that looks something like this:

(doc['actual_time'].value < doc['expected_time'].value) ? 1 : 0

Since the upgrade to 6.1 I'm getting the following error:

caused_by":{"type":"class_cast_exception","reason":"Cannot apply [<] operation to types [org.joda.time.MutableDateTime] and [org.joda.time.MutableDateTime]."

The error message is rather confusing, as accoriding to http://joda-time.sourceforge.net/apidocs/org/joda/time/MutableDateTime.html The MutableDateTime class implements Comparable and should therefore support < comparisons.

What's the correct way to compare timestamp fields in 6.1?

Thanks in advance,
Simon

Can you call then getMillis()?

http://joda-time.sourceforge.net/apidocs/org/joda/time/base/BaseDateTime.html#getMillis()

1 Like

Yep, that does it as a workaround. Thanks! :grinning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.