File tree Expand file tree Collapse file tree 7 files changed +76
-0
lines changed Expand file tree Collapse file tree 7 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -265,12 +265,20 @@ public PutMappingDescriptor<T> RoutingField(Func<RoutingFieldMappingDescriptor<T
265265 Self . Mapping . RoutingFieldMapping = routingMapper ( new RoutingFieldMappingDescriptor < T > ( ) ) ;
266266 return this ;
267267 }
268+
268269 public PutMappingDescriptor < T > TimestampField ( Func < TimestampFieldMappingDescriptor < T > , ITimestampFieldMapping > timestampMapper )
269270 {
270271 timestampMapper . ThrowIfNull ( "timestampMapper" ) ;
271272 Self . Mapping . TimestampFieldMapping = timestampMapper ( new TimestampFieldMappingDescriptor < T > ( ) ) ;
272273 return this ;
273274 }
275+
276+ public PutMappingDescriptor < T > FieldNamesField ( Func < FieldNamesFieldMappingDescriptor < T > , IFieldNamesFieldMapping > fieldNamesMapper )
277+ {
278+ Self . Mapping . FieldNamesFieldMapping = fieldNamesMapper == null ? null : fieldNamesMapper ( new FieldNamesFieldMappingDescriptor < T > ( ) ) ;
279+ return this ;
280+ }
281+
274282 public PutMappingDescriptor < T > TtlField ( Func < TtlFieldMappingDescriptor , ITtlFieldMapping > ttlFieldMapper )
275283 {
276284 ttlFieldMapper . ThrowIfNull ( "ttlFieldMapper" ) ;
Original file line number Diff line number Diff line change 1+ using System ;
2+ using Newtonsoft . Json ;
3+ using System . Linq . Expressions ;
4+ using Nest . Resolvers . Converters ;
5+
6+ namespace Nest
7+ {
8+ [ JsonConverter ( typeof ( ReadAsTypeConverter < FieldNamesFieldMapping > ) ) ]
9+ public interface IFieldNamesFieldMapping : ISpecialField
10+ {
11+ [ JsonProperty ( "enabled" ) ]
12+ bool Enabled { get ; set ; }
13+ }
14+
15+ public class FieldNamesFieldMapping : IFieldNamesFieldMapping
16+ {
17+ public bool Enabled { get ; set ; }
18+ }
19+
20+
21+ public class FieldNamesFieldMappingDescriptor < T > : IFieldNamesFieldMapping
22+ {
23+ private IFieldNamesFieldMapping Self { get { return this ; } }
24+
25+ bool IFieldNamesFieldMapping . Enabled { get ; set ; }
26+
27+ public FieldNamesFieldMappingDescriptor < T > Enabled ( bool enabled = true )
28+ {
29+ Self . Enabled = enabled ;
30+ return this ;
31+ }
32+
33+ }
34+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ public class RootObjectMapping : ObjectMapping
6565 [ JsonProperty ( "_timestamp" ) ]
6666 public ITimestampFieldMapping TimestampFieldMapping { get ; set ; }
6767
68+ [ JsonProperty ( "_field_names" ) ]
69+ public IFieldNamesFieldMapping FieldNamesFieldMapping { get ; set ; }
70+
6871 [ JsonProperty ( "_ttl" ) ]
6972 public ITtlFieldMapping TtlFieldMappingDescriptor { get ; set ; }
7073
Original file line number Diff line number Diff line change 153153 <Compile Include =" Domain\Geo\MultiPolygonGeoShape.cs" />
154154 <Compile Include =" Domain\Geo\PointGeoShape.cs" />
155155 <Compile Include =" Domain\Geo\PolygonGeoShape.cs" />
156+ <Compile Include =" Domain\Mapping\SpecialFields\FieldNamesMapping.cs" />
156157 <Compile Include =" Domain\Mapping\SubMappings\FieldData\FieldDataFilter.cs" />
157158 <Compile Include =" Domain\Mapping\SubMappings\FieldData\FieldDataFrequencyFilter.cs" />
158159 <Compile Include =" Domain\Mapping\SubMappings\FieldData\FieldDataMapping.cs" />
Original file line number Diff line number Diff line change 1+ using NUnit . Framework ;
2+ using Nest . Tests . MockData . Domain ;
3+ using System . Reflection ;
4+
5+ namespace Nest . Tests . Unit . Core . Map . FieldNamesField
6+ {
7+ [ TestFixture ]
8+ public class FieldNamesFieldTests : BaseJsonTests
9+ {
10+ [ Test ]
11+ public void FieldNamesMapping ( )
12+ {
13+ var result = this . _client . Map < ElasticsearchProject > ( m => m
14+ . FieldNamesField ( a => a . Enabled ( false ) )
15+ ) ;
16+ this . JsonEquals ( result . ConnectionStatus . Request , MethodBase . GetCurrentMethod ( ) ) ;
17+ }
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ {
2+ "elasticsearchprojects" : {
3+ "_field_names" : {
4+ "enabled" : false
5+ }
6+ }
7+ }
Original file line number Diff line number Diff line change 199199 <None Include =" Core\Map\Properties\MultiFieldPropertyWithJustNamePath.json" >
200200 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
201201 </None >
202+ <Compile Include =" Core\Map\FieldNamesField\FieldNamesFieldTests.cs" />
202203 <Compile Include =" Core\MultiPercolate\MultiPercolateTests.cs" />
203204 <Compile Include =" Core\Map\Transform\MappingTansformTests.cs" />
204205 <Compile Include =" Core\Repository\RestoreTests.cs" />
637638 <None Include =" Core\Map\MetaField\MetaFieldSerializes.json" >
638639 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
639640 </None >
641+ <None Include =" Core\Map\FieldNamesField\FieldNamesMapping.json" >
642+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
643+ </None >
640644 <None Include =" Core\Map\Transform\MultipleTransforms.json" >
641645 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
642646 </None >
You can’t perform that action at this time.
0 commit comments