What is elasticsearch?
Elasticsearch is a (free) open source search engine based on Lucene library, belonging to Apache and developed in Java. The engine's creator, Shay Banon, has developed the initial version in 2004, calling it Compas, but, in 2010, desirous of creating a search and scale solution based on JSON, he has launched Elasticsearch.
As "search engine", it is used for:
- Application, website and database search,
- Log registration and log analysis
- Monitoring the performance of applications and infrastructure metrics
- Geospatial analysis and data visualization
- Security and business analysis
How does elasticsearch work?
In the initial phase, the data enters Elasticsearch to be subsequently analyzed, optimized and enriched, before being indexed within it. This process is improperly called "data ingestion". Subsequently, following the ES (elasticsearch) indexing, the users can run their queries and questioning for the withdrawal of the complex reports on their data.
There is also the possibility to configure Elasticsearch, together with Kibana, in order to create dashboards for real-time data vizualization.
Kibana is a monitoring and management software for Elasticsearch, similar to Zabbix/Grafana.
Why use elasticsearch?
Being based on Lucene, it is excellent for searching full texts. Likewise, its latency is very short, processing the real-time indexing. Besides, data or data package storage and search is more efficient, serving for managing the life cycle of the index.
For security and integration reasons, Elasticsearch can only be installed on a VPS or on a dedicated server, but we can also set it up for our Magento hosting packages or premium web hosting packages by creating a new VPS with Elasticsearch.
At the Magento hosting level, elasticsearch guarantees you a smoother operation of your shop, eliminating the extended time for indexing and product or order loading.
The Magento accounts, being hosted on shared servers, the set up of a separate VPS for each individual account. This will guarantee you that the elasticsearch installation works only for your account, individually, without it being affected by the other clients hosted on this server.
The main issues that might arise when using elasticsearch on the shared servers, would usually be the fact that the indexing could repeat to several clients, but also the overload of the server allocated resources.
Elasticsearch + Magento benefits
- Quick and advanced search of the catalogue products
- Search linguistic support
- Search through synonyms and key-words
- The clients are not interrupted when the elasticsearch integration is performed
- Increased and scalable accuracy results
- Support for the real-time data analysis
- Applicability beyond search, including carryover, customization, performance and data storage.
In order to work properly together with Magento 2.4.x, it is necessary for the elasticsearch version to be 7.6.x, the older versions (2.x, 5.x, 6.x) not being supported by this version of Magento.
Comparison with other search engines in Magento:
Another option at the search engine level, used for indexing and scaling the websites with very high traffic. Example of websites using SOLR: Cnet and Netflix.Advantages:
- Used mostly for the searches in the Magento 1-based shops
- It does not require a big indexing process
- Open-Source 100%
- Difficult to implement
- Less viable and less safe than elasticsearch
An option that is easier to integrate than SOLR, but less viable than it. The Sphinx does not run as a stand-alone option, but as an extension that can be downloaded from Magento Marketplace. Websites using Sphinx: Mozilla, Craigslist and Dailymotion.Advantages:
- Strong search engine used by popular websites
- Given the fact that it has been improved over a number of years, it is now very stable.
- Slower than elasticsearch and SOLR