All blog posts Know-how 10 mins read

Search Engines: Comparing Solr, Elasticsearch and OpenSearch

Kevin Ferranti
Written by
Kevin Ferranti
Published
May 28, 2024
Share this post
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
$cta_title = get_field('footer_cta_title', 'option');
$cta_description = get_field('footer_cta_description', 'option');
$cta_image = get_field('footer_cta_image', 'option');
$address = get_field('footer_address', 'option');
$phone = get_field('footer_phone', 'option');
$email = get_field('footer_email', 'option');
?>
 
<section class="section-secondary-cta">
    <div class="container flex">
        <div class="left-content">
            <h2><?php echo $cta_title; ?></h2>
            <p><?php echo $cta_description; ?></p>
            <div class="buttons">
                <a href="<?php echo addLanguageCodeToLink('/contact'); ?>" class="button large icon-left"><i class="fa-regular fa-comment-dots" aria-hidden="true"></i> <?php _e('Contact Sales', 'nine'); ?></a>
                <?php if(isLanguage('en')) : ?>
                    <a href="https://cockpit.nine.ch/en" class="large secondary button icon-right">
                <?php else : ?>
                    <a href="https://cockpit.nine.ch/de" class="large secondary button icon-right">
                <?php endif; ?>
                    <?php _e('Go to Cockpit', 'nine'); ?> <i class="fa-solid fa-arrow-up-right-from-square"></i>
                </a>
            </div>
        </div>
        <div class="right-content">
            <img src="<?php echo $cta_image['url']; ?>" alt="<?php echo $cta_image['alt']; ?>" width="612" height="406">
        </div>
    </div>
</section>
 
 
<footer id="colophon" class="site-footer">
    <div class="footer-top">
        <div class="container flex">
 
            <div class="footer-about">
                <a href="<?php echo home_url(); ?>">
                    <img class="footer-logo" src="<?php echo get_template_directory_uri(); ?>/images/logo-footer.svg" alt="<?php _e('Nine Logo in white', 'nine'); ?>" width="104" height="36">
                </a>
                <address>
                    <div class="title"><?php _e('Address', 'nine'); ?>:</div>
                    <p><?php echo $address; ?></p>
                </address>
                <address>
                    <div class="title"><?php _e('Contact', 'nine'); ?>:</div>
                    <p><a href="tel:<?php echo $phone; ?>"><?php echo $phone; ?></a></p>
                    <p><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></p>
                </address>
 
                <?php if (isLanguage('en')) : ?>
                    <a href="https://deplo.io/en.html" target="_blank">
 
                        <?php else : ?>
                    <a href="https://deplo.io/index.html" target="_blank">
                        <?php endif; ?>
                        <img class="hosted-on" src="<?php echo get_template_directory_uri(); ?>/images/hosted-on-deploio_blue-on-white.png" alt="<?php _e('Hosted on Deplo.io', 'nine'); ?>" width="150" height="38">
                    </a>
            </div>
            <div class="footer-sitemap">
 
                <?php
                $menu_1_header = get_field('menu_1_header', 'option');
                $menu_2_header = get_field('menu_2_header', 'option');
                $menu_3_header = get_field('menu_3_header', 'option');
                $menu_4_header = get_field('menu_4_header', 'option');
                ?>
 
                <?php if (have_rows('menu_1', 'option')) : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php echo $menu_1_header; ?></div>
                        <ul>
                            <?php while (have_rows('menu_1', 'option')) : the_row(); ?>
                                <li><a href="<?php the_sub_field('link'); ?>"><?php the_sub_field('title'); ?></a></li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                <?php else : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php _e('Products', 'nine'); ?></div>
                        <ul>
                            <?php
                            // Custom WP Query to retrieve products
                            $args = array(
                                'post_type'      => 'product',
                                'posts_per_page' => 5,
                            );
 
                            $product_query = new WP_Query($args);
 
                            if ($product_query->have_posts()) :
                                while ($product_query->have_posts()) : $product_query->the_post(); ?>
                                    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                            <?php endwhile;
                                wp_reset_postdata();
                            else :
                                echo '<li>No products available</li>';
                            endif;
                            ?>
                        </ul>
                    </div>
                <?php endif; ?>
 
                <?php if (have_rows('menu_2', 'option')) : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php echo $menu_2_header; ?></div>
                        <ul>
                            <?php while (have_rows('menu_2', 'option')) : the_row(); ?>
                                <li><a href="<?php the_sub_field('link'); ?>"><?php the_sub_field('title'); ?></a></li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                <?php else : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php _e('Articles', 'nine'); ?></div>
                        <ul>
                            <?php
                            // Custom WP Query to retrieve articles
                            $args = array(
                                'post_type'      => 'post',
                                'posts_per_page' => 5,
                            );
 
                            $article_query = new WP_Query($args);
 
                            if ($article_query->have_posts()) :
                                while ($article_query->have_posts()) : $article_query->the_post(); ?>
                                    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                            <?php endwhile;
                                wp_reset_postdata();
                            else :
                                echo '<li>No articles available</li>';
                            endif;
                            ?>
                        </ul>
                    </div>
                <?php endif; ?>
 
                <?php if (have_rows('menu_3', 'option')) : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php echo $menu_3_header; ?></div>
                        <ul>
                            <?php while (have_rows('menu_3', 'option')) : the_row(); ?>
                                <li><a href="<?php the_sub_field('link'); ?>"><?php the_sub_field('title'); ?></a></li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                <?php else : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php _e('Case studies', 'nine'); ?></div>
                        <ul>
                            <?php
                            // Custom WP Query to retrieve case studies
                            $args = array(
                                'post_type'      => 'case-study',
                                'posts_per_page' => 5,
                            );
 
                            $case_study_query = new WP_Query($args);
 
                            if ($case_study_query->have_posts()) :
                                while ($case_study_query->have_posts()) : $case_study_query->the_post(); ?>
                                    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                            <?php endwhile;
                            endif;
                            wp_reset_postdata(); ?>
                        </ul>
                    </div>
                <?php endif; ?>
 
                <?php if (have_rows('menu_4', 'option')) : ?>
                    <div class="sitemap-column">
                        <div class="footer-title"><?php echo $menu_4_header; ?></div>
                        <ul>
                            <?php while (have_rows('menu_4', 'option')) : the_row(); ?>
                                <li><a href="<?php the_sub_field('link'); ?>"><?php the_sub_field('title'); ?></a></li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                <?php endif; ?>
 
            </div>
        </div>
        <?php if (isLanguage('en')) : ?>
            <a href="https://deplo.io/en.html" target="_blank">
        <?php else : ?>
            <a href="https://deplo.io/index.html" target="_blank">
        <?php endif; ?>
            <img class="mobile-hosted-on" src="<?php echo get_template_directory_uri(); ?>/images/hosted-on-deploio_blue-on-white.png" alt="<?php _e('Hosted on Deplo.io', 'nine'); ?>" width="150" height="38">
        </a>
    </div>
    <div class="footer-bottom">
        <div class="container flex">
            <div class="copyright">© <?php echo date('Y'); ?> Nine. <?php _e('All rights reserved', 'nine'); ?>.</div>
            <nav>
                <?php
                wp_nav_menu(
                    array(
                        'theme_location' => 'bottom-footer',
                        'menu_id'        => 'bottom-footer',
                    )
                );
                ?>
            </nav>
        </div>
    </div>
</footer>
 
<?php wp_footer(); ?>
 
</body>
 
</html>

In today’s web applications, search functions are omnipresent. Searching for product titles or within a product description is a necessity for e-commerce, but the search isn’t limited to web applications. Different use cases lead to different requirements. Luckily, the open-source world provides a number of modern search engines to fit these requirements.

But which search engine is the right fit for your use case? This article outlines three possible options, two of which are available as a Managed Service at Nine: Apache Solr, Elasticsearch (which is not available as a Managed Service at Nine), and OpenSearch. 

Based on Apache Lucene

The three search engines have one thing in common. They are all based on the same powerful Java library: Apache Lucene. Apache Solr and Apache Lucene are both published by the Apache Foundation as open-source projects.

As they are based on Apache Lucene, all three search engines provide basic common search features, such as:

  • Ranked searching: search results with the highest relevance are shown first
  • Query types: phrase queries, wildcard queries, proximity queries, etc.
  • Sorting: search results can be sorted via fields
  • Features: highlighting, faceting (dynamic filtering), etc.

However, the search engines differ when it comes to complex features. 

Search Engine Popularity

Currently, Elasticsearch is the most popular search engine among the three options.

Source: https://db-engines.com/en/ranking_trend/search+engine 

Elasticsearch Licensing Change

First, let’s address the elephant in the room when it comes to Elasticsearch: its licensing change. Starting from version 7.10.2, the Elasticsearch licencing model was changed from the open-source licence ‘Apache 2.0’ to a ‘Server Side Public Licence (SSPL)’. Although the code is still available for download, the new licence is not compatible with the ideas of the Open Source Initiative (OSI). One major change is that Elasticsearch can no longer be provided to others as a Managed Service. Moving forward, this licence change effectively prevents us from providing newer versions of Elasticsearch as a Managed Service.

This licensing change prompted the creation of OpenSearch on 12 April 2021. It was forked from Elasticsearch 7.10.2 by Amazon. Some code was removed, meaning that it remained compatible with the Apache 2.0 licence. As we were unable to provide Elasticsearch as a Managed Service after the licensing change, we introduced OpenSearch as a replacement for Elasticsearch.

Choosing the Right Search Engine

All three search engines offer a wide variety of features and are suited to most use cases. If you are experienced with one of the search engines, we recommend you to go with that one. It is generally accepted that the differences between these search engines are so small that prior experience is a valid reason for choosing one over another.

Please bear in mind that, due to the aforementioned licence restrictions, Nine is offering OpenSearch and Solr, and cannot provide Elasticsearch as a Managed Service.

We nevertheless include Elasticsearch in our list of key differences between the three search engines in the next chapters.

Differences Between Apache Solr and Elasticsearch

Differences in Features

When it comes to the features, the key differences are as follows:

  1. Main Focus: Solr’s primary strength lies in its robust full-text search capabilities, offering a wider range of features in this area compared to Elasticsearch. While Elasticsearch simplifies its interface through a straightforward API, it sacrifices some flexibility in the process. Meanwhile, Elasticsearch excels at handling time series data and analytics, and is renowned for its exceptional scalability, processing time series data, and analytics.
  2. Data Handling: Both provide a variety of options and data sources, such as JSON or CSV. However, Solr works with predefined schemas, whereas Elasticsearch is more flexible, due to its schema-free approach. Although Solr’s schemas can also be defined to be more dynamic, it cannot match Elasticsearch in that regard.
  3. Query Language: Solr’s query language is more sophisticated and allows for more complex searches. In contrast, Elasticsearch provides a simpler and more intuitive syntax.
  4. Scalability: Although both systems are highly scalable, Elasticsearch has a distributed architecture and supports automatic sharding. 

Differences in Community

Apache Solr has a longer development history, and this comes with a more mature open-source community. However, Elasticsearch benefits from a vibrant and active Elastic community. As of May 2024, according to DB-Engines, Elasticsearch is generally more popular than Apache Solr.

Differences between Elasticsearch and OpenSearch

Differences in Features

Although OpenSearch was forked from Elasticsearch in Version 7.10.2, some differences have emerged in the meantime.

Their common functionality is coming from Apache Lucene, which both are based on. Some specific functionality, such as authentication or authorisation, index management and alerting, are proprietary in Elasticsearch, and thus had to be implemented with open-source alternatives in OpenSearch.

Since the two search engines are developed independently, some new features are mutually exclusive. For example, Elasticsearch has added ‘Time Series Data Streams’ (TSDS), which allow for time stamped metrics data as one or more time series. Meanwhile, OpenSearch reintroduced segment replication, which enables copying segment files across shards, instead of documents being indexed on each shard copy.

Differences in Community

Currently, there seem to be more contributions to Elasticsearch than to OpenSearch. However, interest in OpenSearch keeps rising, while the interest in Elasticsearch is slowly declining. Due to Elasticsearch’s licensing change, there are many providers who no longer offer Elasticsearch as a Managed Service.