{"id":11237,"date":"2024-08-20T17:30:53","date_gmt":"2024-08-20T17:30:53","guid":{"rendered":"https:\/\/spreecommerce.org\/?post_type=cpt_integrations&#038;p=11237"},"modified":"2024-08-21T13:02:29","modified_gmt":"2024-08-21T13:02:29","slug":"elasticsearch-integration-with-spree","status":"publish","type":"cpt_integrations","link":"https:\/\/spreecommerce.org\/integrations\/elasticsearch-integration-with-spree\/","title":{"rendered":"ElasticSearch and Spree integration"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.elastic.co\/products\/elasticsearch\">ElasticSearch<\/a>&nbsp;is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases.&nbsp;It is developed in Java and is released as open source under the terms of the Apache License.<\/p>\n\n\n\n<p>According to the&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/DB-Engines_ranking\">DB-Engines ranking<\/a>, ElasticSearch is the most popular enterprise search engine.<\/p>\n\n\n\n<p>The integration of ElasticSearch with your Spree Commerce store can be done quickly and easily following the guidelines mentioned below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The benefits of using ElasticSearch for your ecommerce business<\/h2>\n\n\n\n<p>Powerful, flexible, and reliable search engine is a must-have for an ecommerce store, especially when large amounts of data are involved. The&nbsp;<a href=\"https:\/\/spreecommerce.org\/elasticsearch-and-spree-commerce-integration-to-optimize-your-ecommerce-user-experience\/\" target=\"_blank\" rel=\"noreferrer noopener\">easier and faster customers are able to find what they are looking for<\/a>, the more likely they are to purchase something in your store.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Speed<\/h3>\n\n\n\n<p>ElasticSearch is able to execute complex queries extremely fast. It also caches almost all of the structured queries commonly used as a filter for the result set and executes them only once. For every other request which contains a cached filter, it checks the result from the cache. This saves the time parsing and executing the query improving the speed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Lots of search options<\/h3>\n\n\n\n<p>ElasticSearch implements a lot of features when it comes to search such as customized splitting text into words, customized stemming, faceted search, full-text search, auto-completion, and instant search. Also, fuzzy search is good for spelling errors. You can find what you are searching for even though you have a spelling mistake. Auto-completion and instant search refer to searching while the user types. It can be simple suggestions of existing tags, trying to predict a search based on search history, or just doing a completely new search for every keyword.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Scalability<\/h3>\n\n\n\n<p>As ElasticSearch has a distributed architecture it enables to scale up to thousands of servers and accommodate petabytes of data. The customers then need not manage the complexity of distributed design as it has been done automatically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Multi-tenancy<\/h3>\n\n\n\n<p>Often, you have multiple customers or users with separate collections of documents, and a user should never be able to search documents that do not belong to them. This often leads to a design where every user has their own index. Often, this leads to having too many indexes. One larger ElasticSearch index is actually better.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flexibility<\/h3>\n\n\n\n<p>Numbers, text, geo, structured, unstructured. All data types are welcome.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.elastic.co\/solutions\/app-search\">Application search<\/a>,&nbsp;<a href=\"https:\/\/www.elastic.co\/solutions\/security-analytics\">security analytics<\/a>,&nbsp;<a href=\"https:\/\/www.elastic.co\/solutions\/metrics\">metrics<\/a>, and&nbsp;<a href=\"https:\/\/www.elastic.co\/solutions\/logging\">logging<\/a>&nbsp;only scratch the surface of how companies around the world are relying on Elasticsearch to solve a variety of challenges.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to integrate ElasticSearch with Spree<\/h2>\n\n\n\n<p>There are 3 popular Rails gems which you can use to integrate ElasticSearch with your Spree application:<\/p>\n\n\n\n<p>1.&nbsp;<a href=\"https:\/\/github.com\/toptal\/chewy\">https:\/\/github.com\/toptal\/chewy<\/a><br>2.&nbsp;<a href=\"https:\/\/github.com\/elastic\/elasticsearch-rails\">https:\/\/github.com\/elastic\/elasticsearch-rails<\/a><br>3.&nbsp;<a href=\"https:\/\/github.com\/ankane\/searchkick\">https:\/\/github.com\/ankane\/searchkick<\/a><\/p>\n\n\n\n<p>All of them can be easily integrated thanks to the well-designed Spree\u2019s database schema. What\u2019s more, Spree provides an abstraction for implementing products search (check out&nbsp;<a href=\"https:\/\/github.com\/spree\/spree\/blob\/master\/core\/app\/models\/spree\/app_configuration.rb#L70\">https:\/\/github.com\/spree\/spree\/blob\/master\/core\/app\/models\/spree\/app_configuration.rb#L70<\/a>). If you want to implement a search of other entities, just follow the instructions provided by the gems \u2013 Spree is just a regular Rails app so there shouldn\u2019t be any additional problems.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>It doesn\u2019t matter which gem you\u2019ll choose \u2013 the integration will go smoothly. Spree models are so flexible that adding a search layer is not big deal. \u2013 Piotr Leniec, Senior Fullstack Developer,&nbsp;<a href=\"https:\/\/sparksolutions.co\/\">Spark Solutions<\/a><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Example of ElasticSearch and Spree integration<\/h2>\n\n\n\n<p><a href=\"https:\/\/greetabl.com\/\">Greetabl<\/a>&nbsp;is&nbsp;an online one-stop-shop for creatively-curated gifts and greetings that are personalized with Instagram photos, packaged and sent in just a few clicks. The company uses Spree for its eCommerce platform and ElasticSearch for&nbsp;quickly searching and filtering millions of records.<\/p>\n\n\n\n<p>Read more:&nbsp;<a href=\"https:\/\/spreecommerce.org\/stories\/greetabl-com-business-streamlined-by-a-custom-spree-commerce-implementation-fulfillment-integration\/\">Greetabl\u2019s Success Story<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" width=\"1349\" height=\"883\" src=\"https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration.jpg\" alt=\"example of ElasticSearch and Spree Commerce Integration\" class=\"wp-image-2305\" srcset=\"https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration.jpg 1349w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration-300x196.jpg 300w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration-768x503.jpg 768w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration-1024x670.jpg 1024w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2019\/01\/example-of-ElasticSearch-and-Spree-Commerce-Integration-600x393.jpg 600w\" sizes=\"(max-width: 1349px) 100vw, 1349px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>ElasticSearch&nbsp;is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases.&nbsp;It is developed in Java and is released as open source under the terms of the Apache License. According to the&nbsp;DB-Engines ranking, ElasticSearch is the most popular enterprise search engine. The integration of ElasticSearch with your Spree Commerce store [&hellip;]<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":true,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":""},"cpt_integrations_category":[987],"class_list":["post-11237","cpt_integrations","type-cpt_integrations","status-publish","hentry","cpt_integrations_category-search"],"acf":[],"_links":{"self":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations\/11237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations"}],"about":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/types\/cpt_integrations"}],"wp:attachment":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/media?parent=11237"}],"wp:term":[{"taxonomy":"cpt_integrations_category","embeddable":true,"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations_category?post=11237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}