Skip to content

Commit f45f15f

Browse files
[Backport 7.6] Deprecate index soft delete enabled setting (#4418)
Relates: #4341, elastic/elasticsearch#50502 This commit marks the enabled setting on soft delete index settings as obsolete, as setting enabled to false is deprecated. Co-authored-by: Russ Cam <[email protected]>
1 parent 9a08447 commit f45f15f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Nest/IndexModules/IndexSettings/Settings/IndexSettingsFormatter.cs

+4
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ void Set(string knownKey, object newValue)
123123
Set(RoutingPartitionSize, indexSettings.RoutingPartitionSize);
124124
if (indexSettings.SoftDeletes != null)
125125
{
126+
#pragma warning disable 618
126127
Set(SoftDeletesEnabled, indexSettings.SoftDeletes.Enabled);
128+
#pragma warning restore 618
127129
Set(SoftDeletesRetentionOperations, indexSettings.SoftDeletes.Retention?.Operations);
128130
}
129131

@@ -259,7 +261,9 @@ private static void SetKnownIndexSettings(ref JsonReader reader, IJsonFormatterR
259261
Set<bool?>(s, settings, QueriesCacheEnabled, v => queriesCache.Enabled = v, formatterResolver);
260262

261263
var softDeletes = s.SoftDeletes = new SoftDeleteSettings();
264+
#pragma warning disable 618
262265
Set<bool?>(s, settings, SoftDeletesEnabled, v => softDeletes.Enabled = v, formatterResolver);
266+
#pragma warning restore 618
263267
var softDeletesRetention = s.SoftDeletes.Retention = new SoftDeleteRetentionSettings();
264268
Set<long?>(s, settings, SoftDeletesEnabled, v => softDeletesRetention.Operations = v, formatterResolver);
265269

src/Nest/IndexModules/IndexSettings/SoftDeletes/ISoftDeleteSettings.cs

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace Nest
44
{
55
public interface ISoftDeleteSettings
66
{
7+
[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
78
/// <summary> Enables soft deletes on the index</summary>
89
bool? Enabled { get; set; }
910
/// <summary> Configure the retention of soft deletes on the index</summary>
@@ -15,6 +16,7 @@ public class SoftDeleteSettings : ISoftDeleteSettings
1516
/// <inheritdoc see cref="ISoftDeleteSettings.Retention"/>
1617
public ISoftDeleteRetentionSettings Retention { get; set; }
1718

19+
[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
1820
/// <inheritdoc see cref="ISoftDeleteSettings.Enabled"/>
1921
public bool? Enabled { get; set; }
2022
}
@@ -28,6 +30,7 @@ public class SoftDeleteSettingsDescriptor : DescriptorBase<SoftDeleteSettingsDes
2830
public SoftDeleteSettingsDescriptor Retention(Func<SoftDeleteRetentionSettingsDescriptor, ISoftDeleteRetentionSettings> selector) =>
2931
Assign(selector.Invoke(new SoftDeleteRetentionSettingsDescriptor()), (a, v) => a.Retention = v);
3032

33+
[Obsolete("Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. Do not set a value of 'false'")]
3134
/// <inheritdoc see cref="ISoftDeleteSettings.Enabled"/>
3235
public SoftDeleteSettingsDescriptor Enabled(bool? enabled = true) => Assign(enabled, (a, v) => a.Enabled = v);
3336
}

tests/Tests/XPack/CrossClusterReplication/CrossClusterReplicationFollowTests.cs

-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public CrossClusterReplicationFollowTests(XPackCluster cluster, EndpointUsage us
5454
NumberOfReplicas = 0,
5555
SoftDeletes = new SoftDeleteSettings
5656
{
57-
Enabled = true,
5857
Retention = new SoftDeleteRetentionSettings { Operations = 1024 }
5958
}
6059
}
@@ -63,7 +62,6 @@ public CrossClusterReplicationFollowTests(XPackCluster cluster, EndpointUsage us
6362
.NumberOfShards(1)
6463
.NumberOfReplicas(0)
6564
.SoftDeletes(sd => sd
66-
.Enabled()
6765
.Retention(r => r.Operations(1024))
6866
)
6967
),

0 commit comments

Comments
 (0)