Skip to content

Commit 8156db4

Browse files
authored
Mapping time boost was removed in 7.10 (#5089)
* Mapping time boost was removed in 7.10 This was always a NOOP on the server and was removed from the server. Here we obsolete them with a compiler warning * fix testcase still sending Boost
1 parent bd737f1 commit 8156db4

File tree

19 files changed

+21
-33
lines changed

19 files changed

+21
-33
lines changed

src/Nest/Mapping/Types/Core/Number/NumberAttribute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public NumberAttribute(NumberType type) : base(type.ToFieldType()) { }
1616

1717
public double Boost
1818
{
19+
#pragma warning disable 618
1920
get => Self.Boost.GetValueOrDefault();
2021
set => Self.Boost = value;
22+
#pragma warning restore 618
2123
}
2224

2325
public bool Coerce

src/Nest/Mapping/Types/Core/Number/NumberProperty.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Nest
1616
[InterfaceDataContract]
1717
public interface INumberProperty : IDocValuesProperty
1818
{
19+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
1920
[DataMember(Name = "boost")]
2021
double? Boost { get; set; }
2122

@@ -79,6 +80,7 @@ protected NumberPropertyDescriptorBase(FieldType type) : base(type) { }
7980

8081
public TDescriptor Index(bool? index = true) => Assign(index, (a, v) => a.Index = v);
8182

83+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
8284
public TDescriptor Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
8385

8486
public TDescriptor NullValue(double? nullValue) => Assign(nullValue, (a, v) => a.NullValue = v);

src/Nest/Mapping/Types/Core/Range/RangePropertyAttributeBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ protected RangePropertyAttributeBase(RangeType type) : base(type.ToFieldType())
1010

1111
public double Boost
1212
{
13+
#pragma warning disable 618
1314
get => Self.Boost.GetValueOrDefault();
1415
set => Self.Boost = value;
16+
#pragma warning restore 618
1517
}
1618

1719
public bool Coerce

src/Nest/Mapping/Types/Core/Range/RangePropertyBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using System;
56
using System.Runtime.Serialization;
67
using Elasticsearch.Net.Utf8Json;
78

@@ -13,6 +14,7 @@ public interface IRangeProperty : IDocValuesProperty
1314
/// <summary>
1415
/// Mapping field-level query time boosting. Accepts a floating point number, defaults to 1.0.
1516
/// </summary>
17+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
1618
[DataMember(Name ="boost")]
1719
double? Boost { get; set; }
1820

@@ -59,6 +61,7 @@ protected RangePropertyDescriptorBase(RangeType type) : base(type.ToFieldType())
5961
public TDescriptor Coerce(bool? coerce = true) => Assign(coerce, (a, v) => a.Coerce = v);
6062

6163
/// <inheritdoc cref="IRangeProperty.Boost" />
64+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
6265
public TDescriptor Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
6366

6467
/// <inheritdoc cref="IRangeProperty.Index" />

src/Nest/Mapping/Types/Specialized/Ip/IpAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using System;
6+
57
namespace Nest
68
{
79
public class IpAttribute : ElasticsearchDocValuesPropertyAttributeBase, IIpProperty
810
{
911
public IpAttribute() : base(FieldType.Ip) { }
1012

13+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
1114
public double Boost
1215
{
1316
get => Self.Boost.GetValueOrDefault();

src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using System;
56
using System.Diagnostics;
67
using System.Runtime.Serialization;
78
using Elasticsearch.Net.Utf8Json;
@@ -14,6 +15,7 @@ namespace Nest
1415
[InterfaceDataContract]
1516
public interface IIpProperty : IDocValuesProperty
1617
{
18+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
1719
[DataMember(Name ="boost")]
1820
double? Boost { get; set; }
1921

@@ -49,6 +51,7 @@ public IpPropertyDescriptor() : base(FieldType.Ip) { }
4951

5052
public IpPropertyDescriptor<T> Index(bool? index = true) => Assign(index, (a, v) => a.Index = v);
5153

54+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
5255
public IpPropertyDescriptor<T> Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
5356

5457
public IpPropertyDescriptor<T> NullValue(string nullValue) => Assign(nullValue, (a, v) => a.NullValue = v);

src/Nest/Mapping/Types/Specialized/TokenCount/TokenCountAttribute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public string Analyzer
1616

1717
public double Boost
1818
{
19+
#pragma warning disable 618
1920
get => Self.Boost.GetValueOrDefault();
2021
set => Self.Boost = value;
22+
#pragma warning restore 618
2123
}
2224

2325
public bool Index

src/Nest/Mapping/Types/Specialized/TokenCount/TokenCountProperty.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using System;
56
using System.Diagnostics;
67
using System.Runtime.Serialization;
78
using Elasticsearch.Net.Utf8Json;
@@ -18,6 +19,7 @@ public interface ITokenCountProperty : IDocValuesProperty
1819
[DataMember(Name ="analyzer")]
1920
string Analyzer { get; set; }
2021

22+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
2123
[DataMember(Name ="boost")]
2224
double? Boost { get; set; }
2325

@@ -58,6 +60,7 @@ public TokenCountPropertyDescriptor() : base(FieldType.TokenCount) { }
5860

5961
public TokenCountPropertyDescriptor<T> Analyzer(string analyzer) => Assign(analyzer, (a, v) => a.Analyzer = v);
6062

63+
[Obsolete("The server always treated this as a noop and has been removed in 7.10")]
6164
public TokenCountPropertyDescriptor<T> Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
6265

6366
public TokenCountPropertyDescriptor<T> Index(bool? index = true) => Assign(index, (a, v) => a.Index = v);

tests/Tests/ClientConcepts/Troubleshooting/DebuggerDisplayTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ [U] public void TaskId()
132132
public void MappingProperties()
133133
{
134134
var nested = new NestedProperty() { Name = "hello" };
135-
var ip = new IpPropertyDescriptor<Project>().Name("field").Boost(2);
135+
var ip = new IpPropertyDescriptor<Project>().Name("field");
136136

137137
DebugFor(nested).Should().StartWith("Type: nested");
138138
DebugFor(ip).Should().StartWith("Type: ip");

tests/Tests/Mapping/Types/Core/Number/NumberPropertyTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public NumberPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
2525
similarity = "BM25",
2626
store = true,
2727
index = false,
28-
boost = 1.5,
2928
null_value = 0.0,
3029
ignore_malformed = true,
3130
coerce = true
@@ -41,7 +40,6 @@ public NumberPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
4140
.Similarity("BM25")
4241
.Store()
4342
.Index(false)
44-
.Boost(1.5)
4543
.NullValue(0.0)
4644
.IgnoreMalformed()
4745
.Coerce()
@@ -57,7 +55,6 @@ public NumberPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(
5755
Similarity = "BM25",
5856
Store = true,
5957
Index = false,
60-
Boost = 1.5,
6158
NullValue = 0.0,
6259
IgnoreMalformed = true,
6360
Coerce = true
@@ -82,7 +79,6 @@ public ScaledFloatNumberPropertyTests(WritableCluster cluster, EndpointUsage usa
8279
similarity = "BM25",
8380
store = true,
8481
index = false,
85-
boost = 1.5,
8682
null_value = 0.0,
8783
ignore_malformed = true,
8884
coerce = true
@@ -99,7 +95,6 @@ public ScaledFloatNumberPropertyTests(WritableCluster cluster, EndpointUsage usa
9995
.Similarity("BM25")
10096
.Store()
10197
.Index(false)
102-
.Boost(1.5)
10398
.NullValue(0.0)
10499
.IgnoreMalformed()
105100
.Coerce()
@@ -116,7 +111,6 @@ public ScaledFloatNumberPropertyTests(WritableCluster cluster, EndpointUsage usa
116111
Similarity = "BM25",
117112
Store = true,
118113
Index = false,
119-
Boost = 1.5,
120114
NullValue = 0.0,
121115
IgnoreMalformed = true,
122116
Coerce = true

0 commit comments

Comments
 (0)