Skip to content

Conversation

@parazit-IR
Copy link

Relates to #591.

This PR adds a small Spring Data Elasticsearch example that demonstrates using
org.springframework.data.elasticsearch.core.query.Criteria against a nested field.

Changes:

  • Introduced a Talk document with a speakers field annotated as @Field(type = FieldType.Nested).
  • Added a simple Speaker value object.
  • Extended ElasticsearchOperationsTest with criteriaQueryOnNestedSpeakers(), which:
    • saves one Talk with a nested Speaker,
    • saves another Talk without speakers,
    • runs a CriteriaQuery on speakers.name,
    • asserts that only the matching talk is returned.

Note:
On my local machine, the existing ElasticsearchOperationsTest fails to start the
ApplicationContext with a DataAccessResourceFailureException when initializing ConferenceRepository:

status: 400, [es/indices.exists] Expecting a response body, but none was sent.

This also happens on a clean checkout of main.
The changes in this PR are limited to adding the nested Criteria example and do not modify
the existing Elasticsearch configuration.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 29, 2025
mp911de and others added 4 commits November 29, 2025 20:01
Closes spring-projects#693

Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Enable disabled examples, increment Hibernate version due to missing plugin.

Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
@parazit-IR parazit-IR force-pushed the feature/elasticsearch-nested-criteria branch from ce2d06c to 0508dd9 Compare November 29, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants