An (almost!) drop in replacement in python of the Elasticsearch Bodybuilder Package on NPM
The API has been designed to be as close to the original package.
Also, you can use https://bodybuilder.js.org/ to test your constructions with minor changes described below:
from
->from_
becausefrom
is a python keyword- need
\
new-line indicator for multi line incantations in python which is not necessary in JS - individual Filter/Query/Aggregations classes not implemented (shouldn't affect user)
- lambda functions instead of anonymous functions (Duh!)
Python3.6+
pip3 install bodybuilder
- Clone package locally
- Go to the root directory
python3 setup.py install
from bodybuilder import BodyBuilder as bodyBuilder
bodyBuilder().query("a", "b", "c").build()
{'query': {'a': {'b': 'c'}}}
More examples can be found in the blog post here - https://blog.alexsanjoseph.com/posts/bodybuilder_intro/
- minimum_should_match query and filter
- aggregation metadata
- Complicated multi sort
clone
method (users can usecopy.deepcopy()
if required)orQuery
,andQuery
,notQuery
which has been deprecated n favor ofbool
method
Thanks to Danpaz and contributors of the original package for the original package from which I have liberally copied (with his permission!)