10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.25k stars 312 forks source link

QUESTION: ElasticPress works only for logged in users #2556

Closed chris-boyle24 closed 2 years ago

chris-boyle24 commented 2 years ago

Running ElasticPress latest on Wordpress 5.7.4 with W3TotalCache. EP is attached to an external ElasticSearch server running 7.16 on an AWS EC2 instance. Was able to index 45,000+ posts after some issues and EP Debug indicates all is working - but only when logged in. We have an issue with search going through Wordpress' built-in search and not through ElasticPress. This seems to happen when the search is performed by a non-logged in user - you can see the (rather ugly...) search query in MySQL SHOW FULLPROCESSLIST results.

W3 Total Cache has "Don't cache pages for logged in users enabled" checked and Cache URIs with query string parameters unchecked under its General Settings. We use page cache, object and browser cache with Memcached (database caching is disabled). I've also specifically blocked search.php and /?s=* under never cache the following pages.

I'm assuming that when users are logged in, W3TC is being bypassed allowing ElasticPress to handle search. Non-logged in user requests are processed through W3TC which intercepts / interferes with WP_Query requests somewhere, even with the above settings in place. Is there anywhere else in W3TC (or Wordpress) I should be looking at?

oscarssanchez commented 2 years ago

Hi @chris-boyle24 ,

This seems to be working for me locally. I tested using elasticpress.io and trying a query while not logged in, in incognito mode. In general I don't recall having an issue with cache, but also don't recall specifically working with W3TC. Have you tried disabling W3TC to narrow the problem down to it?

chris-boyle24 commented 2 years ago

Hi,

If I disable W3TC all search requests go through ElasticSearch. As with most sites, we need caching in place for performance reasons.

Chris

On Tue, Jan 18, 2022 at 7:47 PM Oscar Sanchez S. @.***> wrote:

Hi @chris-boyle24 https://github.com/chris-boyle24 ,

This seems to be working for me locally. I tested using elasticpress.io and trying a query while not logged in, in incognito mode. In general I don't recall having an issue with cache, but also don't recall specifically working with W3TC. Have you tried disabling W3TC to narrow the problem down to it?

— Reply to this email directly, view it on GitHub https://github.com/10up/ElasticPress/issues/2556#issuecomment-1015968308, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDWLNONEPQM4YLU65ANGU3UWYC2JANCNFSM5MDGVKSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

oscarssanchez commented 2 years ago

Hi @chris-boyle24 ,

I just tried activating W3TotalCache and it seems it is working for me. Can you please share as much information as you can for us to try to reproduce the problem? Our bug report template is a good example of useful information for us:

https://github.com/10up/ElasticPress/issues/new?assignees=&labels=bug&template=1-bug-report.md&title=BUG%3A+

Thanks!

github-actions[bot] commented 2 years ago

This issue has been automatically closed because there has been no response to our request for more information. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. See this blog post on bug reports and the importance of repro steps for more information about the kind of information that may be helpful.