10up / ElasticPress

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

Help Needed with Elastic Search Integration for Multiple Wordpress ( Not Multisite network) sites Search #3904

Closed sunnydadigs closed 2 months ago

sunnydadigs commented 2 months ago

Describe your question

Hello folks,

We have a requirement to integrate Elastic Search with our 15 Wordpress sites, and we're hoping some guidance on the best practices to achieve this.

Our client would like to index the content of these 15 sites and display the search results on the 16th site (main site). For example, if a user goes to the main site and searches with a query like "men's health," the search results should display any posts related to "men's health", as well as posts from the other sites if available.

To accomplish this, I am considering activating Elastic Search on our server and installing the ElasticPress Wordpress plugin on each individual site to index the content. This way, all the data will be available on Elastic Search to display the search results.

All our Wordpress sites are individual installs and are hosted on the same server.

I would like to know if the approach mentioned above will work, or if there is a better way to achieve the desired outcome. If anyone has experience with a similar setup.

I have already implemented above on a staging environment and even added site__in query parameter to the WP_Query. but it only displays the results from the main site and not displaying results from other sites.

image

Thank you for your assistance.

Code of Conduct

felipeelia commented 2 months ago

If they are not inside the same network, the 'site__in' parameter will not work. You'll have to customize the indices being queried when ElasticPress fires its requests, and also make sure you use what is coming from Elasticsearch, not what is inside WordPress (if a post with ID #13 is found in an external website, EP will try to load post ID #13 from the current website.)

Although that all is doable, it falls outside of what the plugin is intended to do and will require some heavy development efforts.

sunnydadigs commented 2 months ago

Thanks, i was able to sync 2 individual WordPress sites to the same index without any issues.

But, when I search on the site I am only getting the results from that site and not getting any results from the other site.

Is there any reference or sample query which I can use to make this work?

Your guidance would be helpful as there are not many resources available on this topic.

thanks in advance..