I would love to use the Cognitect aws-api to handle signing and sending HTTP REST requests to upload documents to an OpenSearch instance. The official opensearch package does not expose the Document upload endpoints. I believe what I need to do is define a proper service EDN that would define these operations, but I am having a little bit of trouble getting off the ground. Has anyone done this or something similar before?
I'm not sure I understand. Are you wanting to do something apart from the operations of the official https://docs.opensearch.org/docs/latest/api-reference/?
I am trying to upload via the Document APIs. Our Opensearch instance is configured to require SigV4 signing. Maybe I am using the wrong opensearch package, but the Document APIs do not seem to be available ops.
What cognitect artifacts (and versions) are you using? And what opensource operation(s) do you want to invoke?
I'm looking to see if the latest version of com.cognitect.aws/opensearch has the latest operations.
I have these in my dep tree:
[com.cognitect.aws/opensearch "871.2.31.23"]
[com.cognitect.aws/api "0.8.686"]
[com.cognitect/http-client "1.0.125"]
[com.cognitect.aws/endpoints "1.1.12.504"]
[com.cognitect.aws/sqs "847.2.1398.0"]
Hmm that version of com.cognitect.aws/endpoints is about two years old. The others look reasonably recent. https://github.com/cognitect-labs/aws-api/blob/main/latest-releases.edn
You are using the latest version of com.cognitect.aws/opensearch, and it is up-to-date with the https://github.com/aws/aws-sdk-java-v2/blob/master/services/opensearch/src/main/resources/codegen-resources/service-2.json in the AWS Java SDK v2 repo.
I don't believe the operations outlined in the Java SDK descriptor cover the OpenSearch Document REST API. I was hoping to produce a custom service edn that would take a document or a series of documents, an index/domain, etc, and properly sign and dispatch them to the OpenSearch endpoints. If this is not a great idea, please let me know.
> I don't believe the operations outlined in the Java SDK descriptor cover the OpenSearch Document REST API. Hmm, I see what you mean. > If this is not a great idea, please let me know. It might not be a great idea. Certainly it's not supported by aws-api. 🤔
Yea, I was going to manually do the signing and such... I just don't want to have to reinvent the wheel for when my creds need cycling, retrying requests, etc. (So was thinking of the custom service definition as an alternative.)
I wish I had a happier answer. But yeah I think it would require a lot of hacking to get aws-api to invoke an operation at an endpoint that is not in one of the existing json service descriptors. I'm not sure it would work at all even with said hacking.
All good. I'll either bite the bullet and implement the request signing with the Java SDK or use a better supported service to ingest via pipeline. I think Amazon does not want people ingesting via the Document APIs, and is trying to encourage pipeline ingestion.
Appreciate the help!