ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

QUESTION: EP 3.5.6 on WP Multisite, concurrent syncs?

Open swiftcommike opened this issue 4 years ago • 3 comments

Describe your question Environment ElasticPress 3.5.6 on WordPress 5.6.2 13 subsites (newspapers) News organization importing content with WP All Import and indexing with Elastic.

Question Can we run more than one index sync at a time? If so, how? If not, why not?

Why do I ask? We can't index posts with EP during import because the import process handles multiple posts at a time, which means that the first post import starts syncing, and the second and third post imports can't index because a sync is already occurring. So, if we could have multiple syncs at a time, this would resolve the issue.

Our workaround is to use the WP CLI 5 minutes after importing We use $wp query to get the last 5 posts in the db and pass those to the $wp elasticpress command with the --include option. This is also an issue, because often times "A sync is already occurring" So, my next step is to stop indexing with the wp cli, delete the EP transient with the wp cli, then run my script above to fetch and index.

It's a rabbit hole, and if there were a way to run multiple indexes at a time, this issue wouldn't exist.

Thanks. BTW, if it helps anyone else, here's the write-up. Let me know if it's not okay to post external links in here if that's the case. https://medium.com/p/1c71fd695d3a

swiftcommike avatar Mar 14 '22 18:03 swiftcommike

Hi @swiftcommike,

Posts should've been indexed to Elasticsearch while WP All Import is creating them and you should not need to call anything for that. As far as I can see in their code, it could be prevented if:

  1. You have Fast Mode enabled (the Increase speed by disabling do_action calls in wp_insert_post during import. option) and/or
  2. You have turned on the Enable WP_IMPORTING option.

Do you have any of those options enabled? Also, ElasticPress 3.5.6 was released one year ago, is there any specific reason that is preventing you to update it? Thanks.

felipeelia avatar Mar 14 '22 19:03 felipeelia

Hey @felipeelia, Thank you for your reply and for looking into this with me. I'm not experienced with Elastic yet, so I've approached our problem with an inexperienced solution. We plan to update to the latest, but we will need to rebuild indexes afterward. Since my experience is limited, and we're limited in staff, I'm hesitant to upgrade until I can upgrade in a dev environment first.

1 and 2 Yes, I see that we have both enabled. The "increase speed" is enabled for that specific import setting -> advanced and the WP_IMPORTING option is enabled in the WP All Import -> Settings.

Thanks for pointing me in the direction to head.

swiftcommike avatar Mar 14 '22 19:03 swiftcommike

No problem @swiftcommike, I'm happy to help. I'm going ahead and closing out this issue now but feel free to reopen/open a new one if you disable both options and still face any problems. Thanks

felipeelia avatar Mar 15 '22 11:03 felipeelia