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); }
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); }