Adding segment to be upgraded – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.17

Briefly, this error occurs when Elasticsearch identifies a segment within an index that is using an older format and needs to be upgraded to the current version. This is not necessarily a problem, but rather an informational message indicating that an upgrade process is taking place. To resolve this, you can allow the upgrade process to complete. If it’s causing performance issues, consider scheduling segment upgrades during off-peak hours. Alternatively, you can reindex the old indices to the latest version to avoid segment upgrades.

This guide will help you check for common problems that cause the log ” Adding segment {} to be upgraded ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, shard.

Log Context

Log “Adding segment {} to be upgraded” classname is ElasticsearchMergePolicy.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                if (shouldUpgrade(info)) {

                    // TODO: Use IndexUpgradeMergePolicy instead. We should be comparing codecs;
                    // for now we just assume every minor upgrade has a new format.
                    logger.debug("Adding segment {} to be upgraded"; info.info.name);
                    spec.add(new OneMerge(Collections.singletonList(info)));
                }

                // TODO: we could check IndexWriter.getMergingSegments and avoid adding merges that IW will just reject?

 

 [ratemypost]