@@ -11,9 +11,13 @@ namespace Nest
11
11
[ JsonObject ( MemberSerialization . OptIn ) ]
12
12
public interface IGenericProperty : IDocValuesProperty
13
13
{
14
- [ JsonProperty ( "index" ) ]
14
+ [ JsonIgnore ]
15
+ [ Obsolete ( "Please use Indexed. Will be fixed in NEST 7.x" ) ]
15
16
FieldIndexOption ? Index { get ; set ; }
16
17
18
+ [ JsonProperty ( "index" ) ]
19
+ bool ? Indexed { get ; set ; }
20
+
17
21
[ JsonProperty ( "term_vector" ) ]
18
22
TermVectorOption ? TermVector { get ; set ; }
19
23
@@ -52,6 +56,8 @@ public interface IGenericProperty : IDocValuesProperty
52
56
[ DebuggerDisplay ( "{DebugDisplay}" ) ]
53
57
public class GenericProperty : DocValuesPropertyBase , IGenericProperty
54
58
{
59
+ private FieldIndexOption ? _index ;
60
+
55
61
public GenericProperty ( ) : base ( FieldType . Object ) => this . TypeOverride = null ;
56
62
57
63
public TermVectorOption ? TermVector { get ; set ; }
@@ -60,7 +66,31 @@ public class GenericProperty : DocValuesPropertyBase, IGenericProperty
60
66
public int ? IgnoreAbove { get ; set ; }
61
67
public int ? PositionIncrementGap { get ; set ; }
62
68
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 ; }
64
94
public string NullValue { get ; set ; }
65
95
public bool ? Norms { get ; set ; }
66
96
public IndexOptions ? IndexOptions { get ; set ; }
@@ -82,7 +112,31 @@ public class GenericPropertyDescriptor<T>
82
112
: DocValuesPropertyDescriptorBase < GenericPropertyDescriptor < T > , IGenericProperty , T > , IGenericProperty
83
113
where T : class
84
114
{
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 ; }
86
140
TermVectorOption ? IGenericProperty . TermVector { get ; set ; }
87
141
double ? IGenericProperty . Boost { get ; set ; }
88
142
string IGenericProperty . NullValue { get ; set ; }
@@ -98,12 +152,16 @@ public class GenericPropertyDescriptor<T>
98
152
99
153
public GenericPropertyDescriptor < T > Type ( string type ) => Assign ( a => this . TypeOverride = type ) ;
100
154
155
+ [ Obsolete ( "Please use the overload that accepts bool?. Will be fixed in NEST 7.x" ) ]
101
156
public GenericPropertyDescriptor < T > Index ( FieldIndexOption ? index = FieldIndexOption . NotAnalyzed ) => Assign ( a => a . Index = index ) ;
102
157
158
+ public GenericPropertyDescriptor < T > Index ( bool ? index = true ) => Assign ( a => a . Indexed = index ) ;
159
+
103
160
public GenericPropertyDescriptor < T > Boost ( double ? boost ) => Assign ( a => a . Boost = boost ) ;
104
161
105
162
public GenericPropertyDescriptor < T > NullValue ( string nullValue ) => Assign ( a => a . NullValue = nullValue ) ;
106
163
164
+ [ Obsolete ( "Deprecated. Will be removed in NEST 7.x" ) ]
107
165
public GenericPropertyDescriptor < T > NotAnalyzed ( ) => Index ( FieldIndexOption . NotAnalyzed ) ;
108
166
109
167
public GenericPropertyDescriptor < T > TermVector ( TermVectorOption ? termVector ) => Assign ( a => a . TermVector = termVector ) ;
0 commit comments