Add documents from the CLI
The shortest path from an empty project to searchable documents on a server install.
This document assumes that you have installed Datashare in server mode within Docker.
In server mode, Datashare has no web interface to add documents. Documents are added from the command line.
Here is the shortest command that scans a directory and indexes its files:
docker compose exec datashare /entrypoint.sh \
stage run \
--stages SCAN,INDEX \
--defaultProject secret-project \
--elasticsearchAddress http://elasticsearch:9200 \
--dataDir /home/datashare/Datashare/What is happening:
Datashare runs the SCAN and INDEX stages together, SCAN filling a queue with the files it finds and INDEX draining it.
Files are read from
/home/datashare/Datashare/, which is a directory mounted from the host machine, so this is the path inside the container.Extracted documents are written to the
secret-projectindex in Elasticsearch.
Once the command exits, your documents are searchable.
That command is fine for a first try on a small directory. For a real corpus, add at least --reportName (so the run can resume) and --queueType REDIS (so the queue survives the process), and decide whether you want OCR. All of that is covered in Indexing.
Next steps
Indexing: the full guide to indexing on a server.
Scenarios: incremental updates, resuming, distributing across machines, mail archives.
Options: every command-line flag, environment variable and settings key.
Tuning: parallelism, OCR, memory and Elasticsearch.
Troubleshooting: what the errors mean.
Add entities from the CLI: extract people, organizations and locations from documents you have indexed.
Last updated