CLI Overview¶
onesearch-cli is a standalone command-line client for a running OneSearch server. It talks to the same backend API as the web UI, so both interfaces share the same sources, indexes, auth, and search results. Tagged OneSearch releases publish the Docker image and the CLI package on the same shared version.
Why Use the CLI¶
Automation: Script indexing and searches in cron jobs or CI/CD pipelines.
Remote management: Control OneSearch from any machine that can reach the API.
JSON output: Parse results programmatically with --json.
Fast admin workflow: Search, inspect status, and manage sources without opening the browser.
Installation¶
Install the standalone CLI with pipx:
You still need a running OneSearch backend somewhere on your network. See the CLI Installation Guide for details.
Quick Start¶
Point the CLI at your server, then log in:
Basic commands:
Docker fallback¶
If you don't want to install the standalone CLI yet, the Docker image still includes it:
That works fine for debugging, but the standalone CLI is the preferred path.
Commands¶
Source Management¶
# List all sources
onesearch source list
# Add a new source
onesearch source add NAME PATH [OPTIONS]
# Show source details
onesearch source show SOURCE_ID
# Delete a source
onesearch source delete SOURCE_ID
# Trigger reindex (incremental by default)
onesearch source reindex SOURCE_ID
# Full reindex
onesearch source reindex SOURCE_ID --full
Searching¶
# Basic search
onesearch search QUERY
# Filter by source
onesearch search QUERY --source documents
# Filter by file type
onesearch search QUERY --type pdf
# Limit results
onesearch search QUERY --limit 20
# JSON output for scripting
onesearch search QUERY --json
Monitoring¶
# Overall status
onesearch status
# Source-specific status
onesearch status SOURCE_ID
# Health check
onesearch health
Configuration¶
# Show config
onesearch config show
# Get specific value
onesearch config get backend_url
# Set value
onesearch config set backend_url http://localhost:8000
# Show config path
onesearch config path
Global Options¶
These work with any command:
Examples:
# Quiet mode
onesearch search "docker" --quiet
# JSON for scripting
onesearch source list --json | jq '.[] | .name'
# Custom URL
onesearch --url http://nas.local:8000 status
Output Formats¶
Table (Default)¶
┌──────────┬────────────┬───────────┬──────────┐
│ ID │ Name │ Path │ Files │
├──────────┼────────────┼───────────┼──────────┤
│ docs │ Documents │ /data/docs│ 1,234 │
└──────────┴────────────┴───────────┴──────────┘
JSON¶
Configuration¶
The CLI stores config in a platform-specific location:
- Linux/macOS:
~/.config/onesearch/config.yml - Windows:
%APPDATA%\onesearch\config.yml
Example config:
You can override with ONESEARCH_URL and ONESEARCH_TOKEN.
See the Configuration Guide for details.
Scripting Examples¶
Automated Reindexing¶
#!/bin/bash
# Reindex all sources nightly
for source in $(onesearch source list --json | jq -r '.[].id'); do
echo "Reindexing $source..."
onesearch source reindex "$source"
done
Search and Process¶
#!/bin/bash
# Find PDFs mentioning "invoice" and copy them
onesearch search "invoice" --type pdf --json | \
jq -r '.[].path' | \
xargs -I {} cp {} /backup/invoices/
Health Monitoring¶
#!/bin/bash
# Alert if OneSearch is down
if ! onesearch health --quiet; then
echo "OneSearch is down!" | mail -s "Alert" admin@example.com
fi
See the Examples & Workflows page for more scripts.
Next Steps¶
- Installation Guide - Set up the CLI
- Configuration - Configure the CLI
- Command Reference - Full command docs
- Examples & Workflows - Real-world scripts
Getting Help¶
Or check the Troubleshooting Guide.