anysearch


Nameanysearch JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/barseghyanartur/anysearch/
SummaryElasticsearch and OpenSearch compatibility library.
upload_time2022-12-29 00:32:25
maintainer
docs_urlNone
authorArtur Barseghyan
requires_python>=3.6
licenseMIT
keywords elasticsearch elasticsearch-dsl opensearch opensearch-dsl
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
anysearch
=========
``AnySearch`` is a ``Elasticsearch`` and ``OpenSearch`` compatibility library.
It provides utility functions for smoothing over the differences between the
Python libraries with the goal of writing Python code that is compatible on
both (including the ``*search`` and ``*search-dsl`` packages).

See the documentation for more information on what is provided.

.. image:: https://img.shields.io/pypi/v/anysearch.svg
   :target: https://pypi.python.org/pypi/anysearch
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/anysearch.svg
    :target: https://pypi.python.org/pypi/anysearch/
    :alt: Supported Python versions

.. image:: https://github.com/barseghyanartur/anysearch/workflows/test/badge.svg
   :target: https://github.com/barseghyanartur/anysearch/actions?query=workflow%3Atest
   :alt: Build Status

.. image:: https://readthedocs.org/projects/anysearch/badge/?version=latest
    :target: http://anysearch.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
   :target: https://github.com/barseghyanartur/anysearch/#License
   :alt: MIT

.. image:: https://coveralls.io/repos/github/barseghyanartur/anysearch/badge.svg?branch=main
    :target: https://coveralls.io/github/barseghyanartur/anysearch?branch=main
    :alt: Coverage

Documentation
=============
Documentation is available on `Read the Docs
<http://anysearch.readthedocs.io/>`_.

Prerequisites
=============
- Python 3.6, 3.7, 3.8, 3.9 and 3.10.

Installation
============
Install latest stable version from PyPI:

.. code-block:: sh

    pip install anysearch

or latest stable version from GitHub:

.. code-block:: sh

    pip install https://github.com/barseghyanartur/anysearch/archive/main.tar.gz

Configuration
=============
``AnySearch`` automatically detects whether you use ``Elasticsearch`` or
``OpenSearch`` by looking at which packages are installed.
However, if you have both packages installed, you can instruct ``AnySearch``
which one do you actually want to use. The way to do that is to set the
``ANYSEARCH_PREFERRED_BACKEND`` environment variable to either
``Elasticsearch`` or ``OpenSearch``.

For ``Elasticsearch``:

.. code-block:: python

    import os
    os.environ.setdefault("ANYSEARCH_PREFERRED_BACKEND", "Elasticsearch")

For ``OpenSearch``:

.. code-block:: python

    import os
    os.environ.setdefault("ANYSEARCH_PREFERRED_BACKEND", "OpenSearch")

Usage
=====
``elasticsearch``/``opensearch``
----------------------------------------
How-to
~~~~~~
With ``elasticsearch`` you would do:

.. code-block:: python

    from elasticsearch import Connection, Elasticsearch

With ``opensearch`` you would do:

.. code-block:: python

    from opensearch_py import Connection, OpenSearch

With ``anysearch`` you would change that to:

.. code-block:: python

    from anysearch.search import Connection, AnySearch

``elasticsearch-dsl``/``opensearch-dsl``
----------------------------------------
How-to
~~~~~~
With ``elasticsearch-dsl`` you would do:

.. code-block:: python

    from elasticsearch_dsl import AggsProxy, connections, Keyword
    from elasticsearch_dsl.document import Document

With ``opensearch-dsl`` you would do:

.. code-block:: python

    from opensearch_dsl import AggsProxy, connections, Keyword
    from opensearch_dsl.document import Document

With ``anysearch`` you would change that to:

.. code-block:: python

    from anysearch.search_dsl import AggsProxy, connections, Keyword
    from anysearch.search_dsl.document import Document

Testing
=======
Project is covered with tests.

To test with all supported Python versions type:

.. code-block:: sh

    tox

To test against specific environment, type:

.. code-block:: sh

    tox -e py39

To test just your working environment type:

.. code-block:: sh

    pytest

To run a single test in your working environment type:

.. code-block:: sh

    pytest test_anysearch.py

To run a single test class in a given test module in your working environment
type:

.. code-block:: sh

    pytest test_anysearch.py::AnySearchTestCase

It's assumed that you have either ``elasticsearch-dsl`` or ``opensearch-dsl``
installed. If not, install the requirements first.

Writing documentation
=====================
Keep the following hierarchy.

.. code-block:: text

    =====
    title
    =====

    header
    ======

    sub-header
    ----------

    sub-sub-header
    ~~~~~~~~~~~~~~

    sub-sub-sub-header
    ^^^^^^^^^^^^^^^^^^

    sub-sub-sub-sub-header
    ++++++++++++++++++++++

    sub-sub-sub-sub-sub-header
    **************************

License
=======
MIT

Support
=======
For any security issues contact me at the e-mail given in the `Author`_ section.
For overall issues, go to `GitHub <https://github.com/barseghyanartur/anysearch/issues>`_.

Author
======
Artur Barseghyan <artur.barseghyan@gmail.com>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/barseghyanartur/anysearch/",
    "name": "anysearch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "elasticsearch,elasticsearch-dsl,opensearch,opensearch-dsl",
    "author": "Artur Barseghyan",
    "author_email": "artur.barseghyan@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/46/d6/4d228ad60e92113ad9edfb6dbb81e269840cedb6fa7f9949693c7af8844e/anysearch-0.2.2.tar.gz",
    "platform": null,
    "description": "=========\nanysearch\n=========\n``AnySearch`` is a ``Elasticsearch`` and ``OpenSearch`` compatibility library.\nIt provides utility functions for smoothing over the differences between the\nPython libraries with the goal of writing Python code that is compatible on\nboth (including the ``*search`` and ``*search-dsl`` packages).\n\nSee the documentation for more information on what is provided.\n\n.. image:: https://img.shields.io/pypi/v/anysearch.svg\n   :target: https://pypi.python.org/pypi/anysearch\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/anysearch.svg\n    :target: https://pypi.python.org/pypi/anysearch/\n    :alt: Supported Python versions\n\n.. image:: https://github.com/barseghyanartur/anysearch/workflows/test/badge.svg\n   :target: https://github.com/barseghyanartur/anysearch/actions?query=workflow%3Atest\n   :alt: Build Status\n\n.. image:: https://readthedocs.org/projects/anysearch/badge/?version=latest\n    :target: http://anysearch.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg\n   :target: https://github.com/barseghyanartur/anysearch/#License\n   :alt: MIT\n\n.. image:: https://coveralls.io/repos/github/barseghyanartur/anysearch/badge.svg?branch=main\n    :target: https://coveralls.io/github/barseghyanartur/anysearch?branch=main\n    :alt: Coverage\n\nDocumentation\n=============\nDocumentation is available on `Read the Docs\n<http://anysearch.readthedocs.io/>`_.\n\nPrerequisites\n=============\n- Python 3.6, 3.7, 3.8, 3.9 and 3.10.\n\nInstallation\n============\nInstall latest stable version from PyPI:\n\n.. code-block:: sh\n\n    pip install anysearch\n\nor latest stable version from GitHub:\n\n.. code-block:: sh\n\n    pip install https://github.com/barseghyanartur/anysearch/archive/main.tar.gz\n\nConfiguration\n=============\n``AnySearch`` automatically detects whether you use ``Elasticsearch`` or\n``OpenSearch`` by looking at which packages are installed.\nHowever, if you have both packages installed, you can instruct ``AnySearch``\nwhich one do you actually want to use. The way to do that is to set the\n``ANYSEARCH_PREFERRED_BACKEND`` environment variable to either\n``Elasticsearch`` or ``OpenSearch``.\n\nFor ``Elasticsearch``:\n\n.. code-block:: python\n\n    import os\n    os.environ.setdefault(\"ANYSEARCH_PREFERRED_BACKEND\", \"Elasticsearch\")\n\nFor ``OpenSearch``:\n\n.. code-block:: python\n\n    import os\n    os.environ.setdefault(\"ANYSEARCH_PREFERRED_BACKEND\", \"OpenSearch\")\n\nUsage\n=====\n``elasticsearch``/``opensearch``\n----------------------------------------\nHow-to\n~~~~~~\nWith ``elasticsearch`` you would do:\n\n.. code-block:: python\n\n    from elasticsearch import Connection, Elasticsearch\n\nWith ``opensearch`` you would do:\n\n.. code-block:: python\n\n    from opensearch_py import Connection, OpenSearch\n\nWith ``anysearch`` you would change that to:\n\n.. code-block:: python\n\n    from anysearch.search import Connection, AnySearch\n\n``elasticsearch-dsl``/``opensearch-dsl``\n----------------------------------------\nHow-to\n~~~~~~\nWith ``elasticsearch-dsl`` you would do:\n\n.. code-block:: python\n\n    from elasticsearch_dsl import AggsProxy, connections, Keyword\n    from elasticsearch_dsl.document import Document\n\nWith ``opensearch-dsl`` you would do:\n\n.. code-block:: python\n\n    from opensearch_dsl import AggsProxy, connections, Keyword\n    from opensearch_dsl.document import Document\n\nWith ``anysearch`` you would change that to:\n\n.. code-block:: python\n\n    from anysearch.search_dsl import AggsProxy, connections, Keyword\n    from anysearch.search_dsl.document import Document\n\nTesting\n=======\nProject is covered with tests.\n\nTo test with all supported Python versions type:\n\n.. code-block:: sh\n\n    tox\n\nTo test against specific environment, type:\n\n.. code-block:: sh\n\n    tox -e py39\n\nTo test just your working environment type:\n\n.. code-block:: sh\n\n    pytest\n\nTo run a single test in your working environment type:\n\n.. code-block:: sh\n\n    pytest test_anysearch.py\n\nTo run a single test class in a given test module in your working environment\ntype:\n\n.. code-block:: sh\n\n    pytest test_anysearch.py::AnySearchTestCase\n\nIt's assumed that you have either ``elasticsearch-dsl`` or ``opensearch-dsl``\ninstalled. If not, install the requirements first.\n\nWriting documentation\n=====================\nKeep the following hierarchy.\n\n.. code-block:: text\n\n    =====\n    title\n    =====\n\n    header\n    ======\n\n    sub-header\n    ----------\n\n    sub-sub-header\n    ~~~~~~~~~~~~~~\n\n    sub-sub-sub-header\n    ^^^^^^^^^^^^^^^^^^\n\n    sub-sub-sub-sub-header\n    ++++++++++++++++++++++\n\n    sub-sub-sub-sub-sub-header\n    **************************\n\nLicense\n=======\nMIT\n\nSupport\n=======\nFor any security issues contact me at the e-mail given in the `Author`_ section.\nFor overall issues, go to `GitHub <https://github.com/barseghyanartur/anysearch/issues>`_.\n\nAuthor\n======\nArtur Barseghyan <artur.barseghyan@gmail.com>\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Elasticsearch and OpenSearch compatibility library.",
    "version": "0.2.2",
    "split_keywords": [
        "elasticsearch",
        "elasticsearch-dsl",
        "opensearch",
        "opensearch-dsl"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "bc63be89b5bf454ac34ac191e97fad87",
                "sha256": "e0538d8f138258692a568e305ffaf4bd565959993fe4d1a2513fedf7d35f95da"
            },
            "downloads": -1,
            "filename": "anysearch-0.2.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bc63be89b5bf454ac34ac191e97fad87",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 8743,
            "upload_time": "2022-12-29T00:32:24",
            "upload_time_iso_8601": "2022-12-29T00:32:24.639019Z",
            "url": "https://files.pythonhosted.org/packages/eb/69/9b1d928f717c859b81d7c138d1a668544dded59202afd919c31fea9f2175/anysearch-0.2.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "ff669afecfc0745c314a86376d99e198",
                "sha256": "62a7d1cae2b9822e2ec262f5108c4bdd6c159e8b53adbae7fc29885451e1b722"
            },
            "downloads": -1,
            "filename": "anysearch-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ff669afecfc0745c314a86376d99e198",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13122,
            "upload_time": "2022-12-29T00:32:25",
            "upload_time_iso_8601": "2022-12-29T00:32:25.880896Z",
            "url": "https://files.pythonhosted.org/packages/46/d6/4d228ad60e92113ad9edfb6dbb81e269840cedb6fa7f9949693c7af8844e/anysearch-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-29 00:32:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "barseghyanartur",
    "github_project": "anysearch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "anysearch"
}
        
Elapsed time: 0.04230s