@@ -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
@@ -56,6 +60,8 @@ public interface IGenericProperty : IDocValuesProperty
5660 [ DebuggerDisplay ( "{DebugDisplay}" ) ]
5761 public class GenericProperty : DocValuesPropertyBase , IGenericProperty
5862 {
63+ private FieldIndexOption ? _index ;
64+
5965#pragma warning disable 618
6066 public GenericProperty ( ) : base ( null ) { }
6167#pragma warning restore 618
@@ -68,7 +74,31 @@ public GenericProperty() : base(null) { }
6874 public int ? IgnoreAbove { get ; set ; }
6975 public int ? PositionIncrementGap { get ; set ; }
7076 public IStringFielddata Fielddata { get ; set ; }
71- public FieldIndexOption ? Index { get ; set ; }
77+
78+ [ Obsolete ( "Please use Indexed. Will be fixed in NEST 7.x" ) ]
79+ public FieldIndexOption ? Index
80+ {
81+ get => _index ;
82+ set
83+ {
84+ _index = value ;
85+ switch ( _index )
86+ {
87+ case FieldIndexOption . Analyzed :
88+ case FieldIndexOption . NotAnalyzed :
89+ Indexed = true ;
90+ break ;
91+ case FieldIndexOption . No :
92+ Indexed = false ;
93+ break ;
94+ default :
95+ Indexed = null ;
96+ break ;
97+ }
98+ }
99+ }
100+
101+ public bool ? Indexed { get ; set ; }
72102 public string NullValue { get ; set ; }
73103 public bool ? Norms { get ; set ; }
74104 public IndexOptions ? IndexOptions { get ; set ; }
@@ -85,7 +115,31 @@ public class GenericPropertyDescriptor<T>
85115 : DocValuesPropertyDescriptorBase < GenericPropertyDescriptor < T > , IGenericProperty , T > , IGenericProperty
86116 where T : class
87117 {
88- FieldIndexOption ? IGenericProperty . Index { get ; set ; }
118+ private FieldIndexOption ? _index ;
119+
120+ FieldIndexOption ? IGenericProperty . Index
121+ {
122+ get => _index ;
123+ set
124+ {
125+ _index = value ;
126+ switch ( _index )
127+ {
128+ case FieldIndexOption . Analyzed :
129+ case FieldIndexOption . NotAnalyzed :
130+ Self . Indexed = true ;
131+ break ;
132+ case FieldIndexOption . No :
133+ Self . Indexed = false ;
134+ break ;
135+ default :
136+ Self . Indexed = null ;
137+ break ;
138+ }
139+ }
140+ }
141+
142+ bool ? IGenericProperty . Indexed { get ; set ; }
89143 TermVectorOption ? IGenericProperty . TermVector { get ; set ; }
90144 double ? IGenericProperty . Boost { get ; set ; }
91145 string IGenericProperty . NullValue { get ; set ; }
@@ -105,15 +159,19 @@ public GenericPropertyDescriptor() : base(null) { }
105159
106160 public GenericPropertyDescriptor < T > Type ( string type ) => Assign ( a => a . Type = type ) ;
107161
162+ [ Obsolete ( "Please use the overload that accepts bool?. Will be fixed in NEST 7.x" ) ]
108163 public GenericPropertyDescriptor < T > Index ( FieldIndexOption ? index = FieldIndexOption . NotAnalyzed ) => Assign ( a => a . Index = index ) ;
109164
165+ public GenericPropertyDescriptor < T > Index ( bool ? index = true ) => Assign ( a => a . Indexed = index ) ;
166+
110167 public GenericPropertyDescriptor < T > Boost ( double boost ) => Assign ( a => a . Boost = boost ) ;
111168
112169 public GenericPropertyDescriptor < T > NullValue ( string nullValue ) => Assign ( a => a . NullValue = nullValue ) ;
113170
114171 /// <remarks>Removed in 6.x</remarks>
115172 public GenericPropertyDescriptor < T > IncludeInAll ( bool includeInAll = true ) => Assign ( a => a . IncludeInAll = includeInAll ) ;
116173
174+ [ Obsolete ( "Deprecated. Will be removed in NEST 7.x" ) ]
117175 public GenericPropertyDescriptor < T > NotAnalyzed ( ) => Index ( FieldIndexOption . NotAnalyzed ) ;
118176
119177 public GenericPropertyDescriptor < T > Index ( FieldIndexOption index ) => Assign ( a => a . Index = index ) ;
0 commit comments