Skip to main content

A lightweight Elasticsearch DSL query builder

Project description

es-query-builder

一个轻量、可扩展的 Elasticsearch DSL 查询构建器,适用于 FastAPI / Django / Flask 等后端服务。

特性

  • 声明式查询参数
  • 支持 eq / range / wildcard / fulltext / phrase
  • 游标分页友好
  • 与框架解耦

安装

pip install es-query-builder

使用

from es-query-builder import BaseQuery
from ... import RepositoryDocument


class RepoQuery(BaseQuery):
    stars__gte: int | None = None
    language: str | None = None
    search: list[str] | None = None

    class Constants:
        model = RepositoryDocument
        search = ["name", "description", "readme_content"]

query = RepoQuery(
    stars__gte=100,
    search=["fastapi async"],
)

conditions = query.to_es_conditions

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

es_query_builder-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

es_query_builder-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file es_query_builder-0.1.0.tar.gz.

File metadata

  • Download URL: es_query_builder-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for es_query_builder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf4ed9ecbcf302eed8d74f172d065a640014ecba3cd1458c98923694aa9e4219
MD5 394450f4062197fe2b4ae6725745ae43
BLAKE2b-256 de6dd60b3763a6fd7db984621e5c2395c19adfce902aed5c05cfe5f1a4ba4fce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for es_query_builder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f92abce2c49a5c34ad1e36b6e0ba77dbc341f2fea42d4da122e6b01e324770e5
MD5 6e2dde22ce09b2ec8efacf7e88527432
BLAKE2b-256 61eee1a9bd3e2d30addd550ff2226164e6562158896c4318fa94a5b4dac87e8f

See more details on using hashes here.

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