Integrate Elasticsearch with WordPress.
Let's face it, WordPress search is rudimentary at best. Poor performance, inflexible and rigid matching algorithms (which means no comprehension of 'close' queries), the inability to search metadata and taxonomy information, no way to determine categories of your results and most importantly the overall relevancy of results is poor.
Elasticsearch is a search server based on Lucene. It provides a distributed, multitenant-capable full-text search engine with a RESTful web interface and schema-free JSON documents.
Coupling WordPress with Elasticsearch allows us to do amazing things with search including:
- Relevant results
- Autosuggest
- Fuzzy matching (catch misspellings as well as 'close' queries)
- Proximity and geographic queries
- Search metadata
- Search taxonomies
- Facets
- Search all sites on a multisite install
- The list goes on...
- First, you will need to properly install and configure Elasticsearch.
- Install the plugin in WordPress, you can download a zip via Github and upload it using the WP plugin uploader.
First, make sure you have Elasticsearch configured properly.
Before configuring the WordPress plugin, you need to decide how you want to run the plugin. The processes for configuring single site and multisite cross-site search are slightly different.
- Activate the plugin.
- Within the admin panel, navigate to Settings -> ElasticPress
- Input the Elasticsearch host, Elasticsearch index name, and at least one post type you want to index.
- Network activate the plugin
- Within your network settings dashboard, go to Settings -> ElasticPress
- Check the box to activate cross-site search
- Input the Elasticsearch host, Elasticsearch index name, and at least one post type on one site that you want to index.
Follow the configuration instructions above to setup the plugin.
Within the terminal change directories to the plugin folder. Initialize your testing environment by running the following command:
For VVV users:
bash bin/install-wp-tests.sh wordpress_test root root localhost latest
For VIP Quickstart users:
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
where:
- wordpress_test is the name of the test database (all data will be deleted!)
- root is the MySQL user name
- root is the MySQL user password (if you're running VVV). Blank if you're running VIP Quickstart.
- localhost is the MySQL server host
- latest is the WordPress version; could also be 3.7, 3.6.2 etc.
Run the plugin tests:
phpunit
If you identify any errors or have an idea for improving the plugin, please open an issue. We're excited to see what the community thinks of this project, and we would love your input!