Skip to content

Commit 9e9269c

Browse files
committed
Rename Elasticsearch -> OpenSearch
Signed-off-by: Rushi Agrawal <[email protected]>
1 parent 43f5ac5 commit 9e9269c

File tree

139 files changed

+486
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+486
-495
lines changed

Diff for: .ci/Dockerfile.client

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG PYTHON_VERSION=3.8
22
FROM python:${PYTHON_VERSION}
33

4-
WORKDIR /code/elasticsearch-py
4+
WORKDIR /code/opensearch-py
55
COPY dev-requirements.txt .
66
RUN python -m pip install \
77
-U --no-cache-dir \

Diff for: .ci/functions/imports.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ if [[ -z $es_node_name ]]; then
1212
export RUNSCRIPTS=${RUNSCRIPTS-}
1313
export DETACH=${DETACH-false}
1414
export CLEANUP=${CLEANUP-false}
15-
export ELASTICSEARCH_URL_EXTENSION=${ELASTICSEARCH_URL_EXTENSION-http}
15+
export OPENSEARCH_URL_EXTENSION=${OPENSEARCH_URL_EXTENSION-http}
1616

1717
export es_node_name=instance
18-
export elastic_password=changeme
18+
export opensearch_image=opensearchproject/opensearch
19+
if [[ "$CLUSTER" == "opendistro" ]]; then
20+
export opensearch_image=amazon/opendistro-for-elasticsearch
21+
fi
1922

20-
export elasticsearch_url=$ELASTICSEARCH_URL_EXTENSION://${es_node_name}:9200
21-
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
23+
export opensearch_url=$OPENSEARCH_URL_EXTENSION://${opensearch_node_name}:9200
24+
export external_opensearch_url=${opensearch_url/$opensearch_node_name/localhost}
2225

2326
export network_name=search-rest-test
2427

Diff for: .ci/make.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# ------------------------------------------------------- #
44
#
5-
# Skeleton for common build entry script for all elastic
5+
# Skeleton for common build entry script for all opensearch
66
# clients. Needs to be adapted to individual client usage.
77
#
88
# Must be called: ./.ci/make.sh <target> <params>
@@ -35,7 +35,7 @@ VERSION=$2
3535
STACK_VERSION=$VERSION
3636
set -euo pipefail
3737

38-
product="elastic/elasticsearch-py"
38+
product="opensearch-project/opensearch-py"
3939
output_folder=".ci/output"
4040
codegen_folder=".ci/output"
4141
OUTPUT_DIR="$repo/${output_folder}"
@@ -129,15 +129,15 @@ if [[ "$CMD" == "assemble" ]]; then
129129

130130
# Build dists into .ci/output
131131
docker run \
132-
--rm -v $repo/.ci/output:/code/elasticsearch-py/dist \
132+
--rm -v $repo/.ci/output:/code/opensearch-py/dist \
133133
$product \
134-
/bin/bash -c "python /code/elasticsearch-py/utils/build-dists.py $VERSION"
134+
/bin/bash -c "python /code/opensearch-py/utils/build-dists.py $VERSION"
135135

136136
# Verify that there are dists in .ci/output
137137
if compgen -G ".ci/output/*" > /dev/null; then
138138

139139
# Tarball everything up in .ci/output
140-
cd $repo/.ci/output && tar -czvf elasticsearch-py-$VERSION.tar.gz * && cd -
140+
cd $repo/.ci/output && tar -czvf opensearch-py-$VERSION.tar.gz * && cd -
141141

142142
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
143143
exit 0

Diff for: .ci/run-elasticsearch.sh renamed to .ci/run-opensearch.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
22
#
3-
# Launch one or more Elasticsearch nodes via the Docker image,
3+
# Launch one or more OpenSearch nodes via the Docker image,
44
# to form a cluster suitable for running the REST API tests.
55
#
66
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
77
# Export the TEST_SUITE variable, i.e. 'oss'
88
# Export the NUMBER_OF_NODES variable to start more than 1 node
99

1010
# Version 1.4.0
11-
# - Initial version of the run-elasticsearch.sh script
11+
# - Initial version of the run-opensearch.sh script
1212
# - Deleting the volume should not dependent on the container still running
1313
# - Fixed `ES_JAVA_OPTS` config
1414
# - Moved to STACK_VERSION and TEST_VERSION
@@ -47,7 +47,7 @@ NUMBER_OF_NODES=${NUMBER_OF_NODES-1}
4747
http_port=9200
4848
for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do
4949
node_name=${es_node_name}$i
50-
node_url=${external_elasticsearch_url/9200/${http_port}}$i
50+
node_url=${external_opensearch_url/9200/${http_port}}$i
5151
if [[ "$i" == "0" ]]; then node_name=$es_node_name; fi
5252
environment+=($(cat <<-END
5353
--env node.name=$node_name
@@ -56,7 +56,7 @@ END
5656
echo "$i: $http_port $node_url "
5757
volume_name=${node_name}-rest-test-data
5858
volumes+=($(cat <<-END
59-
--volume $volume_name:/usr/share/elasticsearch/data${i}
59+
--volume $volume_name:/usr/share/opensearch/data${i}
6060
END
6161
))
6262

@@ -84,7 +84,7 @@ END
8484
--ulimit nofile=65536:65536 \
8585
--ulimit memlock=-1:-1 \
8686
--detach="$local_detach" \
87-
--health-cmd="curl -vvv -s --fail $elasticsearch_url/_cluster/health || exit 1" \
87+
--health-cmd="curl -vvv -s --fail $opensearch_url/_cluster/health || exit 1" \
8888
--health-interval=2s \
8989
--health-retries=20 \
9090
--health-timeout=2s \

Diff for: .ci/run-repository.sh

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
#!/usr/bin/env bash
22

33
# Called by entry point `run-test` use this script to add your repository specific test commands
4-
# Once called Elasticsearch is up and running and the following parameters are available to this script
4+
# Once called opensearch is up and running and the following parameters are available to this script
55

6-
# ELASTICSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
7-
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable
6+
# OPENSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
7+
# OPENSEARCH_URL -- The url at which opensearch is reachable
88
# network_name -- The docker network name
9-
# NODE_NAME -- The docker container name also used as Elasticsearch node name
9+
# NODE_NAME -- The docker container name also used as opensearch node name
1010

1111
# When run in CI the test-matrix is used to define additional variables
1212
# TEST_SUITE -- defaults to `oss` in `run-tests`
1313

1414
set -e
1515

16-
echo -e "\033[34;1mINFO:\033[0m URL ${elasticsearch_url}\033[0m"
17-
echo -e "\033[34;1mINFO:\033[0m VERSION ${ELASTICSEARCH_VERSION}\033[0m"
16+
echo -e "\033[34;1mINFO:\033[0m URL ${opensearch_url}\033[0m"
17+
echo -e "\033[34;1mINFO:\033[0m VERSION ${OPENSEARCH_VERSION}\033[0m"
1818
echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m"
1919
echo -e "\033[34;1mINFO:\033[0m PYTHON_VERSION ${PYTHON_VERSION}\033[0m"
2020
echo -e "\033[34;1mINFO:\033[0m PYTHON_CONNECTION_CLASS ${PYTHON_CONNECTION_CLASS}\033[0m"
2121

22-
echo -e "\033[1m>>>>> Build [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
22+
echo -e "\033[1m>>>>> Build [opensearch-project/opensearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
2323

2424
docker build \
2525
--file .ci/Dockerfile.client \
26-
--tag elastic/elasticsearch-py \
26+
--tag opensearch-project/opensearch-py \
2727
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
2828
.
2929

30-
echo -e "\033[1m>>>>> Run [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
30+
echo -e "\033[1m>>>>> Run [opensearch-project/opensearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
3131

3232
mkdir -p junit
3333
docker run \
3434
--network=${network_name} \
3535
--env "STACK_VERSION=${STACK_VERSION}" \
36-
--env "ELASTICSEARCH_URL=${elasticsearch_url}" \
36+
--env "OPENSEARCH_URL=${opensearch_url}" \
3737
--env "TEST_SUITE=${TEST_SUITE}" \
3838
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
3939
--env "TEST_TYPE=server" \
40-
--name elasticsearch-py \
40+
--name opensearch-py \
4141
--rm \
42-
elastic/elasticsearch-py \
42+
opensearch-project/opensearch-py \
4343
python setup.py test

Diff for: .ci/run-tests

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
#
33
# Version 1.1
44
# - Moved to .ci folder and seperated out `run-repository.sh`
5-
# - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products
5+
# - Add `$RUNSCRIPTS` env var for running opensearch dependent products
66

77
# Default environment variables
88
export TEST_SUITE="${TEST_SUITE:=oss}"
99
export PYTHON_VERSION="${PYTHON_VERSION:=3.9}"
1010
export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=Urllib3HttpConnection}"
11-
export ELASTICSEARCH_URL_EXTENSION="${ELASTICSEARCH_URL_EXTENSION:=http}"
11+
export OPENSEARCH_URL_EXTENSION="${OPENSEARCH_URL_EXTENSION:=http}"
1212
export CLUSTER="${1:=opensearch}"
1313

1414
script_path=$(dirname $(realpath -s $0))
1515
source $script_path/functions/imports.sh
1616
set -euo pipefail
1717

18-
echo -e "\033[1m>>>>> Start server container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
19-
DETACH=true bash .ci/run-elasticsearch.sh
18+
DETACH=true bash .ci/run-opensearch.sh
2019

2120
if [[ -n "$RUNSCRIPTS" ]]; then
2221
for RUNSCRIPT in ${RUNSCRIPTS//,/ } ; do

Diff for: .coveragerc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ omit =
55
*/lib_pypy/*
66
*/site-packages/*
77
*.egg/*
8-
test_elasticsearch/*
9-
elasticsearch/connection/esthrift/*
8+
test_opensearch/*
9+
opensearch/connection/esthrift/*

Diff for: .gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ cython_debug/
137137
# Pycharm project settings
138138
.idea
139139

140-
# elasticsearch files
141-
test_elasticsearch/cover
142-
test_elasticsearch/local.py
140+
# opensearch files
141+
test_opensearch/cover
142+
test_opensearch/local.py
143143
.ci/output

Diff for: MANIFEST.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ include LICENSE
55
include MANIFEST.in
66
include README.md
77
include setup.py
8-
recursive-include elasticsearch* py.typed *.pyi
8+
recursive-include opensearch* py.typed *.pyi
99

10-
prune test_elasticsearch
10+
prune test_opensearch
1111
recursive-exclude * __pycache__
1212
recursive-exclude * *.py[co]

Diff for: Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ build:
55
PYTHON_VERSION=${PYTHON_VERSION} docker-compose build client
66

77
pull:
8-
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose pull
8+
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose pull
99

1010
push:
1111
# requires authentication.
1212
PYTHON_VERSION=${PYTHON_VERSION} docker-compose push client
1313

1414
run_tests:
15-
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose -p "${ELASTIC_VERSION}-${PYTHON_VERSION}" run client python setup.py test
15+
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} PYTHON_VERSION=${PYTHON_VERSION} docker-compose -p "${OPEN_VERSION}-${PYTHON_VERSION}" run client python setup.py test
1616

17-
start_elasticsearch:
18-
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} docker-compose up -d elasticsearch
17+
start_opensearch:
18+
OPENSEARCH_VERSION=${OPENSEARCH_VERSION} docker-compose up -d opensearch

Diff for: noxfile.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
SOURCE_FILES = (
3030
"setup.py",
3131
"noxfile.py",
32-
"elasticsearch/",
33-
"test_elasticsearch/",
32+
"opensearch/",
33+
"test_opensearch/",
3434
"utils/",
3535
)
3636

@@ -68,15 +68,15 @@ def lint(session):
6868

6969
# Run mypy on the package and then the type examples separately for
7070
# the two different mypy use-cases, ourselves and our users.
71-
session.run("mypy", "--strict", "elasticsearch/")
72-
session.run("mypy", "--strict", "test_elasticsearch/test_types/sync_types.py")
73-
session.run("mypy", "--strict", "test_elasticsearch/test_types/async_types.py")
71+
session.run("mypy", "--strict", "opensearch/")
72+
session.run("mypy", "--strict", "test_opensearch/test_types/sync_types.py")
73+
session.run("mypy", "--strict", "test_opensearch/test_types/async_types.py")
7474

7575
# Make sure we don't require aiohttp to be installed for users to
7676
# receive type hint information from mypy.
7777
session.run("python", "-m", "pip", "uninstall", "--yes", "aiohttp")
78-
session.run("mypy", "--strict", "elasticsearch/")
79-
session.run("mypy", "--strict", "test_elasticsearch/test_types/sync_types.py")
78+
session.run("mypy", "--strict", "opensearch/")
79+
session.run("mypy", "--strict", "test_opensearch/test_types/sync_types.py")
8080

8181

8282
@nox.session()

Diff for: elasticsearch/__init__.py renamed to opensearch/__init__.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
]
4040
VERSION = __version__ = (_major, _minor, _patch)
4141

42-
logger = logging.getLogger("elasticsearch")
42+
logger = logging.getLogger("opensearch")
4343
logger.addHandler(logging.NullHandler())
4444

45-
from .client import Elasticsearch
45+
from .client import OpenSearch
4646
from .connection import Connection, RequestsHttpConnection, Urllib3HttpConnection
4747
from .connection_pool import ConnectionPool, ConnectionSelector, RoundRobinSelector
4848
from .exceptions import (
@@ -51,11 +51,11 @@
5151
ConflictError,
5252
ConnectionError,
5353
ConnectionTimeout,
54-
ElasticsearchDeprecationWarning,
55-
ElasticsearchException,
56-
ElasticsearchWarning,
5754
ImproperlyConfigured,
5855
NotFoundError,
56+
OpenSearchDeprecationWarning,
57+
OpenSearchException,
58+
OpenSearchWarning,
5959
RequestError,
6060
SerializationError,
6161
SSLError,
@@ -66,10 +66,10 @@
6666

6767
# Only raise one warning per deprecation message so as not
6868
# to spam up the user if the same action is done multiple times.
69-
warnings.simplefilter("default", category=ElasticsearchDeprecationWarning, append=True)
69+
warnings.simplefilter("default", category=OpenSearchDeprecationWarning, append=True)
7070

7171
__all__ = [
72-
"Elasticsearch",
72+
"OpenSearch",
7373
"Transport",
7474
"ConnectionPool",
7575
"ConnectionSelector",
@@ -79,7 +79,7 @@
7979
"RequestsHttpConnection",
8080
"Urllib3HttpConnection",
8181
"ImproperlyConfigured",
82-
"ElasticsearchException",
82+
"OpenSearchException",
8383
"SerializationError",
8484
"TransportError",
8585
"NotFoundError",
@@ -90,24 +90,24 @@
9090
"ConnectionTimeout",
9191
"AuthenticationException",
9292
"AuthorizationException",
93-
"ElasticsearchWarning",
94-
"ElasticsearchDeprecationWarning",
93+
"OpenSearchWarning",
94+
"OpenSearchDeprecationWarning",
9595
]
9696

9797
try:
9898
# Asyncio only supported on Python 3.6+
9999
if sys.version_info < (3, 6):
100100
raise ImportError
101101

102-
from ._async.client import AsyncElasticsearch
102+
from ._async.client import AsyncOpenSearch
103103
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
104104
from ._async.transport import AsyncTransport
105105

106106
__all__ += [
107107
"AIOHttpConnection",
108108
"AsyncConnection",
109109
"AsyncTransport",
110-
"AsyncElasticsearch",
110+
"AsyncOpenSearch",
111111
]
112112
except (ImportError, SyntaxError):
113113
pass

Diff for: elasticsearch/__init__.pyi renamed to opensearch/__init__.pyi

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import sys
2828
from typing import Tuple
2929

30-
from .client import Elasticsearch as Elasticsearch
30+
from .client import OpenSearch as OpenSearch
3131
from .connection import Connection as Connection
3232
from .connection import RequestsHttpConnection as RequestsHttpConnection
3333
from .connection import Urllib3HttpConnection as Urllib3HttpConnection
@@ -39,12 +39,10 @@ from .exceptions import AuthorizationException as AuthorizationException
3939
from .exceptions import ConflictError as ConflictError
4040
from .exceptions import ConnectionError as ConnectionError
4141
from .exceptions import ConnectionTimeout as ConnectionTimeout
42-
from .exceptions import (
43-
ElasticsearchDeprecationWarning as ElasticsearchDeprecationWarning,
44-
)
45-
from .exceptions import ElasticsearchException as ElasticsearchException
4642
from .exceptions import ImproperlyConfigured as ImproperlyConfigured
4743
from .exceptions import NotFoundError as NotFoundError
44+
from .exceptions import OpenSearchDeprecationWarning as OpenSearchDeprecationWarning
45+
from .exceptions import OpenSearchException as OpenSearchException
4846
from .exceptions import RequestError as RequestError
4947
from .exceptions import SerializationError as SerializationError
5048
from .exceptions import SSLError as SSLError
@@ -56,7 +54,7 @@ try:
5654
if sys.version_info < (3, 6):
5755
raise ImportError
5856

59-
from ._async.client import AsyncElasticsearch as AsyncElasticsearch
57+
from ._async.client import AsyncOpenSearch as AsyncOpenSearch
6058
from ._async.http_aiohttp import AIOHttpConnection as AIOHttpConnection
6159
from ._async.transport import AsyncTransport as AsyncTransport
6260
except (ImportError, SyntaxError):
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)