Skip to content

(#78) Elasticsearch 8 update#82

Open
blairlearn wants to merge 1 commit into
developfrom
ticket/78-es8
Open

(#78) Elasticsearch 8 update#82
blairlearn wants to merge 1 commit into
developfrom
ticket/78-es8

Conversation

@blairlearn

@blairlearn blairlearn commented Apr 13, 2026

Copy link
Copy Markdown
Contributor
  • 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 updated 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.
    • Correct typos.

@blairlearn blairlearn force-pushed the ticket/78-es8 branch 3 times, most recently from 02af708 to ba99fbe Compare April 24, 2026 18:30
@blairlearn blairlearn force-pushed the ticket/78-es8 branch 5 times, most recently from b3daf85 to 8d653c8 Compare May 27, 2026 18:05
@blairlearn blairlearn force-pushed the ticket/78-es8 branch 2 times, most recently from 8c9c5af to 0e9c6f6 Compare June 10, 2026 18:14
@blairlearn blairlearn marked this pull request as ready for review June 10, 2026 18:21
Copilot AI review requested due to automatic review settings June 10, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.Json and 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.

Comment thread src/NCI.OCPL.Api.BestBets/Services/ESTokenAnalyzerService.cs Outdated
Comment thread integration-tests/docker-bestbets-api/elasticsearch/Dockerfile
Comment thread integration-tests/docker-bestbets-api/api/Dockerfile
- 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
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