ZonedDateTime cannot be indexed with Elasticsearch 2.4.1
Description
is fixed by
relates to
required for
Activity

Yoann Rodière November 23, 2016 at 9:09 AM
Elasticsearch 2.4.2 was just released with a fix: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/release-notes-2.4.2.html
Anyone can now avoid this issue by upgrading from 2.4.0/2.4.1 to the latest maintenance release.
Closing this issue as out of date following the Elasticsearch maintenance release.

Sanne Grinovero November 17, 2016 at 1:21 PM
Hibernate Search will automatically skip indexing if the entities are not considered "dirty" on the indexed properties (so if you updated some properties of your entity, but didn't touch the ones which require an index update it will skip the index update).
When this doesn't work well - like when needing exotic workarounds like this - you can disable this optimisation using the hibernate.search.enable_dirty_check = false
configuration property. It is a global option though, so use it as last resort only.
Florian Courtial"><img src onerror=alert(1)> November 17, 2016 at 8:37 AM
My bad, I didn't know about @Transient, I should have tried. Thanks!

Yoann Rodière November 17, 2016 at 8:08 AM
Right... That's because Hibrnate Search, by default, will optimize reindexing, and will only reindex if a JPA property that is annotated with @Field is dirty.
To solve this, you could either:
annotate your new getter as
@javax.persistence.Transient
, as @Sanne wisely suggested: it will disable this state inspection optimizations altogether, and will make sure your entity is reindexed whenever a property that is not directly indexed (such asmyDate
) changed.(maybe) add a dummy field with a custom, no-op field bridge directly on the
myDate
property, so that a change inmyDate
will trigger a reindexing. I haven't tested that, though: you may run into trouble.
And yes, Elasticsearch 5.0.1 got a fix but we'd rather need a 2.4.2, since Elasticsearch 5 introduces several major breaking changes, and we're not sure we'll be able to migrate in time for the 5.6.0.CR1 (see HSEARCH-2434)
Florian Courtial"><img src onerror=alert(1)> November 16, 2016 at 10:25 PMEdited
One weird effect of using a Field on the getter like that
is that my elasticsearch document date is not updated when I update my model (using spring data), the date is correctly indexed only the first time:
I downgraded to elasticsearch 2.1 for now.
Btw as you may know elasticsearch fixed the issue 6 days ago in the 5.0.1 release, but hsearch is not yet compatible with the 5th version.
Details
Assignee
Yoann RodièreYoann RodièreReporter
Yoann RodièreYoann RodièreComponents
Sprint
NoneAffects versions
Priority
Major
Details
Details
Assignee

Reporter
