{"id":1218430,"date":"2017-01-13T15:26:21","date_gmt":"2017-01-13T23:26:21","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/"},"modified":"2017-01-13T15:26:21","modified_gmt":"2017-01-13T23:26:21","slug":"looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/","title":{"rendered":"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s"},"content":{"rendered":"<p>We&#8217;ve long had problem with large number of recurring events bringing things to a crawl and I (Jon Brown, not Jen) am again trying to find a scalable solution&#8230;<\/p>\n<p>Has anyone setup ElasticSearch w\/ ElasticPress to handle The Event Calendars&#8217; ugly queries against EventStart and EventEnd?<\/p>\n<p>Setting up ElasticSearch \/ ElasticPress is trivial, done that several times&#8230; integrating with TEC is the question here.<\/p>\n<p>I&#8217;m specifically concerned by TEC&#8217;s Tribe__Events__Query class which is a beast and getting it to use ElasticPress for all it&#8217;s queries? ElasticPress has near complete coverage for WP_Query, but I have no idea how it line up with Tribe__Events__Query.  <\/p>\n<p>FWIW, I tried an initial stab at. ElasticPress is up and working fine for search, but I couldn&#8217;t get it work for regular tribe_events queries reliably.<\/p>\n<p>This (crude code, that ended up not working anyway) was what I was trying:<\/p>\n<pre><code>function mt_elasticsearch_tribe_events_query($query) {\n\tif ( ( $query-&gt;query[&#039;post_type&#039;] == &#039;tribe_events&#039;  ) ) {\n\t   $query-&gt;set(&#039;ep_integrate&#039;, true);\n\t}\n}\nadd_action(&#039;pre_get_posts&#039;, &#039;mt_elasticsearch_tribe_events_query&#039;);<\/code><\/pre>\n<p>Any help\/guidance would be appreciated at this point.  <\/p>\n<p>Thanks,<br \/>\nJon Brown<br \/>\n9seeds<\/p>\n","protected":false},"template":"","class_list":["post-1218430","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -\" \/>\n<meta property=\"og:description\" content=\"We&#8217;ve long had problem with large number of recurring events bringing things to a crawl and I (Jon Brown, not Jen) am again trying to find a scalable solution&#8230; Has anyone setup ElasticSearch w\/ ElasticPress to handle The Event Calendars&#8217; ugly queries against EventStart and EventEnd? Setting up ElasticSearch \/ ElasticPress is trivial, done that [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/\",\"name\":\"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-01-13T23:26:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -","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:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/","og_locale":"en_US","og_type":"article","og_title":"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -","og_description":"We&#8217;ve long had problem with large number of recurring events bringing things to a crawl and I (Jon Brown, not Jen) am again trying to find a scalable solution&#8230; Has anyone setup ElasticSearch w\/ ElasticPress to handle The Event Calendars&#8217; ugly queries against EventStart and EventEnd? Setting up ElasticSearch \/ ElasticPress is trivial, done that [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/","name":"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-01-13T23:26:21+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/looking-at-elasticsearch-elasticpress-to-fix-slow-queriestimeouts502s\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Looking at ElasticSearch \/ ElasticPress to fix slow queries\/timeouts\/502s"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1218430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1218430\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1218430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}