{"id":3484,"date":"2015-01-05T18:54:38","date_gmt":"2015-01-05T18:54:38","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2015\/01\/05\/integrating-elasticsearch-with-wordpress-using-elasticpress\/"},"modified":"2021-08-16T22:55:57","modified_gmt":"2021-08-17T02:55:57","slug":"integrating-elasticsearch-with-wordpress-using-elasticpress","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/","title":{"rendered":"Integrating Elasticsearch with WordPress using ElasticPress"},"content":{"rendered":"<p>If you&#8217;ve ever used Elasticsearch for managing your searchable content, you know that it is incredibly fast and scalable. If you&#8217;re a WordPress user, you likely also know that obtaining WP_Query objects can sometimes have a negaitve impact on your resource usage if you have a large database of center to search from. Thankfully, 10up has developed a solution in which the WP_Query object can use Elasticsearch instead of the default behavior, which is much easier on your server resources.<\/p>\n<p>In this article, we will show you how to integerate WordPress with Elasticsearch using ElasticPress by 10up.<\/p>\n<div class=\"alert alert-warning\">\n<p><strong>Note:<\/strong> This article assumes that you have already installed Elasticsearch. If you have not already done so, you may review our article on <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-elasticsearch\/\">installing Elasticsearch<\/a>.<\/p>\n<p>This ElasticPress also requires WP-CLI. If you don&#8217;t already have it installed, you may follow our article on <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/install-and-configure-wp-cli\/\">installing WP-CLI<\/a>. <em>If you&#8217;re looking for an <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/adding-jetpack-search-to-your-wordpress-site\/\">easy-to-use search functionality<\/a>, try Jetpack!\u00a0<\/em><\/p>\n<\/div>\n<ol class=\"article_list\">\n<li>First, you will need to edit your <strong>wp-config.php<\/strong> file to include the location of your Elasticsearch server. In this example, Elasticsearch is on the same server as our WordPress site, so we add the following:\n<p class=\"code_block\">define( &#8216;EP_HOST&#8217;, &#8216;https:\/\/127.0.0.1:9200&#8217; );<\/p>\n<p>If you need help doing so, you may review our article on editing your wp-config.php file.<\/p>\n<\/li>\n<li>Next, you will need to install the ElasticPress plugin. The ElasticPress plugin is available both within the <a href=\"https:\/\/wordpress.org\/plugins\/elasticpress\/\">WordPress plugin directory<\/a>, or within <a href=\"https:\/\/github.com\/10up\/ElasticPress\">GitHub<\/a>. If you want the most updated version, we recommend GitHub.If you need help, you may review our article on installing the ElasticPress plugin.<\/li>\n<li>Of course, Elasticsearch isn&#8217;t doing us any good if we don&#8217;t have any data populated within it. To begin, log into your server via SSH and execute one of the following:<br \/>\n<h3>For single WordPress sites<\/h3>\n<p class=\"code_block\">wp elasticpress index &#8211;setup<\/p>\n<h3>For cross-site search on multisite<\/h3>\n<p class=\"code_block\">wp elasticpress index &#8211;setup &#8211;network-wide<\/p>\n<\/li>\n<\/ol>\n<p>ElasticPress is now running on your site and all searches are now WP_Query is now handling searches with Elasticsearch instead of running MySQL queries for your data. For more information on ElasticPress, check out the <a href=\"https:\/\/github.com\/10up\/ElasticPress\">ElasticPress GitHub page<\/a>.<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve ever used Elasticsearch for managing your searchable content, you know that it is incredibly fast and scalable. If you&#8217;re a WordPress user, you likely also know that obtaining WP_Query objects can sometimes have a negaitve impact on your resource usage if you have a large database of center to search from. Thankfully, 10up<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\"> Read More ><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4325,56],"tags":[],"class_list":["post-3484","post","type-post","status-publish","format-standard","hentry","category-wordpress-hosting","category-wordpress"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Elasticsearch is the perfect replacement for WordPress&#039; default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Elasticsearch is the perfect replacement for WordPress&#039; default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-05T18:54:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T02:55:57+00:00\" \/>\n<meta name=\"author\" content=\"Jeff Matson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Matson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\"},\"author\":{\"name\":\"Jeff Matson\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/83776252b196c020e4352a3796e5642b\"},\"headline\":\"Integrating Elasticsearch with WordPress using ElasticPress\",\"datePublished\":\"2015-01-05T18:54:38+00:00\",\"dateModified\":\"2021-08-17T02:55:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\"},\"wordCount\":358,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"WordPress Hosting\",\"WordPress Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\",\"name\":\"Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2015-01-05T18:54:38+00:00\",\"dateModified\":\"2021-08-17T02:55:57+00:00\",\"description\":\"Elasticsearch is the perfect replacement for WordPress' default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Integrating Elasticsearch with WordPress using ElasticPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/83776252b196c020e4352a3796e5642b\",\"name\":\"Jeff Matson\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/jeffma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting","description":"Elasticsearch is the perfect replacement for WordPress' default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/","og_locale":"en_US","og_type":"article","og_title":"Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting","og_description":"Elasticsearch is the perfect replacement for WordPress' default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2015-01-05T18:54:38+00:00","article_modified_time":"2021-08-17T02:55:57+00:00","author":"Jeff Matson","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Jeff Matson","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/"},"author":{"name":"Jeff Matson","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/83776252b196c020e4352a3796e5642b"},"headline":"Integrating Elasticsearch with WordPress using ElasticPress","datePublished":"2015-01-05T18:54:38+00:00","dateModified":"2021-08-17T02:55:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/"},"wordCount":358,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["WordPress Hosting","WordPress Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/","name":"Integrating Elasticsearch with WordPress using ElasticPress | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2015-01-05T18:54:38+00:00","dateModified":"2021-08-17T02:55:57+00:00","description":"Elasticsearch is the perfect replacement for WordPress' default search implementation. In this article, we will show you how to integrate Elasticsearch into WordPress with ElasticPress.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/integrating-elasticsearch-with-wordpress-using-elasticpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Integrating Elasticsearch with WordPress using ElasticPress"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/83776252b196c020e4352a3796e5642b","name":"Jeff Matson","url":"https:\/\/www.inmotionhosting.com\/support\/author\/jeffma\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":56,"name":"WordPress Tutorials","slug":"wordpress","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3484"}],"version-history":[{"count":5,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3484\/revisions"}],"predecessor-version":[{"id":84144,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3484\/revisions\/84144"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}