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

[Feature] purgeOldIndices raise exception if closing indices isn't allowed on the cluster #49

Open
ThibautSF opened this issue Nov 4, 2020 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@ThibautSF
Copy link

ThibautSF commented Nov 4, 2020

The Close API doc says :

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. Closing indices can be disabled via the cluster settings API by setting cluster.indices.close.enable to false. The default is true.

Some clusters may have the default value of cluster.indices.close.enable set to false.
Which can produce this kind of exception :
Uncaught Elastica\\Exception\\ResponseException: closing indices is disabled - set [cluster.indices.close.enable: true] to enable it. NOTE: closed indices still consume a significant amount of diskspace

Some ideas:

  • check if the closing indices parameter is true before trying to close it (if false then just continue)
  • add a way to set cluster.indices.close.enable to true before closing (and reset it to it's previous state after)
    • either : add a "forceCloseMode" parameter to purgeOldIndices
    • or/and : add method to set/unset a setting param

Besides, the Cluster Update Settings API doc gives the following order of precedence:

  1. transient cluster settings
  2. persistent cluster settings
  3. settings in the elasticsearch.yml configuration file.

Then my actual code to do this force mode on my side

$mycluster = new Cluster($client);
$mysettings = $mycluster->getSettings();

$oldParam = $mysettings->getTransient('cluster.indices.close.enable');

if (true !== $oldParam) {
    $mysettings->setTransient('cluster.indices.close.enable', true);
}
$indexBuilder->purgeOldIndices($indexname);
if (true !== $oldParam) {
    $mysettings->setTransient('cluster.indices.close.enable', $oldParam);
}
@damienalexandre damienalexandre changed the title purgeOldIndices raise exception if closing indices isn't allowed on the cluster. [Feature] purgeOldIndices raise exception if closing indices isn't allowed on the cluster. Nov 13, 2024
@damienalexandre damienalexandre changed the title [Feature] purgeOldIndices raise exception if closing indices isn't allowed on the cluster. [Feature] purgeOldIndices raise exception if closing indices isn't allowed on the cluster Nov 13, 2024
@damienalexandre damienalexandre added the help wanted Extra attention is needed label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants