Scripts related to Elasticsearch and AppSearch.
- Setup a virtual environment.
python -m virtualenv venv
- Source your environment.
source ./venv/bin/activate
- Install the requirements.
pip install -r requirements.txt
- View the help!
python ./src/csv-to-elasticsearch.py -h
This script lets you upload a large CSV to Elasticsearch. Every row represents a new document to be indexed. Currently, Elasticsearch's default tokenizer is used to prep the documents.
Flag | Description | Required |
---|---|---|
-i | The index to write documents to | ✔️ |
-c | The Elasticsearch host string. Ex. '-c localhost:9200,localhost:9201,localhost:9202' | ✔️ |
-f | The CSV file. | ✔️ |
-h | Print the CLI help text. | ✖️ |
-u | The user to connect to Elasticsearch as. | ✖️ |
-p | The user's password. | ✖️ |
python src/csv-to-elasticsearch.py -i my_index -c https://textdepot.edmonton.ca/elasticsearch -f ~/Downloads/a_csv.csv -u es_user -p a_really_good_pw