You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can we use internal versioning of Elasticsearch?
Elsticsearch has a possibility to use internal (managed by ES) or external (managed in code) types of version to implement optimistic locking (https://www.elastic.co/blog/elasticsearch-versioning-support). Currently, if an entity field marked with @org.springframework.data.annotation.Version the external version type is always used.
On the other hand, the Spring Data Rest also uses @Version mechanism to implement ETag and If-Match headers handling. This means that if we want to use this mechanism, we're forced to use ES optimistic locking and external ES versioning.
So, it would be great if we can specify which version mechanism we want to use. Note, same issue is with the spring-data-elasticsearch.
Possible solution: Introduce a new optional annotation on a version field or, probably more appropriate, on a repository to specify a version type, e.g. @VersionType(EXTERNAL). For example:
How can we use internal versioning of Elasticsearch?
Elsticsearch has a possibility to use internal (managed by ES) or external (managed in code) types of version to implement optimistic locking (https://www.elastic.co/blog/elasticsearch-versioning-support). Currently, if an entity field marked with
@org.springframework.data.annotation.Version
the external version type is always used.On the other hand, the Spring Data Rest also uses
@Version
mechanism to implementETag
andIf-Match
headers handling. This means that if we want to use this mechanism, we're forced to use ES optimistic locking and external ES versioning.So, it would be great if we can specify which version mechanism we want to use. Note, same issue is with the spring-data-elasticsearch.
Possible solution: Introduce a new optional annotation on a version field or, probably more appropriate, on a repository to specify a version type, e.g.
@VersionType(EXTERNAL)
. For example:or on repository class:
Workaround: implement a custom repo taking care of version increment.
The text was updated successfully, but these errors were encountered: