Enable Enterprise Search in order to have Elasticsearch (ES) index a site’s content and offload standard search queries.
- Add two constants to
vip-config.phpand define both as
VIP_ENABLE_VIP_SEARCH: Enables Enterprise Search
VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION: Integrates search queries with Enterprise Search
define( 'VIP_ENABLE_VIP_SEARCH', true ); // Enables Enterprise Search
define( 'VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION', true ); // Integrates search queries with Enterprise Search
- After code-enabling Enterprise Search, indexing is required.
- The first time Enterprise Search is indexed, use the
--setupcommand option. Re-indexing should be performed with versioning to ensure proper mapping.
- Setting up indexes for all network sites on a WordPress multisite at the same time is recommended.
Test offloading of search queries
Testing and verifying the offloading of search queries to Enterprise Search is useful when in the process of migrating to Enterprise Search and at any time verifying that integration is working as intended.
URL parameter string
The parameter string
vip-search-enabled=1 can be appended to a site’s URL to test the offloading of search queries to Enterprise Search before the
VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION constant has been defined as
true in the codebase. This is especially useful for a site that is in the process of transitioning to Enterprise Search and is already receiving public traffic.
To test offloading, search for a term on a site with Enterprise Search enabled. Append the parameter to the URL in the browser’s address bar and reload the browser. For example:
Refer to results in the Enterprise Dev Tools panel to verify that search is successfully being offloaded to Enterprise Search.
HTTP response header
Search requests that are successfully offloaded to Enterprise Search will return a
X-ElasticPress-Query: true response header.
This is also true for requests made to a WP REST API search endpoint that are successfully offloaded to Enterprise Search. For example:
Last updated: January 18, 2024