Elasticsearch 的 Python client,提供较为方便的查询语法。
SQL select * from “ExampleModel” where “name” = “tina” tina models, total = ExampleModel.where(‘name’, equal=’tina’).fetch() SQL select * from “ExampleModel” where “category” = 1 or “category” = 3 order by “created_at” limit 20 offset 20 Python models, total = ExampleModel.where(‘category’, contains=[1, 3])\ .order_by(‘created_at’).fetch(20, 20)
select * from “ExampleModel” where “name” = “tina”
models, total = ExampleModel.where(‘name’, equal=’tina’).fetch()
order by “created_at” limit 20 offset 20
models, total = ExampleModel.where(‘category’, contains=[1, 3])\ .order_by(‘created_at’).fetch(20, 20)