Skip to content

[Backport 3.x] [Guide] Add document lifecycle guide#2021

Merged
reta merged 2 commits into
opensearch-project:3.xfrom
lsh1215:backport-2017-to-3.x
Jun 26, 2026
Merged

[Backport 3.x] [Guide] Add document lifecycle guide#2021
reta merged 2 commits into
opensearch-project:3.xfrom
lsh1215:backport-2017-to-3.x

Conversation

@lsh1215

@lsh1215 lsh1215 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Backport 354ff2e from #2017 to the 3.x branch.

This PR was opened because the automatic backport to 3.x failed due to a CHANGELOG.md conflict.

Changes:

  • Adds the document lifecycle guide.
  • Adds the runnable DocumentLifecycle sample.
  • Adds the 3.x changelog entry under Unreleased 3.x.

Validation:

  • ./gradlew :samples:compileJava

The compile check completed successfully. The output included existing deprecation/unchecked warnings in sample sources, but the Gradle build finished with BUILD SUCCESSFUL.

* Make document lifecycle guidance verifiable for Java users

Constraint: Issue opensearch-project#431 asks for a Java document lifecycle guide similar to the Ruby guide while matching existing Java guide conventions.

Rejected: Guide-only snippets | A runnable sample keeps the documented examples compileable and Docker-verified.

Rejected: Repository-order CI workaround in this PR | It fixed a transient upstream Maven 503 but widened the guide-focused review scope.

Confidence: high

Scope-risk: narrow

Directive: Keep guide snippets aligned with DocumentLifecycle when changing lifecycle examples.

Tested: git diff --check

Tested: ./gradlew :samples:compileJava :samples:spotlessJavaCheck

Tested: Docker Compose OpenSearch 3.2.0 health green; PASSWORD=0_aD^min_0 ./gradlew :samples:run -Dsamples.mainClass=DocumentLifecycle

Not-tested: Full repository test suite

Signed-off-by: sanghun <vitash1215@gmail.com>

* Align document lifecycle guide with review wording

Constraint: Maintainer review requested wording, heading, and setup-style adjustments in guides/document_lifecycle.md.

Rejected: Changing the runnable sample | The review feedback targeted guide phrasing, and the sample still compiles unchanged.

Confidence: high

Scope-risk: narrow

Directive: Keep the guide TOC anchors synchronized with section heading changes.

Tested: git diff --check

Tested: ./gradlew :samples:compileJava :samples:spotlessJavaCheck

Not-tested: Full repository test suite

Signed-off-by: sanghun <vitash1215@gmail.com>

* Align document lifecycle sample setup with guide

Constraint: Maintainer review requested DocumentLifecycle.java to match the setup snippet already applied in guides/document_lifecycle.md.

Rejected: Reintroducing SampleClient.create | The review suggestion asks for the explicit HttpHost transport setup.

Confidence: high

Scope-risk: narrow

Directive: Keep sample setup aligned with guide setup code.

Tested: git diff --check

Tested: ./gradlew :samples:compileJava :samples:spotlessJavaCheck

Tested: OPENSEARCH_VERSION=3.2.0 SECURE_INTEGRATION=false docker compose --project-directory .ci/opensearch up -d --build; ./gradlew :samples:run -Dsamples.mainClass=DocumentLifecycle; docker compose down

Not-tested: Full repository test suite
Signed-off-by: sanghun <vitash1215@gmail.com>

---------

Signed-off-by: sanghun <vitash1215@gmail.com>
(cherry picked from commit 354ff2e)
Signed-off-by: sanghun <vitash1215@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
private static final String REINDEXED_INDEX_NAME = "movies-document-lifecycle-reindexed";

public static void main(String[] args) throws Exception {
OpenSearchClient client = SampleClient.create();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@lsh1215 my apologies, but I confused you (and myself), the samples do use SampleClient.create() consistently, I updated this one. Thank you.

@reta reta merged commit fed35a0 into opensearch-project:3.x Jun 26, 2026
55 of 59 checks passed
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