elasticwrapper
Elasticsearch offers (major) API-versioned packages for its Python SDK, called elasticsearch2,
elasticsearch5 and so on.
This wrapper connects to the given URL, retrieves the major version and imports the versioned
module according to that.
Usage examples:
from elasticwrapper import elasticsearch
es = elasticsearch.Elasticsearch()
res = es.search(index="*", body={})
This will connect to the default http://localhost:9200/ URL.
Customizing the wrapper
You can override defaults in the following ways:
With environment variables
You can set the Elasticsearch URL with the following environment variable:
ELASTICWRAPPER_URL=http://localhost:9200 python -c "from elasticwrapper import elasticsearch; print(elasticsearch)"
And the connect timeout with:
ELASTICWRAPPER_TIMEOUT
(specified in seconds)
Through builtins
The URL can be set from code as well, either by setting the above environment variable (before)
the import, or by through the builtins module:
# anywhere in the code before the `elasticwrapper` import
import builtins
builtins.elasticwrapper_url = "http://localhost:9200"
builtins.elasticwrapper_timeout = 30
# anywhere in the code after variables has been set up in `builtins`
from elasticwrapper import elasticsearch
Caveats
Elasticwrapper (currently) does nothing more than selecting the right (major) elasticsearch
module to be imported and imports it under elasticwrapper.elasticsearch.
Be aware, that elasticsearch might be incompatible with your Elasticsearch cluster even in the
same major version (like 7.x).
Also, elasticwrapper currently does nothing to provide API compatibility, so different SDK versions
might (and will) need different syntax.
Metadata
Release files for elasticwrapper 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elasticwrapper-0.0.1.tar.gz | 2.7 kB | Without provenance | Details for elasticwrapper-0.0.1.tar.gz |
Release files / elasticwrapper-0.0.1.tar.gz
| Download URL | elasticwrapper-0.0.1.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9edebf6da34d699ad40d50e11b621bb2da55eec5117aa8b00431051e546045d8
|
|
BLAKE2b-256 checksum How to use checksums |
51a2390116f6613f2e6a07520bd7a0218274445b997f0143ecacef70b1d2bae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7
|
Security for elasticwrapper 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.