diff --git a/src/modules/Elsa.Elasticsearch/Extensions/ElasticExtensions.cs b/src/modules/Elsa.Elasticsearch/Extensions/ElasticExtensions.cs index 0d71616dc..a407ea691 100644 --- a/src/modules/Elsa.Elasticsearch/Extensions/ElasticExtensions.cs +++ b/src/modules/Elsa.Elasticsearch/Extensions/ElasticExtensions.cs @@ -45,11 +45,11 @@ public static class ElasticExtensions if (indexExists) continue; var response = client.Indices.Create(indexName, s => s - .Aliases(a => a.Alias(aliasName))); + .Aliases(a => a.Alias(aliasName)) + .Map(m => m.AutoMap(type))); if (response.IsValid) continue; throw response.OriginalException; - } } } \ No newline at end of file diff --git a/src/modules/Elsa.Scheduling/Jobs/ConfigureElasticIndicesJob.cs b/src/modules/Elsa.Scheduling/Jobs/ConfigureElasticIndicesJob.cs index 3a09518ce..925557af9 100644 --- a/src/modules/Elsa.Scheduling/Jobs/ConfigureElasticIndicesJob.cs +++ b/src/modules/Elsa.Scheduling/Jobs/ConfigureElasticIndicesJob.cs @@ -29,10 +29,11 @@ public class ConfigureElasticIndicesJob : Job var indexExists = (await client.Indices.ExistsAsync(newIndexName)).Exists; if (indexExists) continue; - // Point the alias to the new index + // Point the alias to the new writable index await client.Indices.BulkAliasAsync(aliases => aliases .Remove(a => a.Alias(aliasPointingCurrentIndex).Index(currentIndexName)) - .Add(a => a.Alias(aliasPointingCurrentIndex).Index(newIndexName))); + .Add(a => a.Alias(aliasPointingCurrentIndex).Index(currentIndexName).IsWriteIndex(false)) + .Add(a => a.Alias(aliasPointingCurrentIndex).Index(newIndexName).IsWriteIndex())); } } } \ No newline at end of file