{"id":16711600,"url":"https://github.com/laysauchoa/opensearch-python-dive-in","last_synced_at":"2026-03-04T19:02:34.678Z","repository":{"id":43187032,"uuid":"510044841","full_name":"laysauchoa/opensearch-python-dive-in","owner":"laysauchoa","description":"OpenSearch in Python","archived":false,"fork":false,"pushed_at":"2023-11-16T15:10:26.000Z","size":14194,"stargazers_count":24,"open_issues_count":6,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T06:54:37.250Z","etag":null,"topics":["hacktoberfest","opensearch","python","python3","rich","typer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laysauchoa.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2022-07-03T14:22:34.000Z","updated_at":"2024-12-31T23:21:31.000Z","dependencies_parsed_at":"2023-02-13T22:46:10.380Z","dependency_job_id":null,"html_url":"https://github.com/laysauchoa/opensearch-python-dive-in","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysauchoa%2Fopensearch-python-dive-in","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysauchoa%2Fopensearch-python-dive-in/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysauchoa%2Fopensearch-python-dive-in/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysauchoa%2Fopensearch-python-dive-in/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laysauchoa","download_url":"https://codeload.github.com/laysauchoa/opensearch-python-dive-in/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166184,"owners_count":21058475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","opensearch","python","python3","rich","typer"],"created_at":"2024-10-12T20:12:33.161Z","updated_at":"2026-03-04T19:02:34.618Z","avatar_url":"https://github.com/laysauchoa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" .. raw:: html\n\n   \u003cp align=\"center\"\u003e\n      \u003ca href=\"https://aiven.io/blog/opensearch-dinner-party\"\u003e\n         \u003cimg src=\"https://github.com/laysauchoa/opensearch-python-dive-in/blob/main/images/opensearch-python.png\" width=\"60%\" alt=\"OpenSearch Python dive in\" /\u003e\n      \u003c/a\u003e\n   \u003c/p\u003e\n   \u003cp align=\"center\"\u003e\n   \u003c/p\u003e\n\nOpenSearch® with Python\n========================\n\nThis repository contains code examples related to `OpenSearch with Python queries \u003chttps://developer.aiven.io/docs/products/opensearch/howto/opensearch-search-and-python.html\u003e`_.\n\nQuickstart\n-----------\n\nTo run those examples, you need:\n\n* `Python 3.7+ \u003chttps://www.python.org/downloads/\u003e`_\n\n* An OpenSearch® cluster. It can be `set it up manually \u003chttps://opensearch.org/downloads.html\u003e`_ or you can use a fully managed service, such as `Aiven for OpenSearch® \u003chttps://aiven.io/opensearch\u003e`_\n\n* OpenSearch® cluster `Service URI`\n  \nRepository structure\n--------------------\nThis repository contains the following:\n\n..  code-block::\n\n    ├── CODE_OF_CONDUCT.md\n    ├── CONTRIBUTING.rst\n    ├── LICENSE\n    ├── README.rst\n    ├── __init__.py\n    ├── analyzer.py\n    ├── config.py\n    ├── helpers.py\n    ├── images\n    │   └── opensearch-python.png\n    ├── index.py\n    ├── recipes.json\n    ├── requirements.txt\n    └── search.py \n\n\n* `config.py \u003chttps://github.com/laysauchoa/opensearch-python-dive-in/blob/main/config.py\u003e`_, basic information to connect to the cluster\n* `index.py \u003chttps://github.com/laysauchoa/opensearch-python-dive-in/blob/main/index.py\u003e`_, contains methods that manipulate the index\n* `search.py \u003chttps://github.com/laysauchoa/opensearch-python-dive-in/blob/main/search.py\u003e`_, contains search queries methods\n* `helpers.py \u003chttps://github.com/laysauchoa/opensearch-python-dive-in/blob/main/helpers.py\u003e`_, response handler of search requests\n* `analyzer.py \u003chttps://github.com/laysauchoa/opensearch-python-dive-in/blob/main/analyzer.py\u003e`_, test built-in analyzers with user input\n\nDataset\n-------\nYou can download the `Kaggle recipe dataset \u003chttps://www.kaggle.com/hugodarwood/epirecipes?select=full_format_recipes.json\u003e`_, and save the file as ``recipes.json`` in this current folder.\n\nSearch queries\n---------------\n\nThe available search options can be found by using the `--help` command::\n\n    python search.py --help\n\nFind the arguments to be passed to a certain function by running::\n\n    python search.py OPTION --help\n\n\nOPTION can be:\n\n* `match \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/full-text/#match\u003e`_\n* `multi-match \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/full-text/#match\u003e`_\n* `match-phrase \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/full-text/#match-phrase\u003e`_\n* `fuzzy \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/full-text/#options\u003e`_\n* `term \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/term/#term\u003e`_\n* `range \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/term/#range\u003e`_\n* `combine \u003chttps://opensearch.org/docs/latest/opensearch/query-dsl/bool/\u003e`_\n\n\nTest an analyzer \n----------------\n\nOpenSearch comes with a set of built-in analyzers:\n\n- standard\n- simple\n- whitespace\n- stop\n- keyword\n- pattern\n- fingerprint\n- languages\n\nYou can use ``analyzer.py`` to test how an analyzer works. As a result, you will be able to see which tokens it generates.\n\nThe available analyzer options can be found by using the `--help` command::\n\n    python analyzer.py --help\n\nFind the arguments to be passed to a certain function by running::\n\n    python analyzer.py OPTION --help\n\nDependencies\n''''''''''''\n\nInstall all dependencies::\n\n    pip install -r requirements.txt\n\nService URI\n'''''''''''\n\nTo connect with your cluster, you need the **Service URI** of your OpenSearch cluster. You can find the connection details in the section **Overview** on `Aiven web console \u003chttps://console.aiven.io\u003e`_. Notice that ``service_uri`` contains credentials; therefore, should be treated with care. \n\nThis project uses ``dotenv`` `Python library \u003chttps://pypi.org/project/python-dotenv/\u003e`_ to manage the environment variables.\n\nReplace your ``SERVICE_URI`` on `.env` file with yours as string::\n\n    SERVICE_URI=\u003chttps://\u003cuser\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e\n\n\nLicense\n-------\n\n|License: CC BY 4.0|\n\nI created this repository to make OpenSearch® easy to use for Python developers.\nYou can use this work by following the CC-BY license. Please attribute it by mentioning “OpenSearch® and Python by @laysauchoa”.\n\nThis work is licensed under a `Creative Commons Attribution 4.0\nInternational License \u003chttps://creativecommons.org/licenses/by/4.0/\u003e`__.\n\n.. |License: CC BY 4.0| image:: https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg\n   :target: https://creativecommons.org/licenses/by/4.0/deed.de\n\nTrademarks\n----------\n\nOpenSearch® and Python are trademarks and property of their respective owners. All product and service names used in this website are for identification purposes only and do not imply endorsement.\n\nDo you have questions?\n----------------------\nFeel free to open an issue with your question on `Issues` or drop me a message at ``laysa.uchoa@gmail.com``.\n\n\nMore OpenSearch® resources\n--------------------------\n\n- `Migrate from Elasticsearch to OpenSearch client \u003chttps://aiven.io/blog/migrate-elasticsearch-client-to-opensearch\u003e`_.\n- `Write search queries with OpenSearch and Python \u003chttps://aiven.io/blog/opensearch-dinner-party\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysauchoa%2Fopensearch-python-dive-in","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaysauchoa%2Fopensearch-python-dive-in","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysauchoa%2Fopensearch-python-dive-in/lists"}