Jetpack Search is a powerful replacement for the search capability built into WordPress. It is a paid upgrade to the Jetpack plugin that provides higher quality results and an improved search experience. Upgrade today to get started.
Note: This support article is intended for Jetpack Inline Search rather than the newer Jetpack Instant Search solution. Jetpack Inline Search is deprecated and we recommend all users switch to Jetpack Instant Search, our newer search solution. For more details on the difference between Inline Search and Instant Search, check out this page.
This support article covers how to customize Jetpack Search by using the Jetpack Search API and is intended for developers.
By default Jetpack Search will search everything to provide the best result. All records/documents (posts, pages, products, etc) on your site are searchable and will potentially be shown to end users. When sites are more complex though, you may want to limit the search based on what part of the site the user is currently on. Additionally, the API could be used to build features into a website or an app to provide better content discovery experiences.
The Jetpack Search engine combines data from multiple sources (your WordPress database and your stats/analytics) and indexes it into Elasticsearch. All search queries are Elasticsearch queries, though the engine will sometimes run multiple queries to get the best results. The API allows a subset of the Elasticsearch Query DSL and Aggregations to be used for filtering and aggregating on the search results.
If you have a request, our Github issues are always open. Please add the “Search” tag to your issue.
Supported Elasticsearch Filters
- bool – supports AND (must), OR (should), and NOT (must_not)
- exists – whether a field exists in the document
- range – date or number ranges
- term – individual terms in the index
- terms – an OR of multiple terms
Any field can be queried with these. See the list of fields.
Supported Elasticsearch Aggregations
For multiple reasons, not all fields can support aggregations.
Aggregations are Allowed on:
- meta.*.boolean (see details)
- taxonomy.*.slug (see details)
Frequently Asked Questions
Why do you limit the available queries and aggregations?
We want to ensure backwards compatibility so that 10 years from now, your queries will still keep working. The Elasticsearch project does not maintain the same level of backwards compatibility and we intend to shield our customers from needing to do unnecessary work.
There are also some features of Elasticsearch that do not scale well or can cause performance problems when used. By limiting the available queries, we hope to find the right balance between maintenance and flexibility.
What version of Elasticsearch are you running?
Above, we are linking to the Elasticsearch 2.4 documentation because that is what we are maintaining compatibility with. We have a query re-write layer which allows us to convert ES queries into whatever version of Elasticsearch we are running.
* Elasticsearch is a trademark of Elasticsearch BV, registered in the U.S. and in other countries.
If you have any further questions about Jetpack Search, please check out our related support documentation. If your questions aren’t answered there, feel free to contact us and we will be happy to help.