Skip to content
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

Delete indices of unused Indexables on a full sync #3261

Merged
merged 12 commits into from
Jan 25, 2023

Conversation

felipeelia
Copy link
Member

@felipeelia felipeelia commented Jan 13, 2023

Description of the Change

Unfortunately, this PR ended up doing more than I anticipated. The main goal of it is to delete indices of features that are no longer enabled. That will happen only if a full sync is performed.

To have that done, I had to differentiate registered and enabled Indexables and also check which indices exist before a sync is started. With that list of indices, it is now possible to send the mapping of an inexistent index, so this PR covers that too.

It also adds an optional --status parameter to the get-indices WP-CLI command. Note: This command outputs the list of indices related to the current site but they don't necessarily exist. The get-cluster-indices outputs the list of indices really present in the ES server.

As I had some problems running Cypress tests on WSL I've also added some instructions to fix those issues.

Closes #3186

How to test the Change

  1. Enable Comments and/or any other feature that creates an index
  2. Run a full sync
  3. See the new index created
  4. Deactivate the feature(s)
  5. Run a full sync
  6. See the indices being deleted

Also

  1. Delete any index of a currently enabled feature
  2. Run a regular sync. See the Index not present. Mapping sent message.

Changelog Entry

Added - new --status parameter to the get-indices WP-CLI command.
Changed - Indices of disabled features will be deleted during a full sync. Mappings of needed but unexistent indices will be added even during a regular sync.

Credits

Props @felipeelia

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@felipeelia felipeelia added this to the 4.5.0 milestone Jan 13, 2023
@felipeelia felipeelia self-assigned this Jan 13, 2023
@felipeelia felipeelia removed their assignment Jan 24, 2023
@felipeelia felipeelia changed the title [WIP] Differentiate active and registered indexables Differentiate active and registered indexables Jan 25, 2023
@felipeelia felipeelia changed the title Differentiate active and registered indexables Delete indices of unused Indexables on a full sync Jan 25, 2023
@felipeelia felipeelia merged commit 6f4e7ff into develop Jan 25, 2023
@felipeelia felipeelia deleted the feature/issue-3186 branch January 25, 2023 13:47
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete indices from deactivated Indexables on a full sync
1 participant