Skip to content

Commit 6e07203

Browse files
russcamMpdreamz
authored andcommitted
Add include_in_all to TypeMapping (#2431)
Closes #2421 Conflicts: src/Nest/Mapping/TypeMapping.cs
1 parent 6732b0d commit 6e07203

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal PutMappingRequest() { }
2121
/// <inheritdoc/>
2222
public bool? DateDetection { get; set; }
2323
/// <inheritdoc/>
24+
public bool? IncludeInAll { get; set; }
25+
/// <inheritdoc/>
2426
public IEnumerable<string> DynamicDateFormats { get; set; }
2527
/// <inheritdoc/>
2628
public IDynamicTemplateContainer DynamicTemplates { get; set; }
@@ -73,6 +75,8 @@ public PutMappingRequest() : this(typeof(T), typeof(T)) { }
7375
/// <inheritdoc/>
7476
public bool? DateDetection { get; set; }
7577
/// <inheritdoc/>
78+
public bool? IncludeInAll { get; set; }
79+
/// <inheritdoc/>
7680
public IEnumerable<string> DynamicDateFormats { get; set; }
7781
/// <inheritdoc/>
7882
public IDynamicTemplateContainer DynamicTemplates { get; set; }
@@ -125,6 +129,7 @@ public PutMappingDescriptor(IndexName index, TypeName type) : base(r=>r.Required
125129

126130
IAllField ITypeMapping.AllField { get; set; }
127131
bool? ITypeMapping.DateDetection { get; set; }
132+
bool? ITypeMapping.IncludeInAll { get; set; }
128133
IEnumerable<string> ITypeMapping.DynamicDateFormats { get; set; }
129134
string ITypeMapping.Analyzer { get; set; }
130135
string ITypeMapping.SearchAnalyzer { get; set; }
@@ -169,6 +174,9 @@ public PutMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int maxR
169174
/// <inheritdoc/>
170175
public PutMappingDescriptor<T> Dynamic(bool dynamic = true) => this.Dynamic(dynamic ? DynamicMapping.Allow : DynamicMapping.Ignore);
171176

177+
/// <inheritdoc/>
178+
public PutMappingDescriptor<T> IncludeInAll(bool include = true) => Assign(a => a.IncludeInAll = include);
179+
172180
/// <inheritdoc/>
173181
public PutMappingDescriptor<T> Parent(TypeName parentType) => Assign(a => a.ParentField = new ParentField { Type = parentType });
174182

src/Nest/Mapping/TypeMapping.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public interface ITypeMapping
2222
[Obsolete("Deprecated in 2.0.0 Removed in 5.0.0")]
2323
IList<IMappingTransform> Transform { get; set; }
2424

25+
[JsonProperty("include_in_all")]
26+
bool? IncludeInAll { get; set; }
27+
2528
[JsonProperty("analyzer")]
2629
string Analyzer { get; set; }
2730

@@ -82,6 +85,8 @@ public class TypeMapping : ITypeMapping
8285
/// <inheritdoc/>
8386
public DynamicMapping? Dynamic { get; set; }
8487
/// <inheritdoc/>
88+
public bool? IncludeInAll { get; set; }
89+
/// <inheritdoc/>
8590
public IEnumerable<string> DynamicDateFormats { get; set; }
8691
/// <inheritdoc/>
8792
public IDynamicTemplateContainer DynamicTemplates { get; set; }
@@ -123,6 +128,7 @@ public class TypeMappingDescriptor<T> : DescriptorBase<TypeMappingDescriptor<T>,
123128
IAllField ITypeMapping.AllField { get; set; }
124129
string ITypeMapping.Analyzer { get; set; }
125130
bool? ITypeMapping.DateDetection { get; set; }
131+
bool? ITypeMapping.IncludeInAll { get; set; }
126132
DynamicMapping? ITypeMapping.Dynamic { get; set; }
127133
IEnumerable<string> ITypeMapping.DynamicDateFormats { get; set; }
128134
IDynamicTemplateContainer ITypeMapping.DynamicTemplates { get; set; }
@@ -161,6 +167,9 @@ public TypeMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int max
161167
/// <inheritdoc/>
162168
public TypeMappingDescriptor<T> Dynamic(bool dynamic = true) => this.Dynamic(dynamic ? DynamicMapping.Allow : DynamicMapping.Ignore);
163169

170+
/// <inheritdoc/>
171+
public TypeMappingDescriptor<T> IncludeInAll(bool include = true) => Assign(a => a.IncludeInAll = include);
172+
164173
/// <inheritdoc/>
165174
public TypeMappingDescriptor<T> Parent(TypeName parentType) => Assign(a => a.ParentField = new ParentField { Type = parentType });
166175

src/Tests/Indices/MappingManagement/PutMapping/PutMappingApiTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected override LazyResponses ClientUsage() => Calls(
2929

3030
protected override object ExpectJson { get; } = new
3131
{
32+
include_in_all = true,
3233
properties = new
3334
{
3435
curatedTags = new
@@ -160,6 +161,7 @@ protected override LazyResponses ClientUsage() => Calls(
160161

161162
protected override Func<PutMappingDescriptor<Project>, IPutMappingRequest> Fluent => d => d
162163
.Index(CallIsolatedValue)
164+
.IncludeInAll()
163165
.AutoMap()
164166
.Properties(prop => prop
165167
.Number(n => n
@@ -182,6 +184,7 @@ protected override LazyResponses ClientUsage() => Calls(
182184

183185
protected override PutMappingRequest<Project> Initializer => new PutMappingRequest<Project>(CallIsolatedValue, Type<Project>())
184186
{
187+
IncludeInAll = true,
185188
Properties = new Properties<Project>
186189
{
187190
{ p => p.CuratedTags, new ObjectProperty

0 commit comments

Comments
 (0)