mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-03 23:20:35 +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.
20 lines
550 B
Bash
20 lines
550 B
Bash
#!/usr/bin/env bash
|
|
|
|
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
|
|
|
|
unstructured-ingest \
|
|
local \
|
|
--input-path example-docs/book-war-and-peace-1225p.txt \
|
|
--output-dir local-output-to-elasticsearch \
|
|
--strategy fast \
|
|
--chunk-elements \
|
|
--embedding-provider "$EMBEDDING_PROVIDER" \
|
|
--num-processes 4 \
|
|
--verbose \
|
|
elasticsearch \
|
|
--hosts "$ELASTICSEARCH_HOSTS" \
|
|
--username "$ELASTICSEARCH_USERNAME" \
|
|
--password "$ELASTICSEARCH_PASSWORD" \
|
|
--index-name "$ELASTICSEARCH_INDEX_NAME" \
|
|
--num-processes 2
|