Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ indent_size = 4
[*.markdown]
indent_style = spaces
indent_size = 2

[*.json]
indent_style = spaces
indent_size = 2
12 changes: 12 additions & 0 deletions src/Nest/Domain/Mapping/Descriptors/BinaryMappingDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Nest.Resolvers;

Expand All @@ -25,5 +26,16 @@ public BinaryMappingDescriptor<T> IndexName(string indexName)
return this;
}

public BinaryMappingDescriptor<T> CopyTo(params string[] fields)
{
this._Mapping.CopyTo = fields.Select(f => (PropertyPathMarker)f);
return this;
}

public BinaryMappingDescriptor<T> CopyTo(params Expression<Func<T, object>>[] objectPaths)
{
this._Mapping.CopyTo = objectPaths.Select(e => (PropertyPathMarker)e);
return this;
}
}
}
11 changes: 11 additions & 0 deletions src/Nest/Domain/Mapping/Descriptors/BooleanMappingDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Nest.Resolvers;

Expand Down Expand Up @@ -52,6 +53,16 @@ public BooleanMappingDescriptor<T> IncludeInAll(bool includeInAll = true)
return this;
}

public BooleanMappingDescriptor<T> CopyTo(params string[] fields)
{
this._Mapping.CopyTo = fields.Select(f => (PropertyPathMarker)f);
return this;
}

public BooleanMappingDescriptor<T> CopyTo(params Expression<Func<T, object>>[] objectPaths)
{
this._Mapping.CopyTo = objectPaths.Select(e => (PropertyPathMarker)e);
return this;
}
}
}
14 changes: 13 additions & 1 deletion src/Nest/Domain/Mapping/Descriptors/StringMappingDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System;
using System.Linq;
using System.Linq.Expressions;
using Nest.Resolvers;

Expand Down Expand Up @@ -92,5 +93,16 @@ public StringMappingDescriptor<T> PositionOffsetGap(int positionOffsetGap)
return this;
}

public StringMappingDescriptor<T> CopyTo(params string[] fields)
{
this._Mapping.CopyTo = fields.Select(f => (PropertyPathMarker)f);
return this;
}

public StringMappingDescriptor<T> CopyTo(params Expression<Func<T, object>>[] objectPaths)
{
this._Mapping.CopyTo = objectPaths.Select(e => (PropertyPathMarker)e);
return this;
}
}
}
3 changes: 3 additions & 0 deletions src/Nest/Domain/Mapping/Types/BinaryMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ public class BinaryMapping : IElasticType, IElasticCoreType
/// </summary>
[JsonProperty("index_name")]
public string IndexName { get; set; }

[JsonProperty("copy_to")]
public IEnumerable<PropertyPathMarker> CopyTo { get; set; }
}
}
2 changes: 2 additions & 0 deletions src/Nest/Domain/Mapping/Types/BooleanMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ public class BooleanMapping : IElasticType, IElasticCoreType
[JsonProperty("include_in_all")]
public bool? IncludeInAll { get; set; }

[JsonProperty("copy_to")]
public IEnumerable<PropertyPathMarker> CopyTo { get; set; }
}
}
6 changes: 4 additions & 2 deletions src/Nest/Domain/Mapping/Types/StringMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public class StringMapping : IElasticType, IElasticCoreType
public bool? IncludeInAll { get; set; }

[JsonProperty("position_offset_gap")]
public int? PositionOffsetGap { get; set; }

public int? PositionOffsetGap { get; set; }

[JsonProperty("copy_to")]
public IEnumerable<PropertyPathMarker> CopyTo { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public void MapFluentFull()
.Store()
.TermVector(TermVectorOption.with_positions_offsets)
.Boost(1.1)
.CopyTo(p => p.Content)
)
.Number(s => s
.Name(p => p.LOC)
Expand Down
21 changes: 11 additions & 10 deletions src/Tests/Nest.Tests.Unit/Core/Map/Properties/BinaryProperty.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"elasticsearchprojects": {
"properties": {
"myBinaryField": {
"type": "binary",
"index_name": "binz"
}
}
}
}
{
"elasticsearchprojects": {
"properties": {
"myBinaryField": {
"type": "binary",
"index_name": "binz",
"copy_to": [ "another_field" ]
}
}
}
}
31 changes: 16 additions & 15 deletions src/Tests/Nest.Tests.Unit/Core/Map/Properties/BooleanProperty.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"elasticsearchprojects": {
"properties": {
"boolValue": {
"type": "boolean",
"index_name": "bool_name_in_lucene_index",
"store": "yes",
"index": "analyzed",
"boost": 1.4,
"null_value": false,
"include_in_all": true
}
}
}
}
{
"elasticsearchprojects": {
"properties": {
"boolValue": {
"type": "boolean",
"index_name": "bool_name_in_lucene_index",
"store": "yes",
"index": "analyzed",
"boost": 1.4,
"null_value": false,
"include_in_all": true,
"copy_to": [ "content" ]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void StringProperty()
.Store()
.TermVector(TermVectorOption.with_positions_offsets)
.Boost(1.1)
.CopyTo(p => p.Content, p => p.Country)
)
)
);
Expand Down Expand Up @@ -88,6 +89,7 @@ public void BooleanProperty()
.IndexName("bool_name_in_lucene_index")
.NullValue(false)
.Store()
.CopyTo(p => p.Content)
)
)
);
Expand All @@ -101,6 +103,7 @@ public void BinaryProperty()
.Binary(s => s
.Name(p => p.MyBinaryField)
.IndexName("binz")
.CopyTo("another_field")
)
)
);
Expand Down
43 changes: 22 additions & 21 deletions src/Tests/Nest.Tests.Unit/Core/Map/Properties/StringProperty.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"elasticsearchprojects": {
"properties": {
"name": {
"type": "string",
"index_name": "my_crazy_name_i_want_in_lucene",
"store": "yes",
"index": "analyzed",
"term_vector": "with_positions_offsets",
"boost": 1.1,
"null_value": "my_special_null_value",
"omit_norms": true,
"index_options": "positions",
"index_analyzer": "standard",
"search_analyzer": "standard",
"include_in_all": true,
"position_offset_gap": 1
}
}
}
}
{
"elasticsearchprojects": {
"properties": {
"name": {
"type": "string",
"index_name": "my_crazy_name_i_want_in_lucene",
"store": "yes",
"index": "analyzed",
"term_vector": "with_positions_offsets",
"boost": 1.1,
"null_value": "my_special_null_value",
"omit_norms": true,
"index_options": "positions",
"index_analyzer": "standard",
"search_analyzer": "standard",
"include_in_all": true,
"position_offset_gap": 1,
"copy_to": [ "content", "country" ]
}
}
}
}