OpenSearch Helper for Easy I/O
Project description
Open Search Helper (opensearch-helper)
A collection of methods for assisting with OpenSearch querying on AWS
MultiMatch Query Generator
Method Definition
multimatch_generator(input_text: str, size: int = 5, *args) -> MultiMatchQuery
Invoke Function
Pass in one-or-more field names after the query:
from opensearch_helper import multimatch_generator
d_query = multimatch_generator("what is the average PH of rainwater?" "question", "context")
Sample Output
{
"size":5,
"query":{
"multi_match":{
"query":"input_text",
"fields":[
"question"
]
}
}
}
API Query
Method Definition
query(d_query: MultiMatchQuery, index_name: str) -> OpenSearchResult
Invoke Function
The following environment variables must exist and be encrypted via baseblock::Run-Encrypt
- OPENSEARCH_HOST
- OPENSEARCH_REGION
- OPENSEARCH_USERNAME
- OPENSEARCH_PASSWORD
from opensearch_helper import query
query(d_query, index_name='myindex')
Score Top Hit
This method will retrieve the top hit and both quantitatively and qualitatively score the result.
Method Definition
score_top_hit(d_hits: dict) -> ScoreResult
Invoke Function
from opensearch_helper import score_top_hit
score_top_hit(d_hits)
Sample Output
{
"score":14.23432,
"type":"HIGH"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opensearch-helper-0.1.3.tar.gz
.
File metadata
- Download URL: opensearch-helper-0.1.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 186de7416923af5417c73bc079e7f31e61f0338259d314aab428b58cd55695dc |
|
MD5 | 2cf186fae314dd88a2cc695282ef297c |
|
BLAKE2b-256 | 081846858ec26fae78e986b3fe356f98b959036fe3fdd278e25be1adc965102d |
File details
Details for the file opensearch_helper-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: opensearch_helper-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbfb4d6acebaca547ac42e26bf034c0327328e772c503a424424b830dda82008 |
|
MD5 | ca4f7bf912660719b81c7bc328777752 |
|
BLAKE2b-256 | 2cccf6f6da20383884da44fb44b419991e575e45ced97d7a2a67a21b8da1dc90 |