Use the Elasticsearch DSL with Pydantic models.
Project description
🔍 elasticsearch-pydantic
Use the Elasticsearch DSL with Pydantic models.
This minimal library is for those who...
- ... want to benefit from Pydantic's extensive validation and type checking ecosystem,
- ... want the convenient and idiomatic persistence layer and query DSL of Elasticsearch DSL,
- ... and do not want to reimplement everything from scratch.
To interconnect the Elasticsearch DSL and Pydantic, we override a limited set of methods from the Elasticsearch Document and InnerDoc base classes with Pydantic's BaseModel functionality. Elasticsearch field types are inferred from the model's type annotations and can be overridden by using Annotated type hints.
Installation
Install the package from PyPI:
pip install elasticsearch-pydantic
Usage
TODO
Examples
More examples can be found in the examples directory.
Compatibility
This library works fine with any of the following Pip packages installed:
elasticsearch8elasticsearch-dslelasticsearch6-dslelasticsearch7-dslelasticsearch8-dsl
The elasticsearch-pydantic library will automatically detect which Elasticsearch DSL is installed.
Development
To build this package and contribute to its development you need to install the build, setuptools and wheel packages:
pip install build setuptools wheel
(On most systems, these packages are already pre-installed.)
Development installation
Install package and test dependencies:
pip install -e .[tests]
Testing
Verify your changes against the test suite to verify.
ruff check . # Code format and LINT
mypy . # Static typing
pytest . # Unit tests
Please also add tests for your newly developed code.
Build wheels
Wheels for this package can be built with:
python -m build
Support
If you have any problems using this package, please file an issue. We're happy to help!
License
This repository is released under the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elasticsearch_pydantic-0.1.0.tar.gz.
File metadata
- Download URL: elasticsearch_pydantic-0.1.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff23a43adf87f38be3b7fbb54626c4d0b3c853b89bdc8b3676b88f620d06f6cd
|
|
| MD5 |
8a6fc52e04d9d84dc10d235f88bc73db
|
|
| BLAKE2b-256 |
369c22d71b13dc3b1968dabfa746b0897e122b91560719f2e24f32c8218e7af2
|
Provenance
The following attestation bundles were made for elasticsearch_pydantic-0.1.0.tar.gz:
Publisher:
ci.yml on janheinrichmerker/elasticsearch-pydantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elasticsearch_pydantic-0.1.0.tar.gz -
Subject digest:
ff23a43adf87f38be3b7fbb54626c4d0b3c853b89bdc8b3676b88f620d06f6cd - Sigstore transparency entry: 485565954
- Sigstore integration time:
-
Permalink:
janheinrichmerker/elasticsearch-pydantic@226bda38d5fe3b813e832339cadb414d521ab310 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/janheinrichmerker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@226bda38d5fe3b813e832339cadb414d521ab310 -
Trigger Event:
push
-
Statement type:
File details
Details for the file elasticsearch_pydantic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: elasticsearch_pydantic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f49ac58a1d8ca0a4d86c73429085ae8f9bbff98a1af0977b7c7798eb226d738
|
|
| MD5 |
81a8414f345d4d66ee4b5a33c9f55e9d
|
|
| BLAKE2b-256 |
12523b699e4dc5a937ff9ef077b32d89aaad29050379f7e39f4d82f08f21609b
|
Provenance
The following attestation bundles were made for elasticsearch_pydantic-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on janheinrichmerker/elasticsearch-pydantic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elasticsearch_pydantic-0.1.0-py3-none-any.whl -
Subject digest:
0f49ac58a1d8ca0a4d86c73429085ae8f9bbff98a1af0977b7c7798eb226d738 - Sigstore transparency entry: 485565974
- Sigstore integration time:
-
Permalink:
janheinrichmerker/elasticsearch-pydantic@226bda38d5fe3b813e832339cadb414d521ab310 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/janheinrichmerker
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@226bda38d5fe3b813e832339cadb414d521ab310 -
Trigger Event:
push
-
Statement type: