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