Elasticpress: v3.2.6, Stuck syncing

Created on 9 Dec 2019  路  10Comments  路  Source: 10up/ElasticPress

Describe the bug

Started indexing via command line and am getting this error with your elasticpress plugin:

Adding post mapping...
Success: Mapping sent
Indexing posts...
Processed 185/185...
PHP Notice: Indirect modification of overloaded element of WP_Hook has no effect in /var/www/public/wp-content/plugins/elasticpress/includes/classes/Command.php on line 1192
Notice: Indirect modification of overloaded element of WP_Hook has no effect in /var/www/public/wp-content/plugins/elasticpress/includes/classes/Command.php on line 1192
Processed 535/185...
PHP Notice: Indirect modification of overloaded element of WP_Hook has no effect in /var/www/public/wp-content/plugins/elasticpress/includes/classes/Command.php on line 1192
Notice: Indirect modification of overloaded element of WP_Hook has no effect in /var/www/public/wp-content/plugins/elasticpress/includes/classes/Command.php on line 1192
Processed 885/185...

So, syncing will not complete and, I believe, this is why the system is not using elasticsearch for system-wide search.

Steps to Reproduce

  1. Go to '...' Command Line Interface
  2. Click on '....' Run Command: wp elasticpress index --setup
  3. Scroll down to '....' See Errors listed above, system gets stuck in loop
  4. See error

Expected behavior

Screenshots

Environment information

  • Device: Vagrant VM on Mac
  • OS: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-166-generic x86_64)
  • Browser and version:
  • Plugins and version: My version of ElasticPress is: Version 3.2.6
  • Theme and version:
  • Other installed plugin(s) and version(s): ElasticSearch

{
"name" : "YRpCygo",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "EVqKu0xBQ4Sx95utSmBEzg",
"version" : {
"number" : "6.8.5",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "78990e9",
"build_date" : "2019-11-13T20:04:24.100411Z",
"build_snapshot" : false,
"lucene_version" : "7.7.2",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

Additional context

Found another issue reported:

https://github.com/10up/ElasticPress/issues/722

that led me to paste into my functions.php file the following add_action():

add_action('ep_wp_cli_pre_index', function($args, $assoc_args){
wp_suspend_cache_addition(true);
wp_suspend_cache_invalidation(true);
// @see https://wordpress.stackexchange.com/questions/102349/faster-way-to-wp-insert-post-add-post-meta-in-bulk
wp_defer_term_counting(true);
wp_defer_comment_counting(true);
}, 100, 2);

I re-ran indexing via CLI, now I get no PHP Notice, but the indexing posts still get stuck and it seems to be indexing more than the number of posts I have to index. Here is part of my CLI output:

Adding post mapping...
Success: Mapping sent
Indexing posts...
Processed 185/185...
Processed 535/185...
Processed 885/185...
Processed 1235/185...
Processed 1585/185...
Processed 1935/185...
Processed 2285/185...
Processed 2635/185...
Processed 2985/185...
Processed 3335/185...
Processed 3685/185...
Processed 4035/185...
Processed 4385/185...
Processed 4735/185...
Processed 5085/185...
Processed 5435/185...
Processed 5785/185...
Processed 6135/185...
Processed 6485/185...
Processed 6835/185...
Processed 7185/185...
Processed 7535/185...
Processed 7885/185...
Processed 8235/185...
Processed 8585/185...
Processed 8935/185...
Processed 9285/185...
Processed 9635/185...
Processed 9985/185...
Processed 10335/185...
Processed 10685/185...
Processed 11035/185...
Processed 11385/185...
Processed 11735/185...
Processed 12085/185...

It just continues from here..

bug

Most helpful comment

@mjgrasso we're currently still trying to reproduce this issue. Meanwhile, to answer your question - you can cancel the wp-cli indexing by hitting CTRL-C and then deleting the transient that locks the indexing through wp transient delete ep_wpcli_sync

All 10 comments

Also, what's the command to kill indexing via CLI? This is not clear in the documentation.

Thanks!

@mjgrasso can you please provide the current WP version, theme name (or indicate a custom theme if applicable) and list of plugins currently running on your site?

Also, are you running WP in single site or network mode? Thanks!

WP Version: 5.2.4
Theme: Custom
WP Single Site: Yes
Plugins:

  • ACF: Better Search
  • Admin Menu Editor
  • Advanced Access Manager
  • Advanced Custom Fields PRO
  • All In One WP Security
  • Breadcrumb Trail
  • Broken Link Checker
  • Debug Bar
  • Debug Bar ElasticPress
  • ElasticPress
  • Google Analytics Dashboard for WP (GADWP)
  • iframe
  • Simple 301 Redirects
  • Simple Wp Sitemap
  • User Role Editor
  • WooCommerce
  • WooCommerce Custom Product Data Fields
  • WP Media folder
  • WP Migrate DB
  • WP-Optimize - Clean, Compress, Cache
  • Yoast SEO

@mjgrasso we're currently still trying to reproduce this issue. Meanwhile, to answer your question - you can cancel the wp-cli indexing by hitting CTRL-C and then deleting the transient that locks the indexing through wp transient delete ep_wpcli_sync

@mjgrasso while this is not yet a solution to the root cause of your issue it would be great if you could give this version with a workaround for this issue a try https://github.com/10up/ElasticPress/archive/fix/1590-workaround.zip

Thanks for your help. Unfortunately, the client has too short of a timeline for vetting this solution. We chose to implement Algolia search instead.

I've used ElasticSearch on other projects, I know that it could be the right solution for robust Wordpress search requirements... Ideally, it would be great if ElasticPress was a bit more "devloper friendly".

I was able to get Algolia up and running in a week, with their documentation:

https://www.algolia.com/doc/

They even show you how to create your own custom Wordpress plugin, and I was able to run with it from there, it does exactly what my client requires and will scale to their future needs. I'm only posting all this information here because I think ElasticPress should borrow some best practices from Algolia.

Best of luck!

@mjgrasso I'm sorry we ran into this bug during the indexing process, and I suspect that caused a cascade of issues which caused you to have to do way more debugging than we'd ever want a client to have to experience.

I would say that a week's worth of setup time is far more than most ElasticPress installs require, and our goal is to provide a tool that works "out of the box" rather than requiring any custom work whatsoever.

That said, Algolia certainly contains a robust set of documentation, and our goal is to continue to work on our documentation site: http://10up.github.io/ElasticPress/ and enhance the current hook/filter documentation with use cases and similarly helpful examples.

Appreciate the feedback!

@mjgrasso mind if we email you a few more questions? We really want to solve this one. taylor.[email protected]

Should be fixed in 3.4

Found this thread looking for the same solution.

Was stuck at "ERROR: An index is already occurring. Try again later. even after Ctrl + C.
Clearing the transient did the trick.

Was this page helpful?
0 / 5 - 0 ratings