This repository will provide examples for migrating native Elasticsearch clients to the OpenSearch® equivalent.
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'
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
// Coming Soon...
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');
This work is licensed under a Apache License, Version 2.0.
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.