opensearch-helper


Nameopensearch-helper JSON
Version 0.1.24 PyPI version JSON
download
home_pagehttps://github.com/craigtrim/opensearch-helper
SummaryOpenSearch Helper for Easy I/O
upload_time2023-02-04 18:23:29
maintainerCraig Trim
docs_urlNone
authorCraig Trim
requires_python>=3.8.5,<4.0.0
licenseNone
keywords nlp nlu opensearch elasticsearch aws search
VCS
bugtrack_url
requirements attrs autopep8 baseblock boto3 botocore certifi cffi cfgv charset-normalizer colorama cryptography distlib entrypoints exceptiongroup filelock flake8 flakeheaven identify idna iniconfig jmespath mccabe nodeenv opensearch-helper opensearch-py packaging plac platformdirs pluggy pre-commit pycodestyle pycparser pyflakes Pygments pytest python-dateutil PyYAML requests requests-aws4auth s3transfer six toml tomli unicodedata2 urllib3 virtualenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Open Search Helper (opensearch-helper)
A collection of methods for assisting with OpenSearch querying on AWS

## MultiMatch Query Generator

**Method Definition**
```python
multimatch_generator(input_text: str, size: int = 5, *args) -> MultiMatchQuery
```

**Invoke Function**

Pass in one-or-more field names after the query:
```python
from opensearch_helper import multimatch_generator

d_query = multimatch_generator("what is the average PH of rainwater?" "question", "context")
```

**Sample Output**
```json
{
   "size":5,
   "query":{
      "multi_match":{
         "query":"input_text",
         "fields":[
            "question"
         ]
      }
   }
}
```

## API Query (AWS)
**Method Definition**
```python
query(d_query: MultiMatchQuery, index_name: str) -> OpenSearchResult
```

**Invoke Function**

The following environment variables must exist and be encrypted via `baseblock::Run-Encrypt`
1. OPENSEARCH_HOST
2. OPENSEARCH_REGION
3. OPENSEARCH_USERNAME
4. OPENSEARCH_PASSWORD

```python
from opensearch_helper import query

query(d_query, index_name='myindex')
```

## Local OpenSearch
From the terminal run
```shell
docker-compose up
```

The following environment variables must exist and be encrypted via `baseblock::Run-Encrypt`
1. OPENSEARCH_HOST
3. OPENSEARCH_USERNAME
4. OPENSEARCH_PASSWORD

Unless these have been modified, the default values can be found here
https://opensearch.org/docs/latest/opensearch/install/docker/

from a python script import
```python
from opensearch_helper import OpenSearchDEV
```

The following functions are available
```python
client = OpenSearchDEV()

client.create_index(...)
client.delete_index(...)
client.add(...)
client.query(...)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/craigtrim/opensearch-helper",
    "name": "opensearch-helper",
    "maintainer": "Craig Trim",
    "docs_url": null,
    "requires_python": ">=3.8.5,<4.0.0",
    "maintainer_email": "craigtrim@gmail.com",
    "keywords": "nlp,nlu,opensearch,elasticsearch,aws,search",
    "author": "Craig Trim",
    "author_email": "craigtrim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/03/92/9aac8e22577905b733a5c9ca9da85e5c0b52c678a96a75699fbb0a3fb017/opensearch-helper-0.1.24.tar.gz",
    "platform": null,
    "description": "# Open Search Helper (opensearch-helper)\nA collection of methods for assisting with OpenSearch querying on AWS\n\n## MultiMatch Query Generator\n\n**Method Definition**\n```python\nmultimatch_generator(input_text: str, size: int = 5, *args) -> MultiMatchQuery\n```\n\n**Invoke Function**\n\nPass in one-or-more field names after the query:\n```python\nfrom opensearch_helper import multimatch_generator\n\nd_query = multimatch_generator(\"what is the average PH of rainwater?\" \"question\", \"context\")\n```\n\n**Sample Output**\n```json\n{\n   \"size\":5,\n   \"query\":{\n      \"multi_match\":{\n         \"query\":\"input_text\",\n         \"fields\":[\n            \"question\"\n         ]\n      }\n   }\n}\n```\n\n## API Query (AWS)\n**Method Definition**\n```python\nquery(d_query: MultiMatchQuery, index_name: str) -> OpenSearchResult\n```\n\n**Invoke Function**\n\nThe following environment variables must exist and be encrypted via `baseblock::Run-Encrypt`\n1. OPENSEARCH_HOST\n2. OPENSEARCH_REGION\n3. OPENSEARCH_USERNAME\n4. OPENSEARCH_PASSWORD\n\n```python\nfrom opensearch_helper import query\n\nquery(d_query, index_name='myindex')\n```\n\n## Local OpenSearch\nFrom the terminal run\n```shell\ndocker-compose up\n```\n\nThe following environment variables must exist and be encrypted via `baseblock::Run-Encrypt`\n1. OPENSEARCH_HOST\n3. OPENSEARCH_USERNAME\n4. OPENSEARCH_PASSWORD\n\nUnless these have been modified, the default values can be found here\nhttps://opensearch.org/docs/latest/opensearch/install/docker/\n\nfrom a python script import\n```python\nfrom opensearch_helper import OpenSearchDEV\n```\n\nThe following functions are available\n```python\nclient = OpenSearchDEV()\n\nclient.create_index(...)\nclient.delete_index(...)\nclient.add(...)\nclient.query(...)\n```\n",
    "bugtrack_url": null,
    "license": "None",
    "summary": "OpenSearch Helper for Easy I/O",
    "version": "0.1.24",
    "split_keywords": [
        "nlp",
        "nlu",
        "opensearch",
        "elasticsearch",
        "aws",
        "search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36d2358528e36641da3e6747a6674d9af9d1816dd21804ffce2c0d37552e748d",
                "md5": "a899a3021b7b99d78fa53d42f14fcc62",
                "sha256": "3fee194609fb5416289c2b9e85b37ad5f911a8545a53256cebd0c2302bca8b94"
            },
            "downloads": -1,
            "filename": "opensearch_helper-0.1.24-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a899a3021b7b99d78fa53d42f14fcc62",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 11484,
            "upload_time": "2023-02-04T18:23:31",
            "upload_time_iso_8601": "2023-02-04T18:23:31.148429Z",
            "url": "https://files.pythonhosted.org/packages/36/d2/358528e36641da3e6747a6674d9af9d1816dd21804ffce2c0d37552e748d/opensearch_helper-0.1.24-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03929aac8e22577905b733a5c9ca9da85e5c0b52c678a96a75699fbb0a3fb017",
                "md5": "65dfa1ab0fc3cb9717b33fd0f1814abb",
                "sha256": "699d347ebe009d703990fa753a2e0559476c341b7efc51d2a6e61c9d6b59e38c"
            },
            "downloads": -1,
            "filename": "opensearch-helper-0.1.24.tar.gz",
            "has_sig": false,
            "md5_digest": "65dfa1ab0fc3cb9717b33fd0f1814abb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 6993,
            "upload_time": "2023-02-04T18:23:29",
            "upload_time_iso_8601": "2023-02-04T18:23:29.403464Z",
            "url": "https://files.pythonhosted.org/packages/03/92/9aac8e22577905b733a5c9ca9da85e5c0b52c678a96a75699fbb0a3fb017/opensearch-helper-0.1.24.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-04 18:23:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "craigtrim",
    "github_project": "opensearch-helper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "attrs",
            "specs": []
        },
        {
            "name": "autopep8",
            "specs": []
        },
        {
            "name": "baseblock",
            "specs": []
        },
        {
            "name": "boto3",
            "specs": []
        },
        {
            "name": "botocore",
            "specs": []
        },
        {
            "name": "certifi",
            "specs": []
        },
        {
            "name": "cffi",
            "specs": []
        },
        {
            "name": "cfgv",
            "specs": []
        },
        {
            "name": "charset-normalizer",
            "specs": []
        },
        {
            "name": "colorama",
            "specs": []
        },
        {
            "name": "cryptography",
            "specs": []
        },
        {
            "name": "distlib",
            "specs": []
        },
        {
            "name": "entrypoints",
            "specs": []
        },
        {
            "name": "exceptiongroup",
            "specs": []
        },
        {
            "name": "filelock",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": []
        },
        {
            "name": "flakeheaven",
            "specs": []
        },
        {
            "name": "identify",
            "specs": []
        },
        {
            "name": "idna",
            "specs": []
        },
        {
            "name": "iniconfig",
            "specs": []
        },
        {
            "name": "jmespath",
            "specs": []
        },
        {
            "name": "mccabe",
            "specs": []
        },
        {
            "name": "nodeenv",
            "specs": []
        },
        {
            "name": "opensearch-helper",
            "specs": [
                [
                    "==",
                    "0.1.24"
                ]
            ]
        },
        {
            "name": "opensearch-py",
            "specs": []
        },
        {
            "name": "packaging",
            "specs": []
        },
        {
            "name": "plac",
            "specs": []
        },
        {
            "name": "platformdirs",
            "specs": []
        },
        {
            "name": "pluggy",
            "specs": []
        },
        {
            "name": "pre-commit",
            "specs": []
        },
        {
            "name": "pycodestyle",
            "specs": []
        },
        {
            "name": "pycparser",
            "specs": []
        },
        {
            "name": "pyflakes",
            "specs": []
        },
        {
            "name": "Pygments",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "python-dateutil",
            "specs": []
        },
        {
            "name": "PyYAML",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "requests-aws4auth",
            "specs": []
        },
        {
            "name": "s3transfer",
            "specs": []
        },
        {
            "name": "six",
            "specs": []
        },
        {
            "name": "toml",
            "specs": []
        },
        {
            "name": "tomli",
            "specs": []
        },
        {
            "name": "unicodedata2",
            "specs": []
        },
        {
            "name": "urllib3",
            "specs": []
        },
        {
            "name": "virtualenv",
            "specs": []
        }
    ],
    "lcname": "opensearch-helper"
}
        
Elapsed time: 0.12477s