The following WP-CLI commands are supported by ElasticPress:
-
wp elasticpress sync [--network-wide] [--setup] [--force] [--per-page=<per_page_number>] [--nobulk] [--static-bulk] [--show-errors] [--show-bulk-errors] [--show-nobulk-errors] [--stop-on-error] [--offset=<offset_number>] [--indexables=<indexables>] [--post-type=<post_types>] [--include=<IDs>] [--post-ids=<IDs>] [--upper-limit-object-id=<ID>] [--lower-limit-object-id=<ID>] [--ep-host=<host>] [--ep-prefix=<prefix>] [--yes]
Index all posts for a site or network wide.
[--network-wide]
: Force indexing on all the blogs in the network.--network-wide
takes an optional argument to limit the number of blogs to be indexed across where 0 is no limit. For example,--network-wide=5
would limit indexing to only 5 blogs on the network[--setup]
: Clear the index first and re-send the put mapping. Use--yes
to skip the confirmation[--force]
: Stop any ongoing sync[--per-page=<per_page_number>]
: Determine the amount of posts to be indexed per bulk index (or cycle)[--nobulk]
: Disable bulk indexing[--static-bulk]
: Do not use dynamic bulk requests, i.e., send only one request per batch of documents.[--show-errors]
: Show all errors[--show-bulk-errors]
: Display the error message returned from Elasticsearch when a post fails to index using the /_bulk endpoint[--show-nobulk-errors]
: Display the error message returned from Elasticsearch when a post fails to index while not using the /_bulk endpoint[--stop-on-error]
: Stop indexing if an error is encountered and display the error.[--offset=<offset_number>]
: Skip the first n posts (don't forget to remove the--setup
flag when resuming or the index will be emptied before starting again).[--indexables=<indexables>]
: Specify the Indexable(s) which will be indexed[--post-type=<post_types>]
: Specify which post types will be indexed (by default: all indexable post types are indexed). For example,--post-type="my_custom_post_type"
would limit indexing to only posts from the post type "my_custom_post_type". Accepts multiple post types separated by comma[--include=<IDs>]
: Choose which object IDs to include in the index[--post-ids=<IDs>]
: Choose which post_ids to include when indexing the Posts Indexable (deprecated)[--upper-limit-object-id=<ID>]
: Upper limit of a range of IDs to be indexed. If indexing IDs from 30 to 45, this should be 45[--lower-limit-object-id=<ID>]
: Lower limit of a range of IDs to be indexed. If indexing IDs from 30 to 45, this should be 30[--ep-host=<host>]
: Custom Elasticsearch host[--ep-prefix=<prefix>]
: Custom ElasticPress prefix[--yes]
: Skip confirmation needed by--setup
-
wp elasticpress activate-feature <feature-slug>
Activate a feature. If a re-indexing is required, you will need to do it manually.
<feature-slug>
: The feature slug
-
wp elasticpress deactivate-feature <feature-slug>
Deactivate a feature.
<feature-slug>
: The feature slug
-
wp elasticpress list-features [--all]
List features (either active or all).
[--all]
: Show all registered features
-
wp elasticpress get-algorithm-version
Get the algorithm version.
Get the value of the
ep_search_algorithm_version
option, ordefault
if empty. -
wp elasticpress set-algorithm-version [--version=<version>] [--default]
Set the algorithm version.
Set the algorithm version through the
ep_search_algorithm_version
option, that will be used by the filter with same name. Delete the option if--default
is passed.[--version=<version>]
: Version name[--default]
: Use to set the default version
-
wp elasticpress clear-sync
Clear a sync/index process.
If an index was stopped prematurely and won't start again, this will clear this cached data such that a new index can start.
-
wp elasticpress delete-index [--index-name=<index_name>] [--network-wide] [--yes]
Delete the index for each indexable. !!Warning!! This removes your elasticsearch index(s) for the entire site.
[--index-name=<index_name>]
: The name of the index to be deleted. If not passed, all indexes will be deleted[--network-wide]
: Force every index on the network to be deleted.--network-wide
takes an optional argument to limit the number of indices to be deleted where 0 is no limit. For example,--network-wide=5
would limit to only 5 indices on the network to be deleted.[--yes]
: Skip confirmation
-
wp elasticpress delete-search-template
Deletes the Instant Results search template.
-
wp elasticpress epio-set-autosuggest
A WP-CLI wrapper to run
Autosuggest::epio_send_autosuggest_public_request()
. -
wp elasticpress get <indexable> <ID> [--debug-http-request] [--pretty]
Get a specific content in Elasticsearch
<indexable>
: Indexable slug. Example:post
<ID>
: Content ID[--debug-http-request]
: Enable debugging[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-cluster-indices [--pretty]
Return all indices from the cluster as a JSON object.
[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-index-settings <index_name> [--pretty]
Get an index settings
<index_name>
: Index name[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-indices [--pretty] [--status=<status>]
Return all index names as a JSON object.
[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.[--status=<status>]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-last-cli-sync [--clear] [--pretty]
Returns a JSON array with the results of the last CLI sync (if present) or an empty array.
[--clear]
: Clear theep_last_cli_index
option.[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-last-sync [--pretty]
Returns a JSON array with the results of the last index (if present) or an empty array.
[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-mapping [--index-name=<index_name>] [--pretty]
Return the mapping as a JSON object. If an index is specified, return its mapping only.
[--index-name=<index_name>]
: The name of the index for which to return the mapping. If not passed, all mappings will be returned[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-ongoing-sync-status [--pretty]
Returns the status of an ongoing index operation in JSON array.
Returns the status of an ongoing index operation in JSON array with the following fields: indexing | boolean | True if index operation is ongoing or false method | string | 'cli', 'web' or 'none' items_indexed | integer | Total number of items indexed total_items | integer | Total number of items indexed or -1 if not yet determined
[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress get-search-template [--pretty]
Gets the Instant Results search template.
[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress put-mapping [--network-wide] [--indexables=<indexables>] [--ep-host=<host>] [--ep-prefix=<prefix>]
Add document mappings for every indexable.
Sends plugin put mapping to the current Indexables indices (this will delete the indices.)
[--network-wide]
: Force mappings to be sent for every index in the network.--network-wide
takes an optional argument to limit the number of mappings to be sent where 0 is no limit. For example,--network-wide=5
would send mappings for only 5 blogs on the network.[--indexables=<indexables>]
: List of indexables[--ep-host=<host>]
: Custom Elasticsearch host[--ep-prefix=<prefix>]
: Custom ElasticPress prefix
-
wp elasticpress put-search-template
Saves the Instant Results search template to EPIO.
-
wp elasticpress recreate-network-alias
Recreates the alias index which points to every index in the network.
Map network alias to every index in the network for every non-global indexable
-
wp elasticpress request <path> [--method=<method>] [--body=<json-body>] [--debug-http-request] [--pretty]
Send a HTTP request to Elasticsearch
<path>
: Path of the request. Example:_cat/indices
[--method=<method>]
: HTTP Method (GET, POST, etc.)[--body=<json-body>]
: Request body[--debug-http-request]
: Enable debugging[--pretty]
: Use this flag to render a pretty-printed version of the JSON response.
-
wp elasticpress settings-reset [--yes]
Reset all ElasticPress settings stored in WP options and transients.
This command will not delete any index or content stored in Elasticsearch but will force users to go through the installation process again.
[--yes]
: Skip confirmation
-
wp elasticpress stats
Get stats on the current index.
-
wp elasticpress status
Ping the Elasticsearch server and retrieve a status.
-
wp elasticpress stop-sync
Stop the Sync operation started from the dashboard.