diff --git a/docs/commands/index.md b/docs/commands/index.md new file mode 100644 index 00000000..5223cc92 --- /dev/null +++ b/docs/commands/index.md @@ -0,0 +1,52 @@ +# Index Command + +The `index` management command is used to index documents to the remote search indexer. + +It sends an asynchronous task to the Celery worker. + +## Usage + +### Command Line + +```bash +python manage.py index \ + --lower-time-bound "2024-01-01T00:00:00" \ + --upper-time-bound "2024-01-31T23:59:59" \ + --batch-size 200 \ + --crash-safe-mode false +``` + +### Django Admin + +The command is available in the Django admin interface: + +1. Go to `/admin/` +2. Click on **"Run Indexing"** in the CORE section +3. Fill in the form with the desired parameters +4. Click **"Run Indexing Command"** + +## Parameters + +### `--batch-size` +- **type:** Integer +- **default:** `50` +- **description:** Number of documents to process per batch. Higher values may improve performance but use more memory. + +### `--lower-time-bound` +- **optional**: true +- **type:** ISO 8601 datetime string +- **default:** `None` +- **description:** Only documents updated after this date will be indexed. + +### `--upper-time-bound` (optional) +- **optional**: true +- **type:** ISO 8601 datetime string +- **default:** `None` +- **description:** Only documents updated before this date will be indexed. + +### `--crash-safe-mode` +- **type:** Boolean flag +- **default:** `True` +- **description:** When enabled, the command orders documents by `updated_at` and stores the last indexed document's timestamp in cache. This allows resuming indexing from the last successful batch in case of a crash. However, it is more computationally expensive due to sorting.b + +