Upgrade Elasticsearch clients to OpenSearch¶
Elasticsearch has introduced breaking changes into their client libraries as early as 7.13.*, that’s why newer Elasticsearch clients won’t work with OpenSearch.
In order to upgrade the Elasticsearch clients to OpenSearch follow these steps:
Pin your Elasticsearch libraries to version 7.10.2 (latest version under the open-source license).
Switch from Elasticsearch 7.10.2 to the fully compatible OpenSearch 1.0.0.
Update OpenSearch libraries till their latest version.
You can migrate your cluster from Elasticsearch to OpenSearch either before or after switching the clients. Read our article for more details.
What if you can’t upgrade immediately?¶
If you want to postpone the upgrade, we recommend locking the client version of Elasticsearch to 7.10.2 and use this version till you can proceed with the migration steps outlined above. This is true for application libraries as well as for the supporting ecosystem of tooling like File Beats and Logstash.
Please refer to OpenSearch compatibility documentation as the source of truth.
Client migration examples¶
To help you with migration, we provided some code migration examples in our repository.
Java and Spring Boot¶
Java clients are forks of the Elasticsearch libraries. To migrate change the Maven or Gradle dependencies, and update the import statements for the DOA layer. You can find an example code change in our repository.
Node libraries are forks of the Elasticsearch libraries. The only required change should be the dependency in
package.json and the
import statements. You can see an example migration code in our repository.