11using System ;
2- using System . Collections ;
2+ using System . Collections . Generic ;
33using Newtonsoft . Json ;
44
55namespace Nest
@@ -22,7 +22,7 @@ public class AttachmentProperty : PropertyBase, IAttachmentProperty
2222 {
2323 public AttachmentProperty ( ) : base ( "attachment" ) { }
2424
25- private IDictionary Dictionary => this . Fields ;
25+ private IDictionary < PropertyName , IProperty > Dictionary => this . Fields ?? ( this . Fields = new Properties ( ) ) ;
2626
2727 public IStringProperty AuthorField
2828 {
@@ -50,8 +50,8 @@ public IDateProperty DateField
5050
5151 public IStringProperty FileField
5252 {
53- get { return Dictionary [ "file " ] as IStringProperty ; }
54- set { Dictionary [ "file " ] = value ; }
53+ get { return Dictionary [ "content " ] as IStringProperty ; }
54+ set { Dictionary [ "content " ] = value ; }
5555 }
5656
5757 public IStringProperty KeywordsField
@@ -93,7 +93,7 @@ public class AttachmentPropertyDescriptor<T>
9393 INumberProperty IAttachmentProperty . ContentLengthField { get ; set ; }
9494 IStringProperty IAttachmentProperty . LanguageField { get ; set ; }
9595
96- private IDictionary Dictionary => Self . Fields ;
96+ private IDictionary < PropertyName , IProperty > Dictionary => Self . Fields ?? ( Self . Fields = new Properties ( ) ) ;
9797
9898 public AttachmentPropertyDescriptor ( ) : base ( "attachment" ) { }
9999
@@ -117,7 +117,7 @@ public AttachmentPropertyDescriptor<T> NameField(Func<StringPropertyDescriptor<T
117117 SetMetadataField ( selector , "name" ) ;
118118
119119 public AttachmentPropertyDescriptor < T > FileField ( Func < StringPropertyDescriptor < T > , IStringProperty > selector ) =>
120- SetMetadataField ( selector , "file " ) ;
120+ SetMetadataField ( selector , "content " ) ;
121121
122122 public AttachmentPropertyDescriptor < T > AuthorField ( Func < StringPropertyDescriptor < T > , IStringProperty > selector ) =>
123123 SetMetadataField ( selector , "author" ) ;
@@ -128,10 +128,18 @@ public AttachmentPropertyDescriptor<T> KeywordsField(Func<StringPropertyDescript
128128 public AttachmentPropertyDescriptor < T > ContentTypeField ( Func < StringPropertyDescriptor < T > , IStringProperty > selector ) =>
129129 SetMetadataField ( selector , "content_type" ) ;
130130
131+ [ Obsolete ( "Use ContentLengthField(Func<NumberPropertyDescriptor<T>, INumberProperty> selector)" ) ]
131132 public AttachmentPropertyDescriptor < T > ContentLengthField ( Func < StringPropertyDescriptor < T > , IStringProperty > selector ) =>
132133 SetMetadataField ( selector , "content_length" ) ;
133134
135+ public AttachmentPropertyDescriptor < T > ContentLengthField ( Func < NumberPropertyDescriptor < T > , INumberProperty > selector ) =>
136+ SetMetadataField ( selector , "content_length" ) ;
137+
138+ [ Obsolete ( "Use LanguageField(Func<StringPropertyDescriptor<T>, IStringProperty> selector)" ) ]
134139 public AttachmentPropertyDescriptor < T > LanguageField ( Func < NumberPropertyDescriptor < T > , INumberProperty > selector ) =>
135140 SetMetadataField ( selector , "language" ) ;
141+
142+ public AttachmentPropertyDescriptor < T > LanguageField ( Func < StringPropertyDescriptor < T > , IStringProperty > selector ) =>
143+ SetMetadataField ( selector , "language" ) ;
136144 }
137145}
0 commit comments