AWS Security ChangesHomeSearch

AWS opensearch-service documentation change

Service: opensearch-service · 2026-05-22 · Documentation low

File: opensearch-service/latest/developerguide/serverless-clients.md

Summary

Added Java code samples for configuring credential provider and indexing documents in OpenSearch Serverless

Security assessment

The changes demonstrate standard client configuration and document indexing operations. While credentials are mentioned, this is routine API usage documentation without addressing vulnerabilities or security features.

Diff

diff --git a/opensearch-service/latest/developerguide/serverless-clients.md b/opensearch-service/latest/developerguide/serverless-clients.md
index 8ff18b0d2..e7d7f6563 100644
--- a//opensearch-service/latest/developerguide/serverless-clients.md
+++ b//opensearch-service/latest/developerguide/serverless-clients.md
@@ -217,0 +218,5 @@ The important difference compared to OpenSearch Service _domains_ is the service
+    import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+    import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
+    
+    // Configure credential provider
+    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
@@ -275,0 +281,37 @@ The following sample code again establishes a secure connection, and then search
+The following sample code establishes a secure connection and indexes a document into a collection.
+    
+    
+    import org.opensearch.client.opensearch.OpenSearchClient;
+    import org.opensearch.client.opensearch.core.IndexRequest;
+    import org.opensearch.client.opensearch.core.IndexResponse;
+    import java.util.HashMap;
+    import java.util.Map;
+    
+    SdkHttpClient httpClient = ApacheHttpClient.builder().build();
+    
+    OpenSearchClient client = new OpenSearchClient(
+        new AwsSdk2Transport(
+            httpClient,
+            "...us-west-2.aoss.amazonaws.com", // serverless collection endpoint
+            "aoss" // signing service name
+            Region.US_WEST_2, // signing service region
+            AwsSdk2TransportOptions.builder().build()
+        )
+    );
+    
+    // index a document
+    Map<String, Object> document = new HashMap<>();
+    document.put("title", "The Green Mile");
+    document.put("director", "Frank Darabont");
+    document.put("year", "1999");
+    
+    IndexRequest<Map<String, Object>> indexRequest = IndexRequest.of(i -> i
+        .index("books-index")
+        .document(document)
+    );
+    
+    IndexResponse indexResponse = client.index(indexRequest);
+    System.out.println("Index response: " + indexResponse.result());
+    
+    httpClient.close();
+