diff --git a/src/Nest/Domain/Mapping/Descriptors/StringMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/StringMappingDescriptor.cs index 0ff05c4c710..715645cafd3 100644 --- a/src/Nest/Domain/Mapping/Descriptors/StringMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/StringMappingDescriptor.cs @@ -18,6 +18,12 @@ public StringMappingDescriptor Name(Expression> objectPath) { this._Mapping.Name = objectPath; return this; + } + + public StringMappingDescriptor Similarity(string similarity) + { + this._Mapping.Similarity = similarity; + return this; } public StringMappingDescriptor IndexName(string indexName) diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs index bf9ce48a2c9..8d70a8a1dfd 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs @@ -126,6 +126,7 @@ public void MapFluentFull() .Properties(props => props .String(s => s .Name(p => p.Name) + .Similarity("mysimilarity") .IndexName("my_crazy_name_i_want_in_lucene") .IncludeInAll() .Index(FieldIndexOption.analyzed) diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs index a39808ab4d3..ee74f874d10 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs @@ -15,7 +15,8 @@ public void StringProperty() var result = this._client.Map(m => m .Properties(props => props .String(s => s - .Name(p => p.Name) + .Name(p => p.Name) + .Similarity("mysimilarity") .IndexName("my_crazy_name_i_want_in_lucene") .IncludeInAll() .Index(FieldIndexOption.analyzed) diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/StringProperty.json b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/StringProperty.json index 6de8a26790f..d1b2510329b 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/StringProperty.json +++ b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/StringProperty.json @@ -3,6 +3,7 @@ "properties": { "name": { "type": "string", + "similarity": "mysimilarity", "index_name": "my_crazy_name_i_want_in_lucene", "store": "yes", "index": "analyzed",