@@ -11,9 +11,13 @@ namespace Nest
1111 [ JsonObject ( MemberSerialization . OptIn ) ]
1212 public interface IGenericProperty : IDocValuesProperty
1313 {
14- [ JsonProperty ( "index" ) ]
14+ [ JsonIgnore ]
15+ [ Obsolete ( "Please use Indexed. Will be fixed in NEST 7.x" ) ]
1516 FieldIndexOption ? Index { get ; set ; }
1617
18+ [ JsonProperty ( "index" ) ]
19+ bool ? Indexed { get ; set ; }
20+
1721 [ JsonProperty ( "term_vector" ) ]
1822 TermVectorOption ? TermVector { get ; set ; }
1923
@@ -52,6 +56,8 @@ public interface IGenericProperty : IDocValuesProperty
5256 [ DebuggerDisplay ( "{DebugDisplay}" ) ]
5357 public class GenericProperty : DocValuesPropertyBase , IGenericProperty
5458 {
59+ private FieldIndexOption ? _index ;
60+
5561 public GenericProperty ( ) : base ( FieldType . Object ) => this . TypeOverride = null ;
5662
5763 public TermVectorOption ? TermVector { get ; set ; }
@@ -60,7 +66,31 @@ public class GenericProperty : DocValuesPropertyBase, IGenericProperty
6066 public int ? IgnoreAbove { get ; set ; }
6167 public int ? PositionIncrementGap { get ; set ; }
6268 public IStringFielddata Fielddata { get ; set ; }
63- public FieldIndexOption ? Index { get ; set ; }
69+
70+ [ Obsolete ( "Please use Indexed. Will be fixed in NEST 7.x" ) ]
71+ public FieldIndexOption ? Index
72+ {
73+ get => _index ;
74+ set
75+ {
76+ _index = value ;
77+ switch ( _index )
78+ {
79+ case FieldIndexOption . Analyzed :
80+ case FieldIndexOption . NotAnalyzed :
81+ Indexed = true ;
82+ break ;
83+ case FieldIndexOption . No :
84+ Indexed = false ;
85+ break ;
86+ default :
87+ Indexed = null ;
88+ break ;
89+ }
90+ }
91+ }
92+
93+ public bool ? Indexed { get ; set ; }
6494 public string NullValue { get ; set ; }
6595 public bool ? Norms { get ; set ; }
6696 public IndexOptions ? IndexOptions { get ; set ; }
@@ -82,7 +112,31 @@ public class GenericPropertyDescriptor<T>
82112 : DocValuesPropertyDescriptorBase < GenericPropertyDescriptor < T > , IGenericProperty , T > , IGenericProperty
83113 where T : class
84114 {
85- FieldIndexOption ? IGenericProperty . Index { get ; set ; }
115+ private FieldIndexOption ? _index ;
116+
117+ FieldIndexOption ? IGenericProperty . Index
118+ {
119+ get => _index ;
120+ set
121+ {
122+ _index = value ;
123+ switch ( _index )
124+ {
125+ case FieldIndexOption . Analyzed :
126+ case FieldIndexOption . NotAnalyzed :
127+ Self . Indexed = true ;
128+ break ;
129+ case FieldIndexOption . No :
130+ Self . Indexed = false ;
131+ break ;
132+ default :
133+ Self . Indexed = null ;
134+ break ;
135+ }
136+ }
137+ }
138+
139+ bool ? IGenericProperty . Indexed { get ; set ; }
86140 TermVectorOption ? IGenericProperty . TermVector { get ; set ; }
87141 double ? IGenericProperty . Boost { get ; set ; }
88142 string IGenericProperty . NullValue { get ; set ; }
@@ -98,12 +152,16 @@ public class GenericPropertyDescriptor<T>
98152
99153 public GenericPropertyDescriptor < T > Type ( string type ) => Assign ( a => this . TypeOverride = type ) ;
100154
155+ [ Obsolete ( "Please use the overload that accepts bool?. Will be fixed in NEST 7.x" ) ]
101156 public GenericPropertyDescriptor < T > Index ( FieldIndexOption ? index = FieldIndexOption . NotAnalyzed ) => Assign ( a => a . Index = index ) ;
102157
158+ public GenericPropertyDescriptor < T > Index ( bool ? index = true ) => Assign ( a => a . Indexed = index ) ;
159+
103160 public GenericPropertyDescriptor < T > Boost ( double ? boost ) => Assign ( a => a . Boost = boost ) ;
104161
105162 public GenericPropertyDescriptor < T > NullValue ( string nullValue ) => Assign ( a => a . NullValue = nullValue ) ;
106163
164+ [ Obsolete ( "Deprecated. Will be removed in NEST 7.x" ) ]
107165 public GenericPropertyDescriptor < T > NotAnalyzed ( ) => Index ( FieldIndexOption . NotAnalyzed ) ;
108166
109167 public GenericPropertyDescriptor < T > TermVector ( TermVectorOption ? termVector ) => Assign ( a => a . TermVector = termVector ) ;
0 commit comments