Skip to content

Aiven-Labs/opensearch-migration-examples

Repository files navigation

OpenSearch® Migration Examples

This repository will provide examples for migrating native Elasticsearch clients to the OpenSearch® equivalent.

Java / SpringBoot

Testing shows that this is a minimal change. Install the new dependency, and change the import statements.

See this commit diff as an example change: java-client-migration/src/main/java/.../Application.java

- implementation 'org.elasticsearch.client:elasticsearch-rest-client:7.10.2'
- implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.10.2'
+ implementation 'org.opensearch.client:opensearch-rest-client:1.1.0'
+ implementation 'org.opensearch.client:opensearch-rest-high-level-client:1.1.0'

Resources

Python

Testing shows that this is a four (4) line change. Change the import statement, and the Python client for ES (Elasticsearch) and OS (OpenSearch).

Changes related to import:

- from elasticsearch import Elasticsearch
+ from opensearchpy import OpenSearch

Changes related to clients and arguments:

- client_against_opensearch = Elasticsearch(OS_SERVICE_URI, use_ssl=True)
+ client_against_opensearch = OpenSearch(OS_SERVICE_URI, use_ssl=True)

See this commit diff as an example change: python-client-migration/python_client_migration/main.py

Resources

Go

// Coming Soon...

NodeJS

Testing shows that this is a two (2) line change. Install the new dependency, and change the require/import statement.

See this commit diff as an example change: node-client-migration/src/main.js

$ npm install --save @opensearch-project/opensearch
- const { Client } = require('@elastic/elasticsearch');
+ const { Client } = require('@opensearch-project/opensearch');

Resources

License

This work is licensed under a Apache License, Version 2.0.

Trademarks

Elasticsearch is a trademark of Elasticsearch BV, registered in the U.S. and in other countries.

Java is a registered trademark of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

OpenSearch, NodeJS, Go, Python and SpringBoot are trademarks and property of their respective owners. All product and service names used in this website are for identification purposes only and do not imply endorsement.

About

Code examples showing how to change from Elasticsearch to OpenSearch® library dependencies.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published