@Override protected EmptyResult shardOperation(OptimizeRequest request, ShardRouting shardRouting) { IndexShard indexShard = indicesService .indexServiceSafe(shardRouting.shardId().getIndex()) .shardSafe(shardRouting.shardId().id()); indexShard.optimize(request); return EmptyResult.INSTANCE; }