I want to use elasticsearch for a new project and from my research there seems to be 3 viable solutions:
I like solution 1 because it doesn't need dependencies and I can focus on learning the native syntax/api as opposed that of a wrapper as in 2 or 3. Are there any convincing reasons to use 2 or 3 over 1?
Update
I ended up using elasticsearch-py as it offers various benefits like connection pooling and persistence. I found elasticsearch-dsl-py too abstract and verbose
I would suggest that there is no reason to talk directly to Elasticsearch when an official Python client is available. The Python client does a lot of the heavy lifting for you - otherwise you will spend a lot of time/effort in converting Python data to ES and vice versa.
As regards the choice between elasticsearch-dsl-py
and elasticsearch-py
:
elasticsearch-dsl-py
is a wrapper for the Query DSL only (plus a few other things). It doesn't provide access to the whole Elasticsearch API (e.g., Cluster API, Indices API, Bulk API etc.). It says in the docs:
To use the other Elasticsearch APIs (eg. cluster health) just use the underlying client.
It is highly likely that you will need to use both libraries in any large application. elasticsearch-dsl-py
itself uses elasticsearch-py
.
I agree with your comment about Haystack - it's Elasticsearch backend leaves a lot to be desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With