-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-indexing terms on update (ex: slug) #750
Comments
Definitely something we know about but have not fixed. I would love to see a PR for this :) |
not same issue but we handled some edge cases like this before by extending WP-CLI commands. |
@tlovett1 have you discussed switching to a nested queries style? Reading their docs about joining queries, nested queries should be designed to scale better than "normal" relations and the way I see it, then I can only agree. We would get another index called Both ES2 and ES5 have nested query support: |
@kallehauge we have not. However, that would be a huge change. |
I completely agree @tlovett1 - but the way I see it then there are 2 options:
Okay.. there is a 3. solution but this still doesn't scale very well:
What I've written here is something I looked up some time ago so take it as inspiration for areas to look into instead of actual facts. But, in my head, the ideal scenario would be something like relationships handled like this: Term create: We cannot assume that all terms are created on the terms page. Ex: tags created directly in on posts. But I guess this isn't a real issue since they still go through the same |
@tlovett1 have you given this any additional thought? We have some clients that are still not THAT happy with the workflow of having to re-index their entire site when they alter terms, so I might be willing to slowly start building this feature in the near future if we can agree on a model |
@kallehauge |
See #1443 |
Now that #1443 is merged, are there any plans to revisit this? Term deletions are also affected because posts remain indexed with now-deleted term and continue to match queries for it. The scaling concerns raised in this thread are valid when many thousands of posts are attached to a single term - what if EP found all posts using the affected term, and if the count was over a threshold, it scheduled N async cron jobs to reindex those remaining posts (perhaps passing post ids to the cron job). Alternatively, it could flag the posts as "needs reindex" in meta, or a better, a custom taxonomy, and have a recurring cron job that auto re-indexes those posts flagged as "dirty". Having this sort of system would be useful for more than just terms - any post that needed to be reindexed asynchronously could be flagged as such (such as during bulk operations), then cron would always be looking for them, achieving eventual consistency. |
Now that #2603 is merged we can go ahead and close this one. Thank you all! |
Re-indexing terms on update (ex: slug)
Case
Hello ppl! A client changed a slug for a public term today and went to the new URL and no results showed up. What happens, like you probably know, is that the sync-manager only looks for changes on
posts
and notterms
.Why is this a problem?
A lot of 3. party plugins use
slug
's fortax_query
's and this would make it fail because Elasticsearch still holds the old slug.Although it would be possible to hook into
pre_get_posts
and alter thetax_query
to fetch withterm_id
's. I feel like this solution would have a lot of edge-cases and it would makeElasticPress
less "out of the box" ready – The worst case scenario is that archives/lists completely fail due to this.I've looked in the the API and it's only possible to re-index entire posts which is extremely slow/heavy since it has to get and prepare all posts before and, in this example, there might be several thousand products for a term.
The question
Is this a scenario you have discussed before? And/or is it something you wish to support? If yes, then I already have some ideas of how this could be done and I would happily supply some of my time to cooperate on a PR.
In the meantime: have any of you done a workaround for this, previously? If yes, then I would be very interested in hearing how you handled it 😄
/ Best regards
The text was updated successfully, but these errors were encountered: