@10up/frontity-elasticpress v0.9.0
@10up/frontity-elasticpress
This package enhances your frontity theme by supercharing the search experience with ElasticPress.
Requirements
- Elasticsearch per ElasticPress requirements.
- WordPress website running ElasticPress.
Installation
To install this package you will need an existing frontity project. Check out the frontity docs for instructions.
Install this package:
npm install @10up/frontity-elasticpress --save
Then in your frontitiy.settings.[js|ts]
add the configuration for ElasticPress in the packages
section.
{
name: '@10up/frontity-elasticpress',
state: {
elasticpress: {
node: 'http://elasticpress.test/__elasticsearch',
indexName: 'elasticpresstest-post-1',
loadInitialData: true,
},
},
},
That's all you need.
How it works
This packages replaces the default search handler with a custom one that runs search queries in ElasticSearch index directly instead of WordPress.
In addition to better search results this also allow you to have real-time search results as you type. See an example here.
Disclaimer
You need to ensure your ElasticSearch index is not fully exposed to the public. You most likely want to add some layer around your ElasticSearch index to lock down your index to avoid unwanted queries or requests.
Check out ElasticPress.io for a secure ElasticSearch service that was built for ElasticPress.
Like what you see?
4 years ago