コード例 #1
0
        public static ITypeMapping GetMappingFor(this GetMappingResponse response, IndexName index)
        {
            if (index.IsNullOrEmpty())
            {
                return(null);
            }

            return(response.Indices.TryGetValue(index, out var indexMappings) ? indexMappings.Mappings : null);
        }
コード例 #2
0
 public static ITypeMapping GetMappingFor(this IGetMappingResponse response, IndexName index)
 {
     if (index.IsNullOrEmpty())
     {
         return(null);
     }
     if (!response.Indices.TryGetValue(index, out var typeMapping))
     {
         return(null);
     }
     return(typeMapping?.Mappings?.FirstOrDefault().Value);
 }
コード例 #3
0
        public static ITypeMapping GetMappingFor(this IGetMappingResponse response, IndexName index, TypeName type)
        {
            if (index.IsNullOrEmpty() || type.IsNullOrEmpty())
            {
                return(null);
            }
            TypeMapping mapping  = null;
            var         hasValue = response.Indices.TryGetValue(index, out var typeMapping) &&
                                   typeMapping?.Mappings != null &&
                                   typeMapping.Mappings.TryGetValue(type, out mapping);

            return(mapping);
        }