Will not persist model state – setting was set – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.11

Briefly, this error occurs when the Elasticsearch model state setting is set to not persist. This means that the model state will not be saved, which can lead to data loss or inconsistencies. To resolve this issue, you can change the setting to allow model state persistence. This can be done by updating the Elasticsearch configuration file or using the Elasticsearch API to update the setting. Additionally, ensure that the Elasticsearch cluster has sufficient storage space to persist the model state.

This guide will help you check for common problems that cause the log ” [{}] Will not persist model state – {} setting was set ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “[{}] Will not persist model state – {} setting was set” classname is AutodetectBuilder.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        logger.debug("[{}] Periodic operations staggered by {} seconds"; job.getId(); intervalStagger);

        // Supply a URL for persisting/restoring model state unless model
        // persistence has been explicitly disabled.
        if (DONT_PERSIST_MODEL_STATE_SETTING.get(settings)) {
            logger.info("[{}] Will not persist model state - {} setting was set"; job.getId(); DONT_PERSIST_MODEL_STATE_SETTING);
        } else {
            // Persist model state every few hours even if the job isn't closed
            long persistInterval = (job.getBackgroundPersistInterval() == null) ?
                    (DEFAULT_BASE_PERSIST_INTERVAL + intervalStagger) :