Skip to content

Enable Enterprise Search features

Several features built into Enterprise Search can be enabled with the command wp vip-search activate-feature. Run the command with VIP-CLI, for example:

vip @<app-name>.<env> -- wp vip-search activate-feature <feature-slug>

To disable a feature, use the command wp vip-search deactivate-feature:

vip @<app-name>.<env> -- wp vip-search deactivate-feature <feature-slug>

Retrieve a list of the features that are currently enabled for a site with the command wp vip-search list-features:

vip @<app-name>.<env> -- wp vip-search list-features

Retrieve a list of all available features by passing the --all option with the command wp vip-search list-features:

vip @<app-name>.<env> -- wp vip-search list-features --all

Limitations

ElasticPress features that cannot be enabled for Enterprise Search:

  • Autosuggest
  • Comments
  • Documents
  • Instant Search

For WordPress multisite environments, features cannot be toggled on a global network basis. Enterprise Search features must be enabled or disabled on a per-network site basis by using the --url parameter. For example, if a multisite has two network sites—ID 1 and ID 2—and the protected_content feature is enabled only for site ID 1, it will not be enabled for site ID 2.

VIP-CLI command examples

For demonstration purposes, the <app-name> value example-app and the <env> value develop are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.

Facets

Feature slug: facets
Default: Enabled

When enabled, the Facets feature adds an ElasticPress Facets widget to the list of available widgets in the WordPress Admin. The Facets widget displays term aggregations in a sidebar or any widgetized area. The taxonomies included in aggregations must be code configured.

Example command to deactivate the facets feature:

vip @example-app.develop -- wp vip-search deactivate-feature facets

Protected content

Feature slug: protected_content
Default: Disabled

To enable indexing of non-public content (private post types and statuses) and send all non-AJAX WordPress admin queries to Elasticsearch, this feature must be activated. Once activated, a re-index (or versioning) will be necessary.

Caution

Once enabled, there is a risk of exposing non-public content to unauthorized users. Test all queries carefully.

Example command to activate the protected_content feature:

vip @example-app.develop -- wp vip-search activate-feature protected_content

Feature slug: related_posts
Default: Disabled

The vip_es_get_related_posts helper function returns related posts on a post ID. By default, the related posts feature will not function for custom post types, even if the custom post type is indexed. It is possible to return related posts for custom post types via custom code.

Example command to activate the related_posts feature:

vip @example-app.develop -- wp vip-search activate-feature related_posts

Feature slug: search
Default: Enabled

Queries with an s parameter will be automatically sent to Elasticsearch and searched against post_titlepost_content, and post_excerpt. This is highly beneficial because the default MySQL behavior, fulltext search with LIKE clauses, can result in poor database performance.

To prevent this behavior and force the query to go to MySQL, set both the es and ep_integrate WP_Query parameters to false.

Caution

If the search feature is deactivated, search will not be offloaded to Enterprise Search. Deactivating search is not recommended and can result in negative impact to a site’s performance.

Example command to deactivate the search feature:

vip @example-app.develop -- wp vip-search deactivate-feature search

Search ordering

Feature slug: searchordering
Default: Disabled

This feature allows for the customization of results returned on search terms, where results can be manually added or re-ordered. After this feature is enabled, custom search results can be configured in the site’s WordPress Admin dashboard. Access the customization panel by selecting Enterprise Search > Custom Results in the lefthand navigation menu.

Example command to activate the searchordering feature:

vip @example-app.develop -- wp vip-search activate-feature searchordering

Terms

Feature slug: terms
Default: Disabled

Activating this feature enables the terms Indexable.

Example command to activate the terms feature:

vip @example-app.develop -- wp vip-search activate-feature terms

After the terms feature is activated, enable the mapping (via the --setup flag) and index just the terms:

$ vip @example-app.develop -- wp vip-search index --indexables=term --setup                                                               
⚠️  You are about to run a destructive operation. Are you sure? [y/n] y
Indexing with setup option needs to delete Elasticsearch index first, are you sure you want to delete your Elasticsearch index? [y/n] y
Adding term mapping...
Success: Mapping sent
Indexing terms...
Processed 1/1. Last Object ID: 1
Number of terms indexed: 1
Total time elapsed: 0.504
Success: Done!

Users

Feature slug: users
Default: Disabled

Activating this feature enables the users Indexable.

Example command to activate the users feature:

vip @example-app.develop -- wp vip-search activate-feature users

After the users feature is activated, enable the mapping (via the --setup flag) and index just the users:

$ vip @example-app.develop -- wp vip-search index --indexables="user" --setup
⚠️  You are about to run a destructive operation. Are you sure? [y/n] y
Indexing with setup option needs to delete Elasticsearch index first, are you sure you want to delete your Elasticsearch index? [y/n] y
Adding user mapping...
Success: Mapping sent
Indexing users...
Processed 1/1. Last Object ID: 1
Number of users indexed: 1
Total time elapsed: 0.170
Success: Done!

WooCommerce

Feature slug: woocommerce
Default: Disabled

When enabled, the WooCommerce feature will run all critical WooCommerce queries through Elasticsearch instead of MySQL making it possible to render pages and process complex ecommerce filters very fast.

Example command to activate the woocommerce feature:

vip @example-app.develop -- wp vip-search activate-feature woocommerce

Last updated: August 08, 2024

Relevant to

  • WordPress