@Override protected ShardUpgradeResult shardOperation(UpgradeRequest request, ShardRouting shardRouting) { IndexShard indexShard = indicesService .indexServiceSafe(shardRouting.shardId().getIndex()) .shardSafe(shardRouting.shardId().id()); org.apache.lucene.util.Version oldestLuceneSegment = indexShard.upgrade(request); // We are using the current version of Elasticsearch as upgrade version since we update mapping // to match the current version return new ShardUpgradeResult( shardRouting.shardId(), indexShard.routingEntry().primary(), Version.CURRENT, oldestLuceneSegment); }