Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/konard/elastic-search
https://github.com/konard/elastic-search
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/konard/elastic-search
- Owner: Konard
- License: unlicense
- Created: 2024-01-04T10:49:57.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-22T00:17:10.000Z (8 months ago)
- Last Synced: 2024-10-10T13:36:00.966Z (28 days ago)
- Language: Python
- Size: 131 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Gitpod](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/konard/elastic-search)
# elastic-search
Model used in vector_search: https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
A script in Python that loads strings to Elasticsearch Docker container and then allow user to search from CLI. Make sure Docker and python are installed on your machine.
## Install and start the Elasticsearch Docker container
```bash
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.13.1 --restart=always
```## Install dependencies
```bash
pip install click 'elasticsearch<7.14.0'
pip install -U sentence-transformers
```## Create index
```bash
python vector_search.py create
python combined_search.py create
```## Index specific string
```bash
python search.py index --string "dog"
python vector_search.py index --string "dog"
python combined_search.py index --string "dog"
```## Index documents array from json
```bash
python vector_search.py index_documents --path "articles-filtered-and-truncated.json"
python combined_search.py index_documents --path "articles-filtered-and-truncated.json"
```## Search specific string
```bash
python search.py search --query "dog"
python vector_search.py search --query "dog"
python combined_search.py search --query "dog"
```## Clear elastic search index
```bash
curl -X DELETE 'http://localhost:9200/_all'
```