WP-CLI Reference

CelerSearch registers four commands under the wp celersearch namespace when WP-CLI is available: reindex, index, service, and settings. They cover the day-to-day operations you would otherwise perform in the admin dashboard — rebuilding indices, inspecting services, and moving configuration between sites as portable JSON envelopes.

All commands run after WordPress is fully loaded, so they respect your active plugins, filters, and index configuration.

Shell
wp celersearch reindex --all
wp celersearch index list
wp celersearch service test 1
wp celersearch settings export --output=/tmp/settings.json

celersearch reindex

Reindex one or all CelerSearch indices.

Shell
wp celersearch reindex [<index>] [--all] [--clear] [--batch=<number>] [--from=<number>] [--dry-run]

Options

OptionDescription
<index>Index ID or slug to reindex. Numeric values are tried as an ID first, then as a slug.
--allReindex all indices. Cannot be combined with <index>.
--clearClear the index before reindexing. Only applies when starting from batch 1 — skipped when resuming with --from.
--batch=<number>Batch size override. Without it the batch size comes from the celersearch_indexable_items_batch_size filter (default: 15).
--from=<number>Resume from the given batch number (default: 1).
--dry-runShow item, batch size, and batch counts without executing.

Either <index> or --all is required. For each index the command logs the total items, batch size, and batch count, then indexes batch by batch with a progress bar. A failed batch logs a warning and processing continues with the next batch.

Examples

Shell
# Reindex index with ID 1
wp celersearch reindex 1

# Reindex index by slug
wp celersearch reindex posts-news

# Reindex all indices
wp celersearch reindex --all

# Clear and reindex all indices
wp celersearch reindex --all --clear

# Resume from batch 5 (does not clear, even with --clear)
wp celersearch reindex 1 --from=5

# Use a larger batch size
wp celersearch reindex 1 --batch=50

# Preview without executing
wp celersearch reindex --all --dry-run

celersearch index

Manage CelerSearch indices.

index list

List all indices.

Shell
wp celersearch index list [--format=<format>]
OptionDescription
--format=<format>Output format: table (default), csv, json, yaml.

Columns: ID, Name, Slug, Type, Local (indexable items in WordPress), Remote (documents on the search engine), Status. Local/Remote show - when the index or its service cannot be reached.

Shell
# List all indices
wp celersearch index list

# Output as JSON
wp celersearch index list --format=json

index info

Show detailed information about a single index.

Shell
wp celersearch index info <index> [--format=<format>]
OptionDescription
<index>Index ID or slug.
--format=<format>Output format: table (default), json, yaml.

Reports the index ID, name, slug, type, service ID, status, synced/checked timestamps, plus live counts: local items, batch size, total batches, and the remote document count (or the error message if the remote count fails).

Shell
# Show info for index ID 1
wp celersearch index info 1

# Show info for index by slug
wp celersearch index info posts-news

index clear

Delete all documents from an index without deleting the index itself.

Shell
wp celersearch index clear <index> [--yes]
OptionDescription
<index>Index ID or slug.
--yesSkip the confirmation prompt.
Shell
# Clear index ID 1 (asks for confirmation)
wp celersearch index clear 1

# Clear without confirmation
wp celersearch index clear 1 --yes

index export

Export an index as a portable JSON envelope (see Moving configuration between sites).

Shell
wp celersearch index export <index> [--output=<path>]
OptionDescription
<index>Index ID or slug.
--output=<path>Write JSON to this file instead of stdout.

The envelope carries the index name, type, slug, and config. The linked service is referenced by name + provider (not by ID), and any pinned searches attached to the index travel with it.

Shell
# Print envelope to stdout
wp celersearch index export 1

# Write envelope to a file
wp celersearch index export posts-news --output=/tmp/posts.json

index import

Import an index from a portable JSON envelope.

Shell
wp celersearch index import <file>
OptionDescription
<file>Path to a CelerSearch index export file.

Always creates a new record — slug collisions are resolved by appending -1, -2, and so on. The service reference is resolved by matching name + provider against the services on this site; if no match is found, a warning tells you to assign a service before using the index. Pinned searches in the envelope are recreated against the new index — rebuild the index so their documents resolve.

Shell
wp celersearch index import /tmp/posts.json

celersearch service

Manage CelerSearch services (search engine connections).

service list

List all services.

Shell
wp celersearch service list [--format=<format>]
OptionDescription
--format=<format>Output format: table (default), csv, json, yaml.

Columns: ID, Name, Provider, URL, Status, Checked At. API keys are not included in the output.

Shell
# List all services
wp celersearch service list

# Output as JSON
wp celersearch service list --format=json

service test

Test the connection to a service.

Shell
wp celersearch service test <service> [--verbose]
OptionDescription
<service>Service ID.
--verboseShow detailed response information (URL, health status, engine version, commit info).

For Meilisearch services the command checks the engine's health and version endpoints. On success the service status is updated to connected; on failure it is marked failing. Either way checked_at is refreshed, and the response time is reported in milliseconds.

Shell
# Test service connection
wp celersearch service test 1

# Test with verbose output
wp celersearch service test 1 --verbose

service export

Export a service as a portable JSON envelope.

Shell
wp celersearch service export <service> [--include-secrets] [--output=<path>]
OptionDescription
<service>Service ID or name.
--include-secretsEmbed credentials (API key, etc.) in the export. Off by default.
--output=<path>Write JSON to this file instead of stdout.

Without --include-secrets, credential-like fields in the service config (keys, secrets, tokens, passwords) are replaced with a __REDACTED__ marker. Redacted fields are dropped on import, so the imported service has empty credentials until you edit it.

Shell
# Print envelope (secrets redacted) to stdout
wp celersearch service export 1

# Include API key and write to file
wp celersearch service export LocalMeili --include-secrets --output=/tmp/svc.json

service import

Import a service from a portable JSON envelope.

Shell
wp celersearch service import <file>
OptionDescription
<file>Path to a CelerSearch service export file.

Always creates a new record — name collisions get a (1), (2), … suffix. The imported service starts with status pending and a reset failure count; test the connection before relying on it. If the export was created without --include-secrets, a warning reminds you to edit the service and add an API key before use.

Shell
wp celersearch service import /tmp/svc.json

celersearch settings

Manage the plugin settings (celersearch_settings option).

settings export

Export the settings as a portable JSON envelope.

Shell
wp celersearch settings export [--output=<path>]
OptionDescription
--output=<path>Write JSON to this file instead of stdout.

Index references (the default index and each search area's index) are rewritten from local IDs to slugs, so the export survives a cross-site move.

Shell
# Print envelope to stdout
wp celersearch settings export

# Write envelope to a file
wp celersearch settings export --output=/tmp/settings.json

settings import

Import settings from a portable JSON envelope.

Shell
wp celersearch settings import <file> [--yes]
OptionDescription
<file>Path to a CelerSearch settings export file.
--yesSkip the overwrite confirmation prompt.

This overwrites the celersearch_settings option on the current site, so it asks for confirmation unless --yes is passed. Index slugs are resolved back to local IDs. Any reference that cannot be resolved (the index does not exist on this site) is reported as a warning, and a search area pointing at a missing index is imported disabled so it cannot silently break search.

Shell
# Interactive (asks before overwriting)
wp celersearch settings import /tmp/settings.json

# Non-interactive (e.g. CI / restore script)
wp celersearch settings import /tmp/settings.json --yes

Moving configuration between sites

The export/import subcommands were introduced alongside the portable envelope feature and are the CLI counterpart of the Import/Export actions in the admin dashboard — both produce and consume the same files, so you can export from the UI and import via WP-CLI or vice versa.

Every export is a self-describing JSON envelope:

JSON
{
  "format": "celersearch-export",
  "schema_version": 1,
  "type": "index",
  "exported_at": "2026-07-09T10:00:00+00:00",
  "plugin_version": "1.4.0",
  "secrets_included": false,
  "data": { ... }
}

Imports validate the format and type fields, so you cannot accidentally feed a service export to index import.

The envelopes contain no site-local IDs in their cross-record references. Instead:

  • An index export references its service by name + provider. On import, CelerSearch looks for a service with the same name and provider on the target site and relinks automatically.
  • A settings export references indices by slug. On import, slugs are resolved back to the target site's index IDs. Search areas whose index slug cannot be resolved are imported disabled, with a warning listing each unresolved reference.

This makes the import order matter. To migrate a full configuration from site A to site B:

Shell
# On the source site — services first, then indices, then settings
wp celersearch service export LocalMeili --include-secrets --output=svc.json
wp celersearch index export posts-news --output=index.json
wp celersearch settings export --output=settings.json

# On the target site — import in the same order
wp celersearch service import svc.json
wp celersearch index import index.json
wp celersearch settings import settings.json --yes

# Finally, populate the new indices with documents
wp celersearch reindex --all --clear

Notes:

  • Secrets: API keys are only included when you pass --include-secrets to service export. Without it, credential fields are redacted and dropped on import — edit the imported service and enter its credentials before testing or indexing. Treat files exported with --include-secrets as sensitive.
  • New records, never overwrites: index import and service import always create new records. Slug collisions get -1, -2, … suffixes; service name collisions get (1), (2), … suffixes. Only settings import overwrites (the single settings option), which is why it prompts for confirmation.
  • Reindex to finish: imported indices start with status pending and contain no documents — and imported pinned searches only resolve once the same content is indexed. Always finish a migration with wp celersearch reindex --all --clear.