/// <inheritdoc cref="ISearchStore{TDocument}.CreateDocumentType" /> public void CreateDocumentType() { if (_log.IsInfoEnabled) { _log.Info("Create Document type : " + _documentTypeName); } var client = GetClient(); var indexDefinition = new RootObjectMapping { Properties = new Dictionary <PropertyNameMarker, IElasticType>(), Name = _documentTypeName }; foreach (var field in _definition.Fields) { IElasticType elasticType = _factory.GetElasticType(field); if (elasticType != null) { indexDefinition.Properties.Add(field.FieldName, elasticType); } } var res = client.Map <TDocument>(x => x.InitializeUsing(indexDefinition)); res.CheckStatus("Map"); }
private void PrettyPrint(IElasticType type) { var indent = new string('-', (this.Depth + 1) * 2); var typeName = type.Type != null ? type.Type.Name : "root"; var name = type.Name != null ? type.Name.Name : "{default}"; var s = "{0} {1}: {2}".F(indent, name, typeName); this._stringBuilder.AppendLine(s); }
public PropertiesDescriptor <T> Custom(IElasticType customMapping) { customMapping.ThrowIfNull("customMapping"); if (customMapping.Name.IsConditionless()) { throw new Exception("Could not get field name for custom mapping"); } this.Properties.Add(customMapping.Name, customMapping); return(this); }
public static Map <T> Type(IElasticType elasticType) { return(new Map <T>(elasticType)); }
private void MapType(IElasticType elasticType) { this.ElasticType = elasticType; }
private Map(IElasticType elasticType) : this() { this.MapType(elasticType); }