Elasticsearch is an open-source full-text search engine. It is used to index data and search for such data incredibly quickly.
In the context of WordPress, Elasticsearch can be used for speed up querying the WordPress database . This is done by creating an index of your site's database content and then using Elasticsearch to search for this index much faster than a MySQL query can perform the same search.
If you have the time and ability, Elasticsearch can be integrated with a WordPress site by a highly experienced WordPress and Elasticsearch developer. If your site makes relatively standard use of WP_Query, Elasticsearch can also be integrated by installing ElasticPress , a free WordPress plugin from 10up, available from WordPress.org , which automatically integrates with the WP_Query object to generate query results with Elasticsearch rather than MySQL.
Sites that will benefit most from Elasticsearch
Any site that makes heavy use of WP_Query can benefit from Elasticsearch. Examples of sites that can benefit from Elasticsearch:
- Sites where research is the primary means of navigation.
- WooCommerce sites with huge number of orders where site admins need to be able to search the order list regularly.
- Any site with a large number of posts where MySQL queries produce unacceptably slow results.
If your site has queries that are running unacceptably slow, or if you feel heavy querying is overloading your site's database, it might be a good candidate for Elasticsearch.
Immediate benefits of ElasticSearch
One of the most immediate benefits of ElasticSearch with the addition of ElasticPress is that it saves the CPU load on a site that has a lot of requests.
For example, imagine a site of Books, of Songs where each user who enters tends to do one or more searches. Imagine now that this site is being stormed by thousands of enthusiastic visitors.
Understand with two simple calculations that thousands of queries per minute will arrive at MySQL which obviously will struggle to return answers quickly and therefore also the php process upstream that will be in the waiting phase will be very slow and soon we will saturate everyone the sockets of the php-fpm pool going to produce that annoying 502 bad Gateway, also giving a really embarrassing and unprofitable slow navigation for both the user and the site owners.
Furthermore, to cope with the slowness of MySQL requests you will be practically forced to scale everything on an ultra-performing machine with many cores, a lot of RAM, very fast nVME disks, costing at least 300 euros per month if on a dedicated server and several thousand on cloud instances. , however, to realize that even the upgrade of resources is not enough.
With the installation of ElasticSearch combined with ElasticPress you will find a great relief, going to significantly reduce the load (at least 10 times) from the MySQL database and therefore being able to continue working with a lean, responsive and fast site on a machine or instance not too bodied.
We have had customers who have gone from hardware infrastructure rental operating costs from around 600 euros per month to less than 100 euros, simply by replacing the native WordPress search engine with ElasticSearch and ElasticPress, above all to improve the user experience and the speed of the site.
Adding Elasticsearch to a WordPress site
If you want to add Elasticsearch to your WordPress site, do the following:
- Contact the managedserver.it support team and request that Elasticsearch be added to your site.
- The support team will install Elasticsearch on your site's hosting plan and our billing team will add the additional Elasticsearch subscription to your account. Having Elasticsearch installed on the same server as your PHP environment and MySQL database helps reduce latency rather than hosting it in a separate instance or using Elasticsearch hosted by Elastic.
- The ManagedServer.it support team will proceed and install the plug-in ElasticPress on your site and will connect it to the Elasticpress service running in the site container.
Some ElasticPress features include: displaying WooCommerce products in search results, auto-completing searches, choosing what you want to index, and query improvements for related posts. If you plan to use a different plugin or build your own integration, please let our support team know and they will skip this step.
Using Elasticsearch with a WordPress website via ElasticPress.io
Once Elasticsearch has been installed, it needs to be integrated with your site. The most common method of integrating your site with Elasticsearch is to install ElasticPress. During the typical setup, our support team will install the ElasticPress plugin and will link it to the Elasticsearch service.
After installation, you will need to log into the administration area of the website and complete the configuration of the ElasticPress plugin. Part of this process is indexing your site's content. If your site's content is extremely large indexing via your WordPress admin may fail. You can use the wp-cli ElasticPress commands to perform indexing over SSH.
If your site uses custom fields and you want to search the content of custom fields, custom development work may be required to get ElasticPress to index and search those fields.
ElasticPress is a fast and flexible search and query engine for WordPress, allows WordPress to find or query relevant content extremely quickly through a variety of highly customizable features. WordPress by default struggles to analyze content relevance and can be very slow.
The plugin also contains features for popular plugins.
Here is a list of the amazing ElasticPress features included in the plugin:
Search - Instantly find the content you are looking for.
WooCommerce : "I want both cotton, a women's shirt, for under $ 15 in stock." Product customization strains servers and increases load times. Your buyers can quickly find the perfect product and buy it quickly.
Related Articles : ElasticPress understands real-time data, so it can instantly deliver engaging and accurate related content without impacting site performance.
Protected content - Optionally index all your content, including private content
Documents - Index text within popular file types and add those file types to search results.
Autosuggest - Suggest relevant content when text is entered into the search field.
Facets - Add controls to your website to filter content based on one or more taxonomies.
users - Improves user search relevance and query performance.
Your server can't take it anymore? Do you want a WordPress hosting with ElasticSearch? Contact us now!