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.php and define them 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.
Transitioning to Enterprise Search from Jetpack
Sites that are currently using Jetpack Search, and already launched and serving traffic, can avoid search downtime by:
- Enabling Enterprise Search by adding the
VIP_ENABLE_VIP_SEARCHconstant to vip-config.php and defining it as
true. This will initiate the indexing of new, incremental changes without affecting Jetpack Search.
- Run an index for the existing site content.
- If needed, create allow lists to define what is indexed.
- Verify that the newly created index is reporting good health and test search queries.
- It is recommended to look for any usages of the filters
jetpack_search_es_query_argsin the codebase and modify them to use the equivalent
ep_formatted_args. Since the ES queries are not 1:1 for Jetpack and Enterprise Search, this will require testing the alterations.
Once it is determined that the site is ready to transition off of its current Elasticsearch service into Enterprise Search:
- Add the
VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATIONconstant to vip-config.php and define it as
true. This will automatically send front-end search queries directly to Enterprise Search and disable the Jetpack Search module.
- Verify that Enterprise Search is sending its queries to Elasticsearch by using Search Dev Tools.
- Disable and remove all other Elasticsearch-backed functionality such as Jetpack Search, the es-wp-query adapter, or other variants of Elasticsearch. No other Elasticsearch-backed functionality can be supported while Enterprise Search is enabled. Enterprise Search uses forks of es-wp-query and ElasticPress that are loaded automatically.
- If there was any code that made search endpoint calls to the WordPress.com public API (e.g.
https://public-api.wordpress.com/rest/v1/sites/<site ID>/search), modify it to use the WordPress core one instead at
- Review New Relic’s error logs for conflicts, PHP warnings or issued notices.
Jetpack migration support path
define( 'VIP_SEARCH_MIGRATION_SOURCE', 'jetpack' );
For sites that are using the
jetpack_sync_post_meta_whitelist filter, the constant
VIP_SEARCH_MIGRATION_SOURCE can be added to vip-config.php and defined as
jetpack. Jetpack’s default post meta allow list, and the values that are being filtered will be used as a base in the post meta allow list.
Testing search queries
The query string
&vip-search-enabled=1 can be appended to a site’s URL to test if queries are sent to Enterprise Search without defining the
For example, to test Enterprise Search with the search term “test” on a site with the domain “example.com”, the full URL to test in a browser: