> For the complete documentation index, see [llms.txt](https://icij.gitbook.io/datashare/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icij.gitbook.io/datashare/server-mode/add-documents-from-the-cli.md).

# Add documents from the CLI

**This document assumes that you have installed Datashare** [**in server mode within Docker**](/datashare/server-mode/install-with-docker.md)**.**

In server [mode](/datashare/concepts/running-modes.md), 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:

```bash
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](/datashare/concepts/cli-stages.md) 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-project` index in Elasticsearch.

Once the command exits, your documents are searchable.

{% hint style="warning" %}
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](/datashare/server-mode/indexing.md).
{% endhint %}

## Next steps

* [Indexing](/datashare/server-mode/indexing.md): the full guide to indexing on a server.
  * [Scenarios](/datashare/server-mode/indexing/scenarios.md): incremental updates, resuming, distributing across machines, mail archives.
  * [Options](/datashare/server-mode/indexing/options.md): every command-line flag, environment variable and settings key.
  * [Tuning](/datashare/server-mode/indexing/tuning.md): parallelism, OCR, memory and Elasticsearch.
  * [Troubleshooting](/datashare/server-mode/indexing/troubleshooting.md): what the errors mean.
* [Add entities from the CLI](/datashare/server-mode/add-entities-from-the-cli.md): extract people, organizations and locations from documents you have indexed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://icij.gitbook.io/datashare/server-mode/add-documents-from-the-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
