Skip to content

Enterprise Search

Enable Enterprise Search features

Several features built into Enterprise Search can be enabled with the activate-feature command using VIP-CLI.

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

To disable a feature, use the deactivate-feature command:

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

VIP-CLI command examples

For demonstration purposes, the <app-alias> value mytestsite 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.

Caution

If the search feature is de-activated, search will not be offloaded to Enterprise Search.

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. (Keep in mind, this may result in poor performance).

Protected content

Caution

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

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.

Feature slug: related_posts
Default: Disabled

This feature enables the helper function vip_es_get_related_posts which returns related posts on a post ID.

Search ordering

Feature slug: searchordering
Default: Disabled

This feature allows for the customization of search results returned on terms.

Terms

Feature slug: terms
Default: Disabled

Activating this feature enables the terms Indexable.

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

$ vip @mytestsite.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.

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

$ vip @mytestsite.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!

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.

Last updated: May 06, 2022