I want to make a simple app that connects to Opensearch Serverless collection and only print information about it to see if it connects.
SdkHttpClient httpClient = ApacheHttpClient.builder().build();
OpenSearchClient client = new OpenSearchClient(
new AwsSdk2Transport(
httpClient,
"122345.us-east-2.aoss.amazonaws.com:443", // serverless collection endpoint
"aoss", // signing service name
Region.US_EAST_2, // signing service region
AwsSdk2TransportOptions.builder().build()
)
);
InfoResponse info = client.info();
System.out.println(info.version().distribution() + ": " + info.version().number());
httpClient.close();
I get this error message Request failed: [http_exception] server returned 404. Here are the dependencies I used:
implementation("org.opensearch.client:opensearch-java:2.6.0")
implementation("org.opensearch:opensearch:2.6.0")
implementation ("org.opensearch.client:opensearch-rest-client:2.12.0")
implementation("org.apache.httpcomponents:httpclient:4.5.13'")
implementation("software.amazon.awssdk:opensearch:2.17.64")
implementation(platform("software.amazon.awssdk:bom:2.17.290"))
implementation("software.amazon.awssdk:s3")
implementation("software.amazon.awssdk:apache-client")
I can't seem to figure it out why is not connecting, the endpoint is configured and it works fine in python or postman, but if I want to test it in java it does not work.