Skip to content

task(IndexAPI) Migrate IndexAPI to OpenSearch Refs #34728#34834

Open
fabrizzio-dotCMS wants to merge 13 commits intomainfrom
issue-34728-migrate-ESIndexAPI
Open

task(IndexAPI) Migrate IndexAPI to OpenSearch Refs #34728#34834
fabrizzio-dotCMS wants to merge 13 commits intomainfrom
issue-34728-migrate-ESIndexAPI

Conversation

@fabrizzio-dotCMS
Copy link
Contributor

@fabrizzio-dotCMS fabrizzio-dotCMS commented Mar 2, 2026

Summary

This PR migrates the index management layer from a tightly-coupled Elasticsearch-only implementation to a vendor-neutral `IndexAPI` interface, establishing the foundation for OpenSearch support alongside the existing Elasticsearch stack.

Changes

  • New `IndexAPI` interface (`com.dotcms.content.elasticsearch.business.IndexAPI`) — vendor-neutral contract covering all index lifecycle operations (create, delete, clear, alias, stats, health, etc.)
  • New `IndexAPIImpl` router — delegates to `ESIndexAPI` (Elasticsearch) today; wired to route to `OSIndexAPIImpl` (OpenSearch) in a future task
  • `ESIndexAPI` now implements `IndexAPI` — removed redundant `Status` enum (moved to interface), stripped deprecated `backupIndex` methods and scroll-based search remnants
  • New domain DTOs — `ClusterStats`, `ClusterIndexHealth`, `CreateIndexStatus`, `IndexStats`, `NodeStats` replacing vendor-specific Elasticsearch types at API boundaries
  • `APILocator.getESIndexAPI()` returns `IndexAPI` — factory now creates `IndexAPIImpl`; all 40+ call sites updated (fields, constructors, JSPs, tests) to use the interface type
  • OpenSearch client infrastructure — `OSClientProvider` interface + `OSDefaultClientProvider`, `OSTestClientProvider` (`@Alternative @priority(1)` CDI bean for integration tests), `OSClientConfig`, `ConfigurableOpenSearchProvider`
  • `OSIndexAPIImpl` — full OpenSearch implementation of `IndexAPI` (create/delete/clear index, aliases, replicas, cluster stats, health, scroll search, etc.)
  • `OSBulkHelper` — CDI bean for bulk index/delete operations against OpenSearch
  • `OSContentletScrollImpl` — scroll-based contentlet search for OpenSearch
  • Integration test suite — `OSIndexAPIImplIntegrationTest` with 18 tests covering index lifecycle, cluster names, stats, monitoring, and OS/ES divergence scenarios; `OSTestClientProvider` replaces manual bean wiring for all CDI injection points in tests
  • Deleted legacy files — `OpenSearchIndexAPI`, `OpenSearchIndexAPIImpl`, `OpenSearchBulkHelper` (superseded by new implementations)

Testing

Run the OpenSearch integration tests against a local `opensearch-upgrade` container on `http://localhost:9201\`:
```bash
./mvnw verify -pl :dotcms-integration
-Dcoreit.test.skip=false
-Dopensearch.upgrade.test=true
-Dit.test=OSIndexAPIImplIntegrationTest
```

Override the endpoint if needed: `-Dopensearch.test.endpoint=http://myhost:9201\`

Existing Elasticsearch integration tests (`ESIndexAPITest`, `ContentletIndexAPIImplTest`, `ESSiteSearchAPITest`) continue to pass unchanged since `IndexAPIImpl` still delegates to `ESIndexAPI`.

Breaking Changes

`APILocator.getESIndexAPI()` return type changed from `ESIndexAPI` to `IndexAPI`, but all call sites have been updated. The `ESIndexAPI.Status` enum has been removed in favour of `IndexAPI.Status` (same values: `ACTIVE`, `INACTIVE`, `PROCESSING`).

This PR fixes: #34728

@github-actions github-actions bot added the Area : Backend PR changes Java/Maven backend code label Mar 2, 2026
@fabrizzio-dotCMS fabrizzio-dotCMS marked this pull request as ready for review March 4, 2026 19:21
@github-actions github-actions bot added the Area : Frontend PR changes Angular/TypeScript frontend code label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[TASK] Migrate ESIndexAPI To OS

2 participants