Background:
In actual development, for some real-time requirements that are not high and require some aggregated data queries, Elasticsearch is generally used. Its advantages are high query efficiency and the ability to store large amounts of data.We use AWS opensearch in our actual project. In fact, opensearch is also a branch of Elasticsearch, and the built-in Elasticsearch is also Elasticsearch. Next, I will integrate it according to opensearch
Steps to integrate OpenSearch in springboot:
Add pom dependency:
The OpenSearch version is set according to the actual springBoot version and the ES service version

Add basic configuration
The basic information includes the host address of the ES connection, username and password, SSL, timeout, keep-alive strategy and other information. Of course, this is only part of it. For more information, please refer to the official website for more configurations.



ES read-write separation configuration

Configure the jpa package path that needs to be scanned, and rewrite OpenSearchRestTemplateuse

Just use it like you would use JPA
