spring-projects / spring-projects/spring-data-examples

Feature Suggestion: Add an example for updating a document

Open
#698 3 comments 0 reactions 1 assignee View on GitHub

@AshenScribe is already working on this.

Since Aug 11, 2025.

status: ideal-for-contribution type: enhancement
Dominant language
Java
Stars
5.4k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I was going through the spring-data-elasticsearch-examples and found them incredibly helpful for getting started. I noticed that the examples cover creating, searching, and deleting documents really well, which is great for the basic CRUD operations.

However, I couldn't find a clear example of how to update an existing document. For someone learning the ropes, seeing the standard pattern for "get a document, change something, and save it back" would be super useful and would make the examples feel more complete.

I have a couple of ideas on how this could be added cleanly:

  • A new test in ElasticsearchOperationsTest.java that finds a conference, adds a new keyword to it, saves it, and then checks that the update worked.
  • The same kind of test in ReactiveElasticsearchOperationsTest.java to show how it's done in the reactive world.

This seems like a straightforward way to demonstrate a really common use case without cluttering the main application code.

I'd be more than happy to put together a pull request for this if you think it's a good idea. Let me know what you think!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.