Skip to content

Commit 5576423

Browse files
authored
Fix 5.x obsolete warnings (#3217)
This commit fixes the compile warnings from the introduction of ObsoleteAttribute to methods and types that are removed in 6.x.
1 parent 37a34e0 commit 5576423

File tree

67 files changed

+400
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+400
-192
lines changed

src/CodeGeneration/DocGenerator/Buildalyzer/Environment/FrameworkEnvironment.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ namespace DocGenerator.Buildalyzer.Environment
3232
{
3333
internal class FrameworkEnvironment : BuildEnvironment
3434
{
35-
private readonly bool _sdkProject;
36-
3735
public string ToolsPath { get; }
3836
public string ExtensionsPath { get; }
3937
public string SDKsPath { get; }

src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public TopHitsAggregationDescriptor<T> Highlight(Func<HighlightDescriptor<T>, IH
124124
public TopHitsAggregationDescriptor<T> ScriptFields(Func<ScriptFieldsDescriptor, IPromise<IScriptFields>> scriptFieldsSelector) =>
125125
Assign(a => a.ScriptFields = scriptFieldsSelector?.Invoke(new ScriptFieldsDescriptor())?.Value);
126126

127+
[Obsolete("Removed in NEST 6.x")]
127128
public TopHitsAggregationDescriptor<T> FielddataFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
128129
Assign(a => a.FielddataFields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);
129130

src/Nest/Document/Multiple/Bulk/BulkResponseItem/BulkDeleteResponseItem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public class BulkDeleteResponseItem : BulkResponseItemBase
1010
public override string Operation { get; internal set; }
1111

1212
[JsonProperty("found")]
13-
1413
[Obsolete("Removed in 6.0.")]
1514
public bool Found { get; internal set; }
1615
}

src/Nest/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateRequest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public partial class PutIndexTemplateDescriptor
4343

4444
public PutIndexTemplateDescriptor Version(int version) => Assign(a => a.Version = version);
4545

46+
[Obsolete("Removed in NEST 6.x.")]
4647
public PutIndexTemplateDescriptor Template(string template)=> Assign(a => a.Template = template);
4748

4849
public PutIndexTemplateDescriptor Settings(Func<IndexSettingsDescriptor, IPromise<IIndexSettings>> settingsSelector) =>

src/Nest/Mapping/Types/Properties.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public partial interface IPropertiesDescriptor<T, out TReturnType>
5151
TReturnType Date(Func<DatePropertyDescriptor<T>, IDateProperty> selector);
5252
TReturnType Boolean(Func<BooleanPropertyDescriptor<T>, IBooleanProperty> selector);
5353
TReturnType Binary(Func<BinaryPropertyDescriptor<T>, IBinaryProperty> selector);
54+
[Obsolete("Removed in Elasticsearch 6.0, please consider using the ingest-attachment plugin.")]
5455
TReturnType Attachment(Func<AttachmentPropertyDescriptor<T>, IAttachmentProperty> selector);
5556
TReturnType Object<TChild>(Func<ObjectTypeDescriptor<T, TChild>, IObjectProperty> selector)
5657
where TChild : class;
@@ -99,6 +100,7 @@ public PropertiesDescriptor() : base(new Properties<T>()) { }
99100

100101
public PropertiesDescriptor<T> Binary(Func<BinaryPropertyDescriptor<T>, IBinaryProperty> selector) => SetProperty(selector);
101102

103+
[Obsolete("Removed in Elasticsearch 6.0, please consider using the ingest-attachment plugin.")]
102104
public PropertiesDescriptor<T> Attachment(Func<AttachmentPropertyDescriptor<T>, IAttachmentProperty> selector) => SetProperty(selector);
103105

104106
public PropertiesDescriptor<T> Object<TChild>(Func<ObjectTypeDescriptor<T, TChild>, IObjectProperty> selector)

src/Nest/Mapping/Types/PropertyJsonConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
6666
case FieldType.GeoShape:
6767
return jObject.ToObject<GeoShapeProperty>();
6868
case FieldType.Attachment:
69+
#pragma warning disable 618
6970
return jObject.ToObject<AttachmentProperty>();
71+
#pragma warning restore 618
7072
case FieldType.Completion:
7173
return jObject.ToObject<CompletionProperty>();
7274
case FieldType.TokenCount:

src/Nest/Mapping/Visitor/IMappingVisitor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public interface IMappingVisitor
1919
void Visit(IIpProperty property);
2020
void Visit(IGeoPointProperty property);
2121
void Visit(IGeoShapeProperty property);
22+
#pragma warning disable 618
2223
void Visit(IAttachmentProperty property);
24+
#pragma warning restore 618
2325
void Visit(INumberProperty property);
2426
void Visit(ICompletionProperty property);
2527
void Visit(IMurmur3HashProperty property);
@@ -64,7 +66,9 @@ public virtual void Visit(IGeoPointProperty property) { }
6466

6567
public virtual void Visit(IGeoShapeProperty property) { }
6668

69+
#pragma warning disable 618
6770
public virtual void Visit(IAttachmentProperty property) { }
71+
#pragma warning restore 618
6872

6973
public virtual void Visit(ICompletionProperty property) { }
7074

src/Nest/Mapping/Visitor/IPropertyVisitor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public interface IPropertyVisitor
1717
void Visit(IObjectProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
1818
void Visit(IGeoPointProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
1919
void Visit(IGeoShapeProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
20+
#pragma warning disable 618
2021
void Visit(IAttachmentProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
22+
#pragma warning restore 618
2123
void Visit(ICompletionProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
2224
void Visit(IIpProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);
2325
void Visit(IMurmur3HashProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute);

src/Nest/Mapping/Visitor/MappingWalker.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public void Accept(IProperties properties)
149149
});
150150
break;
151151
case FieldType.Attachment:
152+
#pragma warning disable 618
152153
this.Visit<IAttachmentProperty>(field, t =>
154+
#pragma warning restore 618
153155
{
154156
this._visitor.Visit(t);
155157
this.Accept(t.Fields);

src/Nest/Mapping/Visitor/NoopPropertyVisitor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ public virtual void Visit(IIpProperty type, PropertyInfo propertyInfo, Elasticse
3636
{
3737
}
3838

39+
#pragma warning disable 618
3940
public virtual void Visit(IAttachmentProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute)
4041
{
4142
}
43+
#pragma warning restore 618
4244

4345
public virtual void Visit(IGeoPointProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute)
4446
{
@@ -100,8 +102,10 @@ public void Visit(IProperty type, PropertyInfo propertyInfo, ElasticsearchProper
100102
if (type is IKeywordProperty keywordType)
101103
Visit(keywordType, propertyInfo, attribute);
102104

105+
#pragma warning disable 618
103106
if (type is IAttachmentProperty attachmentType)
104107
Visit(attachmentType, propertyInfo, attribute);
108+
#pragma warning restore 618
105109

106110
if (type is IGeoShapeProperty geoShapeType)
107111
Visit(geoShapeType, propertyInfo, attribute);

0 commit comments

Comments
 (0)