{ "info": { "author": "Jacob Straszynski", "author_email": "jacob.straszynski@planet.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "===============================\nESFluent\n===============================\n\n.. image:: https://travis-ci.org/planetlabs/es_fluent.svg\n :target: https://travis-ci.org/planetlabs/es_fluent\n\n.. image:: https://img.shields.io/pypi/v/es_fluent.svg\n :target: https://pypi.python.org/pypi/es_fluent\n\n\nA user-friendly module for managing and composing elasticsearch queries.\n\n.. doctest::\n\n >>> from es_fluent.builder import QueryBuilder\n >>> query_builder = QueryBuilder()\n >>> query_builder.and_filter('term', 'planet', 'earth')\n >>> query_builder.enable_source()\n >>> query_builder.to_query()\n {'filter': {'and': [{'term': {'planet': 'earth'}}]}, 'fields': [], '_source': True}\n\nSupported Servers\n-----------------\n\nESFluent only supports the 1.x stream of elasticsearch.\n\nFeatures\n--------\n\n* A Fluent API for generating and composing queries.\n* Support for many elasticsearch filter types.\n* Pluggable filter definitions, currently we simply model existing\n elasticsearch filters.\n\n\nConcepts and Walkthrough\n------------------------\n\nWe'll walk through some examples of getting started with ESFluent. If you're\nthe type that likes to shoot first and ask questions later, the tests will\nexercise all of the API concepts.\n\nThe QueryBuilder\n~~~~~~~~~~~~~~~~\n\nThe QueryBuilder encapsulates the entire query. It features\na :func:`~es_fluent.filters.core.Filter.to_query` method which generates a JSON\npayload suitable for POST'ing to elasticsearch.\n\nFor the most part, you'll be adding chains of filters. The QueryBuilder offers\nadditional support for:\n\n* Enabling or disabling the _source document. By default this is not returned,\n but many use cases demand it. See\n :func:`~es_fluent.builder.QueryBuilder.enable_source` and\n :func:`~es_fluent.builder.QueryBuilder.disable_source`.\n* Limiting returned fields. See :func:`~es_fluent.builder.QueryBuilder.add_field`.\n* Configuring sorting. See :func:`~es_fluent.builder.QueryBuilder.sort`.\n\nTo create a :class:`~es_fluent.builder.QueryBuilder` instance:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n\nFilter Basics\n~~~~~~~~~~~~~\n\nHaving created a QueryBuilder instance, you're likely going to want\nto add filter criteria. There are two ways of doing this: importing the filter\nclass directly and creating an instance of a filter by hand then agumenting\nyour QueryBuilder instance:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n from es_fluent.filters import Term\n\n query = QueryBuilder()\n query.add_filter(Term('field_name', 'field_value'))\n\nThe alternative approach is to use a shorthand notation:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n\n query = QueryBuilder()\n # Args and kwargs are forwarded to appropriate constructors.\n query.add_filter('range', 'field_name', lte=0.5)\n\n\nEach Filter class has a registered name - see the `name` class attribute - that\nis used as it's shorthand identifier.\n\nNegation\n~~~~~~~~\n\nTaking a page out of various Python ORMs, we support the `~` operator to\nnegate filters. This effectively wraps the filter in a `not` filter in\nelasticsearch:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n from es_fluent.filters import Term\n\n query = QueryBuilder()\n query.add_filter(~Term('field_name', 'field_value'))\n\nThis is equivalent to:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n from es_fluent.filters import Not, Term\n query = QueryBuilder()\n query.add_filter(Not(Term('field_name', 'field_value')))\n\nAnd also equivalent to:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n query.add_filter('~term', 'field_name', 'field_value')\n\nBoolean Filters\n~~~~~~~~~~~~~~~\n\nBoolean filters contain a list of sub-filters. The API provides conveniences\nfor creating nested and / or clauses:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n query.or_filter('term', 'field_name', 'field_value')\n query.or_filter('term', 'another_field', 'another_value')\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n query.and_filter('term', 'field_name', 'field_value')\n query.and_filter('term', 'another_field', 'another_value')\n\nNote that with elasticsearch, you cannot have both an `And` and `Or` clause at\nthe root level:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n query.or_filter('term', 'or_clause_field', 'or_clause_value')\n query.and_filter('term', 'and_clause_field', 'and_clause_value')\n\nBut this can be achieved using:\n\n.. code-block:: python\n\n from es_fluent.builder import QueryBuilder\n query = QueryBuilder()\n\n and_clauses = And()\n and_clauses.or_filter('term', 'or_clause_field', 'or_clause_value')\n and_clauses.and_filter('term', 'and_clause_field', 'and_clause_value')\n\n query.add_filter(and_clauses)\n\n\n\n\nHistory\n-------\n\n0.0.5 (2016-04-27)\n---------------------\n\n* Utilize `is_empty` during query generation.\n\n0.0.4 (2016-04-21)\n---------------------\n\n* Fixing `is_empty` so it works properly on nested boolean filters - an\n `AndFilter` with an empty `AndFilter` inside of it is empty, overall.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/planetlabs/es_fluent", "keywords": "es_fluent", "license": "Apache 2", "maintainer": null, "maintainer_email": null, "name": "es-fluent", "package_url": "https://pypi.org/project/es-fluent/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/es-fluent/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/planetlabs/es_fluent" }, "release_url": "https://pypi.org/project/es-fluent/0.0.5/", "requires_dist": null, "requires_python": null, "summary": "Fluent API for generating elastic queries.", "version": "0.0.5" }, "last_serial": 3332633, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "15e006f90332e5c2a012787e0f0f85b9", "sha256": "01572c6bd18f606770cf7dc1d645994b389cf87ab8ca83eb26dab69a27b296ce" }, "downloads": -1, "filename": "es-fluent-0.0.1.tar.gz", "has_sig": false, "md5_digest": "15e006f90332e5c2a012787e0f0f85b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19656, "upload_time": "2016-01-18T00:39:47", "url": "https://files.pythonhosted.org/packages/db/ad/696f49d698eacd556709a93e6872bdd04fda7c84308db155a24759ba44f0/es-fluent-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "1bac902c059354cce78baad775de7019", "sha256": "d4006e5764a11978daedcdf4d0bc86261210de8cc51d541598fed4ab2f008e4f" }, "downloads": -1, "filename": "es-fluent-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1bac902c059354cce78baad775de7019", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23950, "upload_time": "2016-01-25T22:46:43", "url": "https://files.pythonhosted.org/packages/74/9e/ac58f5bfaa49c54cdd88e874af6f6b6b79cff15b83cbd4c395994d997b20/es-fluent-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "cba10a3a0642392966bc00619e407c59", "sha256": "63be5aa0829dcf075e6b5991c639f3282c8302491a6c15a083693a36f5bbe297" }, "downloads": -1, "filename": "es_fluent-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cba10a3a0642392966bc00619e407c59", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13644, "upload_time": "2016-03-18T18:35:48", "url": "https://files.pythonhosted.org/packages/f1/ac/9071a83b4f16e5afd3756687ec882d14d4974e61356919a6830cde78b109/es_fluent-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31378b887321b40455f3cfbd0ec743ec", "sha256": "51c74d183f3d2bc45215394912480e0bd7b118aead1010cfb275888bbab22f78" }, "downloads": -1, "filename": "es-fluent-0.0.3.tar.gz", "has_sig": false, "md5_digest": "31378b887321b40455f3cfbd0ec743ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24408, "upload_time": "2016-03-18T18:35:27", "url": "https://files.pythonhosted.org/packages/d2/79/59d7161d31c2eadd8f5b2c45502a32effed9b06c26032c1ab530bf8ba9c3/es-fluent-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "2c320b10925544cfda51841bbeb62731", "sha256": "2e7d5a859226d8587f54080cde7a193a08ca7b05329e028de248f68f478c6b87" }, "downloads": -1, "filename": "es-fluent-0.0.4.tar.gz", "has_sig": false, "md5_digest": "2c320b10925544cfda51841bbeb62731", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24850, "upload_time": "2016-04-21T19:30:07", "url": "https://files.pythonhosted.org/packages/93/14/2147477c81a61975159fa4d954a15822d819cabc052190e40bbb57518159/es-fluent-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "965a99d71cbba08ee917f606a80426de", "sha256": "fabc39afdba6465c1c97ed2729962115bb2bba977a8f334a8943c01d8232c416" }, "downloads": -1, "filename": "es_fluent-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "965a99d71cbba08ee917f606a80426de", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13961, "upload_time": "2016-04-28T00:01:10", "url": "https://files.pythonhosted.org/packages/5c/ab/6fe08025c7099ef8a1ab48e8cac67a0479bc9d57274645395a2cb4494555/es_fluent-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a63dd5675ef57333d0a7b2eefb600b0a", "sha256": "f5e581b53e06a4c614dcb3d275aa02095f38873c261f79ebe8f92162e154b350" }, "downloads": -1, "filename": "es-fluent-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a63dd5675ef57333d0a7b2eefb600b0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24941, "upload_time": "2016-04-28T00:00:51", "url": "https://files.pythonhosted.org/packages/9e/ee/7e9d2f2f9ef1a7904b401666e7bdec3b2a1b21e1339cd5d204f18b9172c7/es-fluent-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "965a99d71cbba08ee917f606a80426de", "sha256": "fabc39afdba6465c1c97ed2729962115bb2bba977a8f334a8943c01d8232c416" }, "downloads": -1, "filename": "es_fluent-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "965a99d71cbba08ee917f606a80426de", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13961, "upload_time": "2016-04-28T00:01:10", "url": "https://files.pythonhosted.org/packages/5c/ab/6fe08025c7099ef8a1ab48e8cac67a0479bc9d57274645395a2cb4494555/es_fluent-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a63dd5675ef57333d0a7b2eefb600b0a", "sha256": "f5e581b53e06a4c614dcb3d275aa02095f38873c261f79ebe8f92162e154b350" }, "downloads": -1, "filename": "es-fluent-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a63dd5675ef57333d0a7b2eefb600b0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24941, "upload_time": "2016-04-28T00:00:51", "url": "https://files.pythonhosted.org/packages/9e/ee/7e9d2f2f9ef1a7904b401666e7bdec3b2a1b21e1339cd5d204f18b9172c7/es-fluent-0.0.5.tar.gz" } ] }