All Products
Search
Document Center

OpenSearch:Java SDK examples

Last Updated:Jun 22, 2026

Java SDK examples for the core features of OpenSearch, covering data push and search applications for the end-to-end workflow.

Document push demos and logs

  • Commit push demo: Dynamically encapsulates document data into Map objects, adds them to a cache using the `add` method, and calls `commit` to submit the documents in a batch.

  • Push demo: Generates a dataset in the specified format and calls `push` to send the entire dataset to the application in a single batch.

  • SDK log output: Configures logs for the Java SDK.

Search demos

  • Search demo: Configures environment variables and provides sample code for searching documents using the Java SDK.

  • Scroll query demo: The `search` method can retrieve a maximum of 5,000 results. Uses the `scroll` method to export all data beyond this limit.

  • Iterative scroll query demo: Continuously retrieves paged results using a cursor to optimize deep paging performance.

  • Using algorithm module parameters: Uses advanced parameters such as BM25 weight adjustment and semantic retrieval threshold settings to improve search result relevance.