mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-06-27 02:30:08 +00:00

Closes https://github.com/Unstructured-IO/unstructured/issues/1842
Closes https://github.com/Unstructured-IO/unstructured/issues/2202
Closes https://github.com/Unstructured-IO/unstructured/issues/2203
This PR:
- Adds Elasticsearch destination connector to be able to ingest
documents from any supported source, embed them and write the embeddings
/ documents into Elasticsearch.
- Defines an example unstructured elements schema for users to be able
to setup their unstructured elasticsearch indexes easily.
- Includes parallelized upload and lazy processing for elasticsearch
destination connector.
- Rearranges elasticsearch test helpers to source, destination, and
common folders.
- Adds util functions to be able to batch iterables in a lazy way for
uploads
- Fixes a bug where removing the optional parameter `--fields` broke the
connector due to an integer processing error.
- Fixes a bug where using an [elasticsearch
config](8fa5cbf036/unstructured/ingest/connector/elasticsearch.py (L26-L35)
)
for a destination connector resulted in a serialization issue when
optional parameter `--fields` was not provided.
31 lines
1.5 KiB
Bash
Executable File
31 lines
1.5 KiB
Bash
Executable File
#!/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/source_connector/create-fill-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 \
|
|
elasticsearch \
|
|
--hosts "<List of URLs where elasticsearch index is served>" \
|
|
--index-name "<Index name to ingest data from>" \
|
|
--username "<Username to authenticate into the index>" \
|
|
--password "<Password to authenticate into the index>" \
|
|
--fields "<If provided, will limit the fields returned by Elasticsearch to this comma-delimited list" \
|
|
--batch-size "<How many records to read at a time per process>" \
|
|
--num-processes "<Number of processes to be used to upload, ie. 2>" \
|
|
--cloud-id "<Id used to connect to Elastic Cloud>" \
|
|
--es-api-key "<Api key used for authentication>" \
|
|
--api-key-id "<Id associated with api key used for authentication: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html>" \
|
|
--bearer-auth "<Bearer token used for HTTP bearer authentication>" \
|
|
--ca-certs "<path/to/ca/certs>" \
|
|
--ssl-assert-fingerprint "<SHA256 fingerprint value>"
|