@@ -55,7 +55,6 @@ public FieldMapping GetMapping(string field, bool followAlias = false)
55
55
56
56
if ( _mappingCache . TryGetValue ( field , out var mapping ) )
57
57
{
58
-
59
58
if ( followAlias && mapping . Found && mapping . Property is FieldAliasProperty fieldAlias )
60
59
{
61
60
_logger . LogTrace ( "Cached alias mapping: {Field}={FieldPath}:{FieldType}" , field , mapping . FullPath , mapping . Property ? . Type ) ;
@@ -126,6 +125,7 @@ public FieldMapping GetMapping(string field, bool followAlias = false)
126
125
127
126
// coded properties sometimes have null Name properties
128
127
string name = fieldMapping . TryGetName ( ) ;
128
+ // TODO: ?
129
129
// if (name == null && fieldMapping is IPropertyWithClrOrigin clrOrigin && clrOrigin.ClrOrigin != null)
130
130
// name = new PropertyName(clrOrigin.ClrOrigin);
131
131
@@ -502,7 +502,7 @@ public static ElasticMappingResolver Create<T>(Func<TypeMappingDescriptor<T>, Ty
502
502
logger . LogTrace ( "GetMapping: {Request}" , response . GetRequest ( false , true ) ) ;
503
503
504
504
// use first returned mapping because index could have been an index alias
505
- var mapping = response . Indices . Values . FirstOrDefault ( ) ? . Mappings ;
505
+ var mapping = response . Mappings . FirstOrDefault ( ) . Value ? . Mappings ;
506
506
return mapping ;
507
507
} , logger ) ;
508
508
}
@@ -518,7 +518,7 @@ public static ElasticMappingResolver Create<T>(Func<TypeMappingDescriptor<T>, Ty
518
518
logger . LogTrace ( "GetMapping: {Request}" , response . GetRequest ( false , true ) ) ;
519
519
520
520
// use first returned mapping because index could have been an index alias
521
- var mapping = response . Indices . Values . FirstOrDefault ( ) ? . Mappings ;
521
+ var mapping = response . Mappings . FirstOrDefault ( ) . Value ? . Mappings ;
522
522
return mapping ;
523
523
} , logger ) ;
524
524
}
@@ -529,21 +529,21 @@ public static ElasticMappingResolver Create<T>(Func<TypeMappingDescriptor<T>, Ty
529
529
return new ElasticMappingResolver ( codeMapping , inferrer , getMapping , logger : logger ) ;
530
530
}
531
531
532
- public static ElasticMappingResolver Create < T > ( ElasticsearchClient client , ILogger logger = null )
533
- {
534
- logger ??= NullLogger . Instance ;
532
+ public static ElasticMappingResolver Create < T > ( ElasticsearchClient client , ILogger logger = null )
533
+ {
534
+ logger ??= NullLogger . Instance ;
535
535
536
- return Create ( ( ) =>
537
- {
538
- client . Indices . Refresh ( Indices . Index < T > ( ) ) ;
539
- var response = client . Indices . GetMapping ( new GetMappingRequest ( Indices . Index < T > ( ) ) ) ;
540
- logger . LogTrace ( "GetMapping: {Request}" , response . GetRequest ( false , true ) ) ;
536
+ return Create ( ( ) =>
537
+ {
538
+ client . Indices . Refresh ( Indices . Index < T > ( ) ) ;
539
+ var response = client . Indices . GetMapping ( new GetMappingRequest ( Indices . Index < T > ( ) ) ) ;
540
+ logger . LogTrace ( "GetMapping: {Request}" , response . GetRequest ( false , true ) ) ;
541
541
542
- // use first returned mapping because index could have been an index alias
543
- var mapping = response . Indices . Values . FirstOrDefault ( ) ? . Mappings ;
544
- return mapping ;
545
- } , client . Infer , logger ) ;
546
- }
542
+ // use first returned mapping because index could have been an index alias
543
+ var mapping = response . Mappings . FirstOrDefault ( ) . Value ? . Mappings ;
544
+ return mapping ;
545
+ } , client . Infer , logger ) ;
546
+ }
547
547
548
548
public static ElasticMappingResolver Create ( ElasticsearchClient client , string index , ILogger logger = null )
549
549
{
@@ -556,7 +556,7 @@ public static ElasticMappingResolver Create(ElasticsearchClient client, string i
556
556
logger . LogTrace ( "GetMapping: {Request}" , response . GetRequest ( false , true ) ) ;
557
557
558
558
// use first returned mapping because index could have been an index alias
559
- var mapping = response . Indices . Values . FirstOrDefault ( ) ? . Mappings ;
559
+ var mapping = response . Mappings . FirstOrDefault ( ) . Value ? . Mappings ;
560
560
return mapping ;
561
561
} , client . Infer , logger ) ;
562
562
}
0 commit comments