Skip to content

Deprecate client #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM python:${PYTHON_VERSION}
WORKDIR /code/elasticsearch-serverless-python
RUN mkdir -p /code/elasticsearch-serverless-python/build

COPY pyproject.toml README.rst .
COPY pyproject.toml README.md .
RUN python -m pip install \
-U --no-cache-dir \
--disable-pip-version-check \
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ jobs:

- name: "Check packages"
run: |
python -m pip install -U pip setuptools wheel build twine rstcheck
python -m pip install -U pip setuptools wheel build twine
python -m build
# Our Python example shows a REPL and is not valid Python
rstcheck --ignore-languages python README.rst
python -m twine check dist/*

docs:
Expand Down
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Elasticsearch Serverless Python Client

<p align="center">
<a href="https://pypi.org/project/elasticsearch"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/elasticsearch" /></a>
<a href="https://pypi.org/project/elasticsearch"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/elasticsearch" /></a>
<a href="https://pepy.tech/project/elasticsearch?versions=*"><img alt="Downloads" src="https://static.pepy.tech/badge/elasticsearch" /></a>
<a href="https://elasticsearch-py.readthedocs.io"><img alt="Documentation Status" src="https://readthedocs.org/projects/elasticsearch-py/badge/?version=latest" /></a>
</p>

> [!WARNING]
> Starting with the release of the Elastic Stack 9.0.0, this client will be discontinued. Instead, you can use the latest version of the [Elasticsearch Python Client](https://github.com/elastic/elasticsearch-py) to build your Elasticsearch Serverless Python applications.

## Features

* Translating basic Python data types to and from JSON
* Configurable automatic discovery of cluster nodes
* Persistent connections
* Load balancing (with pluggable selection strategy) across available nodes
* Failed connection penalization (time based - failed connections won't be
retried until a timeout is reached)
* Support for TLS and HTTP authentication
* Thread safety across requests
* Pluggable architecture
* Helper functions for idiomatically using APIs together

## Quick Start


```python
# Import the client from the 'elasticsearch' module
# Import the client from the 'elasticsearch' module
>>> from elasticsearch_serverless import Elasticsearch

# Instantiate a client instance
>>> client = Elasticsearch("http://localhost:9200")

# Call an API, in this example `info()`
>>> resp = client.info()

# View the result
>>> resp
{
"name" : "instance-name",
"cluster_name" : "cluster-name",
"cluster_uuid" : "cluster-uuid",
"version" : {
"number" : "7.14.0",
...
},
"tagline" : "You know, for Search"
}
```

## License

This software is licensed under the [Apache License 2.0](./LICENSE). See [NOTICE](./NOTICE).
103 changes: 0 additions & 103 deletions README.rst

This file was deleted.

6 changes: 1 addition & 5 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,4 @@ spec:
provider_settings:
build_pull_requests: true
build_branches: true
cancel_intermediate_builds: false
schedules:
main_daily:
branch: 'main'
cronline: '0 2 * * *'
cancel_intermediate_builds: false
8 changes: 8 additions & 0 deletions elasticsearch_serverless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
logger = logging.getLogger("elasticsearch")
logger.addHandler(logging.NullHandler())

warnings.warn(
"elasticsearch-serverless is deprecated and will be discontinued with the 9.0.0 release of the Elastic Stack. "
"Please migrate to the official elasticsearch-py package for continued support and improved features: "
"https://github.com/elastic/elasticsearch-py",
category=DeprecationWarning,
stacklevel=2,
)

from ._async.client import AsyncElasticsearch as AsyncElasticsearch
from ._sync.client import Elasticsearch as Elasticsearch
from .exceptions import ElasticsearchDeprecationWarning # noqa: F401
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "elasticsearch-serverless"
version = "0.7.0.20231031"
description = "Python client for Elasticsearch Serverless"
readme = "README.rst"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.9"
authors = [
Expand Down Expand Up @@ -90,7 +90,7 @@ include = [
"/CONTRIBUTING.md",
"/LICENSE",
"/NOTICE",
"/README.rst",
"/README.md",
"/setup.cfg",
"/docs/sphinx",
]
Expand Down