Skip to content

Avoid including @Id and @Version in the document source #2466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anton-johansson opened this issue Feb 18, 2023 · 2 comments · Fixed by #2487
Closed

Avoid including @Id and @Version in the document source #2466

anton-johansson opened this issue Feb 18, 2023 · 2 comments · Fixed by #2487
Labels
type: enhancement A general enhancement

Comments

@anton-johansson
Copy link

Hey! I have a document type which has an @Id field and a @Version field. When I save this, it looks like Spring Boot Elasticsearch tries to set these on the document source in addition to the native Elasticsearch fields. Why is this? You can find the code here:
https://github.com/spring-projects/spring-data-elasticsearch/blob/main/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java#L1440

Feels very redundant to have these two properties on the document body as well.

Thoughts? Would it be possible to include some configuration to avoid this behavior?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 18, 2023
@sothawo
Copy link
Collaborator

sothawo commented Feb 18, 2023

The possibility to not add the id to the document source was added in #2438 and is available in the latest milestone release from yesterday (5.1.0-M2).

For the version this would need to be added.

@sothawo sothawo added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 18, 2023
@anton-johansson
Copy link
Author

Oh, that is great! I'll try the release whenever it's released via spring-boot-starter-parent. 🥳

It would be awesome with a similar option for the version.

sothawo added a commit to sothawo/spring-data-elasticsearch that referenced this issue Mar 5, 2023
sothawo added a commit that referenced this issue Mar 5, 2023
@sothawo sothawo added this to the 5.1 M3 (2023.0.0) milestone Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants