I want to integrate spring boot with the aws kendra query index.I want to leverage kendra as elastic search where i make api for search query and then get results for the same via that api.
Documentations dont clearly mention the connection procedure/steps. Not sure if thats possible or not.
P.s created index and dataSource as webcrawler. Now whats the step forward.
CodePudding user response:
You can use the AWS SDK for Java to make API calls to AWS services. You can find code examples in the link above.
Setting up your Kendra client will look something like this:
String accessKey = "YOUR_ACCESS_KEY";
String secretKey = "YOUR_SECRET_KEY";
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
AWSkendra kendraClient = AWSkendraClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
.build();
After you set up your Kendra client, you can then use the query method to query your Kendra index.
CodePudding user response:
There are examples of how to INVOKE AWS Services from a Spring BOOT app. Here are a few that show use of the AWS SDK for Java V2:
- Creating your first AWS Java web application
- Creating a dynamic web application that analyzes photos using the AWS SDK for Java.
- Creating the Amazon DynamoDB web application item tracker
There are more Spring BOOT/AWS Service examples in Github.
While there are no Spring BOOT examples for Kendra client (yet), the pattern is the same. You can build a MVC app and build a service that uses https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/kendra/KendraClient.html.