Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

caching api response to OpenSearch #3705

kedbirhan started this conversation in General
Discussion options

I am looking to save https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html api response to Openserach i can save the data but i am not able to retrieve it showing the error message below. I believe the reason is this POJO classes like Instance class does not have noArgs constructor since they are Builder based Pojo. My question is there is a way to make the Instance metadata searchable in Opensearch and also retrieve(deserialize it to Instance Class) it from the spring app without getting an error. please do not suggest to copy the class to another pojo class that duplicate the content because it does not scale very well for me.

image

codes

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Document(indexName = "api-reponse", shards = 1, replicas = 0, refreshInterval = "5s")
public class AwsResponse {
 @Id
 private String id;
 private Instance.Builder instance;
}
 public void saveInstanceDetails() {
 Iterable<AwsResponse> instanceDetials = repository.findAll(); // this call causes the above error
 .
 .
 .
 List<Instance> instances = describeInstance("i-93ee719a803d60975");
 Instance instance = instances.get(0);
 repository.save(AwsResponse.builder().instance(instance.toBuilder()).build());
 }
You must be logged in to vote

Replies: 1 comment

Comment options

Hi @kedbirhan this is not a Java SDK usage question, it's more of a general implementation question, so I'll move this to the General category. Maybe someone from the community can help.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /