2023-07-24 12:23:51 -05:00
|
|
|
# OpenSearch Python Samples
|
|
|
|
|
|
2024-08-14 18:25:01 -04:00
|
|
|
Most samples can be run using OpenSearch installed locally with Docker.
|
|
|
|
|
|
|
|
|
|
## Admin User Password
|
|
|
|
|
|
|
|
|
|
Add the default `admin` password to the environment.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
export OPENSEARCH_PASSWORD=myStrongPassword123!
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Start the Container
|
2023-07-24 12:23:51 -05:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docker pull opensearchproject/opensearch:latest
|
2024-08-14 18:25:01 -04:00
|
|
|
docker run -d -p 9200:9200 -p 9600:9600 -e OPENSEARCH_INITIAL_ADMIN_PASSWORD=$OPENSEARCH_PASSWORD -e "discovery.type=single-node" opensearchproject/opensearch:latest
|
2023-07-24 12:23:51 -05:00
|
|
|
```
|
|
|
|
|
|
2024-08-14 18:25:01 -04:00
|
|
|
## Install Python Prerequisites
|
2023-07-24 12:23:51 -05:00
|
|
|
|
|
|
|
|
Install [poetry](https://python-poetry.org/docs/).
|
|
|
|
|
|
|
|
|
|
## Run Samples
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
poetry install
|
2023-09-15 10:07:52 +03:00
|
|
|
poetry run python hello/hello.py
|
2023-07-24 12:23:51 -05:00
|
|
|
```
|