os-persistence-v3/MIGRATION_PLAN.md
Migrate os-persistence-v3 from OpenSearch High-Level REST Client to opensearch-java 3.x client.
Strategy: Incremental migration in small, testable commits.
Each commit should:
File: OpenSearchRestDAO.java (constructor + client init)
Tasks:
OpenSearchClient fieldRestHighLevelClient temporarily (dual-client mode)Test: Verify server starts without errors
New file: QueryHelper.java
Tasks:
buildBoolQuery(String structured, String freeText) → returns QuerybuildMatchQuery(String field, String value) → returns QuerybuildRangeQuery(String field, Object from, Object to) → returns QueryTest: Unit tests pass
File: OpenSearchRestDAO.java (new method)
Tasks:
searchObjectsV3(...) using new clientSearchResult<T>Test: Add integration test comparing v2 vs v3 search results
Files: OpenSearchRestDAO.java
Order:
searchObjectsViaExpression() - use searchObjectsV3()searchWorkflowSummary() - use searchObjectsV3()searchTaskSummary() - use searchObjectsV3()Test: Integration tests pass for each method
File: OpenSearchRestDAO.java
Tasks:
countDocuments(String index, Query query) helperCountResponse.count() vs old getCount()Test: Count queries return correct values
File: OpenSearchRestDAO.java
Tasks:
indexDocumentV3(String index, String id, Object doc) helperindexObject() to use new methodupdateObject() to use new methodTest: Document indexing works correctly
File: OpenSearchRestDAO.java
Tasks:
deleteDocumentV3(String index, String id) helperdeleteObject() to use new methodTest: Document deletion works correctly
File: OpenSearchRestDAO.java
Tasks:
BulkHelper.java for bulk operation buildingbulkIndexObjects() to use lambda buildersasyncBulkIndexObjects() to use lambda buildersBulkProcessor initialization (if needed)Test: Bulk operations work correctly
File: OpenSearchRestDAO.java
Tasks:
addTaskExecutionLogs() to new APIgetTaskExecutionLogs() to new APITest: Task logs index and retrieve correctly
File: OpenSearchRestDAO.java
Tasks:
addMessage() to new APIgetMessages() to new APITest: Event messages work correctly
File: OpenSearchRestDAO.java
Tasks:
RestHighLevelClient fieldTest: All tests still pass
Files: os3/dao/query/parser/**/*.java
Tasks:
Expression.java to use Query instead of QueryBuilderNameValue.java query buildingGroupedExpression.java query buildingFilterProvider interfaceTest: Query parsing works correctly
Tasks:
Test: Build passes with no warnings
New file: OpenSearchRestDAOV3IntegrationTest.java
Tasks:
Test: All integration tests pass
New file: os-persistence-v3/src/test/resources/comparison-tests.json
Tasks:
Test: No behavioral differences detected
OpenSearchRestDAO.java (~1343 lines)
Query Parser Files (~300 lines total)
Expression.javaNameValue.javaGroupedExpression.javaFilterProvider.javaHelper Classes (new)
QueryHelper.java (query building)BulkHelper.java (bulk operations)Test Files (new)
Keep:
implementation 'org.opensearch.client:opensearch-java:3.0.0'
implementation "org.opensearch.client:opensearch-rest-client:3.0.0"
Remove (after migration):
implementation "org.opensearch.client:opensearch-rest-high-level-client:3.0.0"
Mitigation: Side-by-side testing with v2
Mitigation: Benchmark tests before/after
Mitigation: Test with real workflow data early
Mitigation: Iterative approach, test each commit
Optimistic: 1 week (40 hours) Realistic: 2 weeks (60-80 hours) Pessimistic: 3 weeks (if major blockers found)
Breakdown:
feature/os-persistence-v3-migrationos-persistence-v3/MIGRATION_GUIDE.md