Skip to content

Conversation

@axlewin
Copy link
Contributor

@axlewin axlewin commented Jan 12, 2026

Replaces the high-level REST client previously used for Elasticsearch with the new(er) Java API client. This is necessary to allow Elasticsearch to be upgraded from v7, but this PR does not actually upgrade the version.

Properly nest the expected queries
@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 31.81818% with 255 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.79%. Comparing base (e375ca8) to head (81726eb).
⚠️ Report is 59 commits behind head on main.

Files with missing lines Patch % Lines
...cam/cl/dtg/segue/search/ElasticSearchProvider.java 43.19% 137 Missing and 9 partials ⚠️
.../ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java 0.00% 81 Missing ⚠️
...am/cl/dtg/segue/dao/content/GitContentManager.java 8.00% 23 Missing ⚠️
...cam/cl/dtg/segue/dao/schools/SchoolListReader.java 0.00% 3 Missing ⚠️
...ava/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java 0.00% 1 Missing ⚠️
...c/cam/cl/dtg/segue/etl/ETLConfigurationModule.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #744      +/-   ##
==========================================
- Coverage   36.84%   36.79%   -0.05%     
==========================================
  Files         540      540              
  Lines       23642    23795     +153     
  Branches     2825     2834       +9     
==========================================
+ Hits         8711     8756      +45     
- Misses      14056    14158     +102     
- Partials      875      881       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

generateBoolMatchQuery is deprecated; it would be nice to remove it entirely, but for now just replace it where it is straightforward to do so

// Assert
assertEquals(expectedQuery, actualQuery);
assertEquals(expectedQuery.toString(), actualQuery.toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason these tests fail if the queries are compared as Queries. I don't like using toString() as a workaround, but I don't have a better solution.

@axlewin axlewin marked this pull request as ready for review January 13, 2026 09:42
Comment on lines +494 to +503
filter.must(RangeQuery.of(r -> {
r.field(fieldToFilterInstruction.getKey());
if (dateRangeInstruction.getFromDate() != null) {
r.gte(JsonData.of(dateRangeInstruction.getFromDate().getTime()));
}
if (dateRangeInstruction.getToDate() != null) {
r.lte(JsonData.of(dateRangeInstruction.getToDate().getTime()));
}
return r;
})._toQuery());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure of RangeQuery builders is temporary for while we're on the new client but still Elasticsearch v7; once we upgrade the Elasticsearch version we can use the clearer date-based syntax (see https://github.com/isaacphysics/isaac-api/blob/improvement/es-upgrade-v8/src/main/java/uk/ac/cam/cl/dtg/segue/search/ElasticSearchProvider.java#L494-L505)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants