Whats the time lapse for updates to get indexed on Elastic Search

(sairam) #1

We are trying to Implement Elastic Search on our WordPress site. So far it looks great but we couldn't find anywhere about the time lapse for new updates on the WordPress site to get indexed. Does the new updates get indexed automatically or do we have to run the index command on WP-CLI every time the site is updated?

We are using ElasticPress plugin from Wordpress to connect with Kibana(elasticsearch).

Thanks in advance.

(Greg Ichneumon Brown) #2

It looks like ElasticPress re-indexes posts pretty much immediately (plus the one second for the default Elasticsearch refresh time).

One issue you could be running into is what type of change you are making to your content. The list of actions that trigger reindexing is here: https://github.com/10up/ElasticPress/blob/5d5ca292cd09420396a831ae5e2cfea34da8463a/classes/class-ep-sync-manager.php#L35

I don't see any mention of terms (tags/categories/etc) changes triggering reindexing, so changes for those may require WP-CLI. This isn't particularly surprising btw, if you change a tag/category you'd then have to bulk reindex all of the posts that have that same term applied which can be a very time intensive operation for some sites.

(sairam) #3

Thank you @gibrown .

Like you mentioned above, the indexing is pretty much immediate. Apart from categories and tags the auto indexing also fails for some of the custom post types. I am guessing it has some thing to do with the way we have created those custom post types. Do you know any scenario or reason why the indexing fails for custom post types.

(Greg Ichneumon Brown) #4

Is your custom post type not registered as public? Or does it use a post_status that is not "publish"?

See https://github.com/10up/ElasticPress/blob/81f29b9efb2b1620a089c718dbf1483af28f46c6/classes/class-ep-config.php#L141

(sairam) #5

A typical scenario is, when changing the post which is in 'draft' status to 'publish' wont show up in search results . Also, a newly created post( status as publish ) won't show up in search results and that happens only for certain post_types.

Note: we haven't tried re-indexing the site after initial indexing. To first index our site we ran WP-CLI command, wp elasticpress index --setup --url=

(Greg Ichneumon Brown) #6

Oh, interesting. On our WP setup, we also trigger off of transition_post_status, but for some reason ElasticPress does not. So for instance if a plugin calls wp_transition_post_status() directly, then the wp_insert_post action that seems to be what EP uses won't get triggered.

Based on inspection, I think it may be a bug, but it is tough to track through all possible cases without debugging. And I am not sure why this would happen for custom post types only unless there is something about the plugin that it is associated with.

I'd debug by adding some error logging to wp_insert_post() and wp_transition_post_status() to see when they are getting triggered.

(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.