Skip to main content

Use the Elasticsearch DSL with Pydantic models.

Project description

PyPi CI Code coverage Python Issues Commit activity Downloads License

🔍 elasticsearch-pydantic

Use the Elasticsearch DSL with Pydantic models.

This minimal library is for those who...

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:

  • elasticsearch8
  • elasticsearch-dsl
  • elasticsearch6-dsl
  • elasticsearch7-dsl
  • elasticsearch8-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

elasticsearch_pydantic-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elasticsearch_pydantic-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for elasticsearch_pydantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff23a43adf87f38be3b7fbb54626c4d0b3c853b89bdc8b3676b88f620d06f6cd
MD5 8a6fc52e04d9d84dc10d235f88bc73db
BLAKE2b-256 369c22d71b13dc3b1968dabfa746b0897e122b91560719f2e24f32c8218e7af2

See more details on using hashes here.

Provenance

The following attestation bundles were made for elasticsearch_pydantic-0.1.0.tar.gz:

Publisher: ci.yml on janheinrichmerker/elasticsearch-pydantic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elasticsearch_pydantic-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for elasticsearch_pydantic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f49ac58a1d8ca0a4d86c73429085ae8f9bbff98a1af0977b7c7798eb226d738
MD5 81a8414f345d4d66ee4b5a33c9f55e9d
BLAKE2b-256 12523b699e4dc5a937ff9ef077b32d89aaad29050379f7e39f4d82f08f21609b

See more details on using hashes here.

Provenance

The following attestation bundles were made for elasticsearch_pydantic-0.1.0-py3-none-any.whl:

Publisher: ci.yml on janheinrichmerker/elasticsearch-pydantic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page