It might be fixed in ES 6, but at least in Elasticsearch 5, calling .onMissingValue().use( ... ) on a LocalDate field leads to a failure to parse the date on the Elasticsearch side.
Verified in ES 5.4 and 5.6.5.
We should check later versions and report it if necessary, or adapt our code if it's not a bug.
Note that sending a integer value works correctly, see for example the codec for Instant. Maybe we should have two "encode" methods in the codec, one for the sort and one for everything else?