Wait until the cluster status is green before promoting new index
@@ -322,10 +322,16 @@ class TableIndexer:
}
}
)
+ # Cluster status will be yellow in development environments because
+ # there will only be one node available. In production, there are many
+ # nodes, and the index should not be promoted until all shards have
+ # been initialized.
+ environment = os.getenv('ENVIRONMENT', 'local')
+ if environment != 'local':
log.info('Waiting for replica shards. . .')
es.cluster.health(
index=write_index,
- wait_for_no_initializing_shards=True,
+ wait_for_status='green',
timeout="2h"
)
# If the index exists already and it's not an alias, delete it.
