(#78) Elasticsearch 8 update#82
Open
blairlearn wants to merge 1 commit into
Open
Conversation
9d25ece to
ff57678
Compare
02af708 to
ba99fbe
Compare
b3daf85 to
8d653c8
Compare
8c9c5af to
0e9c6f6
Compare
There was a problem hiding this comment.
Pull request overview
Updates the BestBets API and its tests/integration setup to work with Elasticsearch 8 by migrating off NEST/Newtonsoft.Json and aligning serialization/query behavior with the new official ES .NET client.
Changes:
- Replace NEST/Elasticsearch.Net with
Elastic.Clients.Elasticsearch(ES 8) in services and tests. - Migrate JSON handling from Newtonsoft.Json to
System.Text.Jsonand update models/serialization expectations. - Update integration-test Docker images/config and CI workflow to ES 8-compatible versions.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Util/BestBetsMatchComparer.cs | Removes unused usings after test refactors. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/TestDataObjects/ESMatchTestObjects/ESMatchTokenizerConnection.cs | Removes old NEST-based tokenizer connection test helper. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/TestDataObjects/ESMatchTestObjects/ESMatchConnection.cs | Removes old NEST-based match connection test helper. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/TestDataObjects/ESHealthTestObjects/ESHealthTokenizerConnection.cs | Removes old NEST-based health tokenizer connection helper. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/TestDataObjects/ESHealthTestObjects/ESHealthConnection.cs | Removes old NEST-based health connection helper. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/TestDataObjects/ESErrorTestObjects/ESErrorConnection.cs | Removes old NEST-based error connection helper. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Services/TestServiceBase.cs | Cleans up usings after test changes. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Services/ESTokenAnalyzerServiceTests.cs | Updates token analyzer tests to ES 8 client + System.Text.Json; converts async void to async Task. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Services/ESBestBetsMatchServiceTests.cs | Refactors match service tests to ES 8 client mocking utilities and updated query JSON shapes. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Services/ESBestBetsHealthServiceTests.cs | Updates health tests to ES 8 client mocking; converts async void to async Task. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Services/ESBestBetsDisplayServiceTests.cs | Updates display tests to ES 8 client mocking; converts async void to async Task. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Models/IBestBetDisplayComparer.cs | Minor whitespace/comment cleanup and using ordering. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Models/IBestBetCategoryComparer.cs | Minor whitespace/comment cleanup and using ordering. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Models/ArrayComparer.cs | Minor whitespace/comment cleanup and using ordering. |
| test/NCI.OCPL.Api.BestBets.Tests/Tests/Controllers/BestBetsControllerTests.cs | Converts async void to async Task; removes unused legacy ES/NEST usings. |
| test/NCI.OCPL.Api.BestBets.Tests/NCI.OCPL.Api.BestBets.Tests.csproj | Moves to net8.0 and updates test dependencies/Common packages. |
| src/NCI.OCPL.Api.BestBets/Startup.cs | Removes unused usings after dependency/client migration. |
| src/NCI.OCPL.Api.BestBets/Services/ESTokenAnalyzerService.cs | Migrates analyzer calls to ES 8 client APIs and response handling. |
| src/NCI.OCPL.Api.BestBets/Services/ESBestBetsMatchService.cs | Migrates query construction and search execution to ES 8 client APIs. |
| src/NCI.OCPL.Api.BestBets/Services/ESBestBetsHealthService.cs | Migrates cluster health checks to ES 8 client APIs. |
| src/NCI.OCPL.Api.BestBets/Services/ESBestBetsDisplayService.cs | Migrates document GET logic to ES 8 client APIs and updates error handling. |
| src/NCI.OCPL.Api.BestBets/Program.cs | Removes unused usings after project modernization. |
| src/NCI.OCPL.Api.BestBets/NCI.OCPL.Api.BestBets.csproj | Moves to net8.0, bumps common package, replaces NEST with ES 8 client package. |
| src/NCI.OCPL.Api.BestBets/Models/BestBetsMatch.cs | Replaces NEST mapping attributes with System.Text.Json property naming. |
| src/NCI.OCPL.Api.BestBets/Models/BestBetsCategoryDisplay.cs | Replaces NEST mapping attributes with System.Text.Json property naming. |
| src/NCI.OCPL.Api.BestBets/Interfaces/ITokenAnalyzerService.cs | Removes unused usings; keeps async contract. |
| src/NCI.OCPL.Api.BestBets/Interfaces/IHealthCheckService.cs | Normalizes file header/using formatting. |
| src/NCI.OCPL.Api.BestBets/Interfaces/IESSearchOptions.cs | Fixes doc comment for Password property. |
| src/NCI.OCPL.Api.BestBets/Interfaces/IBestBetsMatchService.cs | Minor doc/comment corrections. |
| src/NCI.OCPL.Api.BestBets/Interfaces/IBestBetsDisplayService.cs | Removes stray blank line at file start. |
| src/NCI.OCPL.Api.BestBets/Controllers/BestBetsController.cs | Removes unused NEST/Elasticsearch.Net usings; minor comment typo fix. |
| integration-tests/README.md | Fixes typo and updates ES-client wording in docs. |
| integration-tests/docker-bestbets-api/elasticsearch/Dockerfile | Updates integration ES image to 8.19.12 and adjusts cert installation steps. |
| integration-tests/docker-bestbets-api/docker-compose.yml | Adjusts ES 8 security-related env vars for local integration testing. |
| integration-tests/docker-bestbets-api/api/Dockerfile | Updates cert installation steps for the integration API container. |
| .github/workflows/ci.yml | Updates shared CI workflow reference (v1 → v4). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0e9c6f6 to
da0f641
Compare
- Replace NEST client with Elastic.Clients.Elasticsearch.
- Migrate from Newtonsoft.Json to System.Text.Json.
- Refactored serialization:
- Deserializing from Elasticsearch to POCO uses JsonNamingPolicy.SnakeCaseLower via
NCI.OCPL.Api.Common NuGet component.
- Serializing from POCO to the wire uses default .Net naming policy with overrides
as needed.
- Model classes migrated from NEST mapping attributes ([Keyword], [Number], [Nested]).
- Tests:
- Test mocking migrated to TestingElasticsearchClientSettingsFactory in order
to use the same ElasticsearchClientSettings initialization as executable code.
- Refactor test connection classes for simplicity.
- Modify expected query structure JSON files to match ES 8 serialization changes
(e.g. arrays with only one element become objects).
- Switch tests from async void to async Task.
- Project file updates
- Target framework corrected from netcoreapp8.0 to net8.0.
- Bump NCI.OCPL.Api.Common packages to 4.0.0.
- Remove explicit NSwag dependency
- Miscellaneous
- Cleaned up using statements across many files.
- Update location for NIH TLS certificates.
- Correct typos.
Closes #78
da0f641 to
ed1cd79
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace NEST client with Elastic.Clients.Elasticsearch.
Migrate from Newtonsoft.Json to System.Text.Json.
Refactored serialization:
NCI.OCPL.Api.Common NuGet component.
as needed.
Tests:
to use the same ElasticsearchClientSettings initialization as executable code.
(e.g. arrays with only one element become objects).
Project file updates
Miscellaneous