Skip to content

[Guide] Add document lifecycle guide#2017

Merged
reta merged 3 commits into
opensearch-project:mainfrom
lsh1215:docs/431-document-lifecycle
Jun 26, 2026
Merged

[Guide] Add document lifecycle guide#2017
reta merged 3 commits into
opensearch-project:mainfrom
lsh1215:docs/431-document-lifecycle

Conversation

@lsh1215

@lsh1215 lsh1215 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a guides/document_lifecycle.md guide covering create, index, get, source filtering, mget, exists, update, script update, update by query, reindex, delete, delete by query, and cleanup.
  • Add a runnable DocumentLifecycle sample that mirrors the guide and asserts each operation against OpenSearch.
  • Document the expected duplicate-create conflict handling for both ResponseException and OpenSearchException paths.
  • Add a CHANGELOG.md entry for the new guide and sample.

Closes #431.

Validation

  • git diff --check
  • ./gradlew :samples:compileJava :samples:spotlessJavaCheck
  • Docker Compose OpenSearch 3.2.0 cluster health checked as green
  • PASSWORD=0_aD^min_0 ./gradlew :samples:run -Dsamples.mainClass=DocumentLifecycle

Not run

  • Full repository test suite

@lsh1215 lsh1215 force-pushed the docs/431-document-lifecycle branch 3 times, most recently from 41f0b7d to 4e03048 Compare June 24, 2026 15:46
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>
@lsh1215 lsh1215 force-pushed the docs/431-document-lifecycle branch from 4e03048 to b4dcaf9 Compare June 24, 2026 16:08
@lsh1215 lsh1215 marked this pull request as ready for review June 24, 2026 16:23
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
Comment thread guides/document_lifecycle.md Outdated
@reta

reta commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Thanks you @lsh1215 , a few minor comments, LGTM otherwise!

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>
@lsh1215

lsh1215 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @reta. I applied your suggestions in 9955e6d.

I also updated the TOC anchors to stay in sync with the renamed sections.

The current CI failures look unrelated to this docs change. The failing jobs are failing during Gradle dependency resolution because https://ci.opensearch.org/ci/dbc/snapshots/maven returned 503 Service Unavailable for public Maven artifacts such as AWS SDK, Swagger Parser, and Plexus before Gradle could fall back to Maven Central. Could you please rerun the failed jobs when you get a chance?

@lsh1215

lsh1215 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Separately, if this keeps recurring, it may be worth considering a follow-up build hardening change so public Maven artifacts resolve from Maven Central before the OpenSearch snapshot repository is queried.

Comment thread samples/src/main/java/org/opensearch/client/samples/DocumentLifecycle.java Outdated
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>
@reta reta added the documentation Improvements or additions to documentation label Jun 26, 2026
@reta reta merged commit 354ff2e into opensearch-project:main Jun 26, 2026
65 of 76 checks passed
@opensearch-ci-bot

Copy link
Copy Markdown

The backport to 3.x failed. Please backport manually. See failed workflow run: https://github.com/opensearch-project/opensearch-java/actions/runs/28241400866

@reta

reta commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

The backport to 3.x failed. Please backport manually. See failed workflow run: https://github.com/opensearch-project/opensearch-java/actions/runs/28241400866

@lsh1215 could you please backport it to 3.x branch as well? Thank you.

@lsh1215

lsh1215 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@reta Sure, I’ll open a manual backport PR to the 3.x branch. Thank you.

@lsh1215

lsh1215 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@reta I opened the manual backport PR to 3.x: #2021.

The automatic backport conflict was in CHANGELOG.md, and I resolved it by adding the entry under Unreleased 3.x.

I also verified it with ./gradlew :samples:compileJava.

reta added a commit that referenced this pull request Jun 26, 2026
* [Guide] Add document lifecycle guide (#2017)

* Make document lifecycle guidance verifiable for Java users

Constraint: Issue #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>

* Switch to  SampleClient.create()

Signed-off-by: Andriy Redko <drreta@gmail.com>

---------

Signed-off-by: sanghun <vitash1215@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 3.x documentation Improvements or additions to documentation v3.10.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Guide] Document Iifecycle

3 participants