Skip to content

Jetpack Search

Jetpack Search is a paid upgrade to the Jetpack plugin that improves the search experience for WordPress sites. Jetpack Search uses Elasticsearch for indexing and searching, typically without any need for a site owner to add custom code.

When enabled on a VIP site, Jetpack Instant Search syncs content changes to a private cache site located within Automattic’s data centers, and uses that cached copy to perform indexing. When search queries are performed on the VIP site, the database query is sent to a public endpoint which only returns results for publicly available data.

To enable Jetpack Search on a WordPress site, create a VIP Support request. The first 100,000 records of a VIP site’s Jetpack Search index are free; additional records are billable by Jetpack.

Jetpack Search can also be enabled on a non-production VIP environment. After VIP Support has enabled Jetpack Search on a non-production environment, it will not work as expected until Jetpack’s search module is force-enabled via code.

This code example demonstrates how to force-enable the Jetpack search module on a non-production VIP environment using the jetpack_active_modules filter:

 * Force Jetpack 'search' module to be active.
 * @param array $modules
 * @return array

function enable_jetpack_search( $modules ) {
    $modules[] = 'search';
    return array_unique( $modules );

add_filter( 'jetpack_active_modules', 'enable_jetpack_search', 9999 );

Jetpack Search is only able to handle front-end search queries (whereas Enterprise Search is able to offload front-end and non-standard queries). To offload an existing front-end query to the Jetpack Search index, 'es' => 'true' must be set for those WP_Query parameters. Supported queries that are sent to the Jetpack Search index will obtain a list of matching post IDs, and a MySQL query will then fetch the post data.

In this code example, the pre_get_posts filter is used to enable offloading queries for category pages, tag pages, and author pages to the Jetpack Search index:

* Enable Elastic search for category, tag and author pages.
* This is optional, and only necessary if you need Jetpack search
* for these queries
* @param $query
function vip_s__maybe_enable_es_wp_query( $query ) {

        if ( is_admin() || ! $query->is_main_query() ) {

        if ( $query->is_category() || $query->is_tag() || $query->is_author() ) {
                $query->set( 'es', 'true' );

add_action( 'pre_get_posts', 'vip_s__maybe_enable_es_wp_query' );

Last updated: April 03, 2023

Relevant to

  • WordPress