2023-07-01 18:45:28 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Runs a docker container to create an elasticsearch cluster,
|
|
|
|
# fills the ES cluster with data,
|
|
|
|
# processes all the files in the 'movies' index in the cluster using the `unstructured` library.
|
|
|
|
|
|
|
|
# Structured outputs are stored in elasticsearch-ingest-output
|
|
|
|
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
sh scripts/elasticsearch-test-helpers/create-and-check-es.sh
|
|
|
|
wait
|
|
|
|
|
|
|
|
# Kill the container so the script can be repeatedly run using the same ports
|
|
|
|
trap 'echo "Stopping Elasticsearch Docker container"; docker stop es-test' EXIT
|
|
|
|
|
|
|
|
PYTHONPATH=. ./unstructured/ingest/main.py \
|
2023-07-31 13:20:10 -04:00
|
|
|
elasticsearch \
|
2023-07-01 18:45:28 +01:00
|
|
|
--metadata-exclude filename,file_directory,metadata.data_source.date_processed \
|
2023-07-31 13:20:10 -04:00
|
|
|
--url http://localhost:9200 \
|
|
|
|
--index-name movies \
|
2023-07-01 18:45:28 +01:00
|
|
|
--jq-query '{ethnicity, director, plot}' \
|
2023-09-11 11:40:56 -04:00
|
|
|
--output-dir elasticsearch-ingest-output \
|
2023-07-01 18:45:28 +01:00
|
|
|
--num-processes 2
|