forked from elastic/elasticsearch-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSourceFieldMapping.cs
80 lines (63 loc) · 1.96 KB
/
SourceFieldMapping.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Collections.Generic;
using Newtonsoft.Json;
using Nest.Resolvers.Converters;
namespace Nest
{
[JsonConverter(typeof(ReadAsTypeConverter<SourceFieldMapping>))]
public interface ISourceFieldMapping : ISpecialField
{
[JsonProperty("enabled")]
bool? Enabled { get; set; }
[JsonProperty("compress")]
bool? Compress { get; set; }
[JsonProperty("compress_threshold")]
string CompressThreshold { get; set; }
[JsonProperty("includes")]
IEnumerable<string> Includes { get; set; }
[JsonProperty("excludes")]
IEnumerable<string> Excludes { get; set; }
}
public class SourceFieldMapping : ISourceFieldMapping
{
public bool? Enabled { get; set; }
public bool? Compress { get; set; }
public string CompressThreshold { get; set; }
public IEnumerable<string> Includes { get; set; }
public IEnumerable<string> Excludes { get; set; }
}
public class SourceFieldMappingDescriptor : ISourceFieldMapping
{
private ISourceFieldMapping Self { get { return this; } }
bool? ISourceFieldMapping.Enabled { get; set; }
bool? ISourceFieldMapping.Compress { get; set; }
string ISourceFieldMapping.CompressThreshold { get; set; }
IEnumerable<string> ISourceFieldMapping.Includes { get; set; }
IEnumerable<string> ISourceFieldMapping.Excludes { get; set; }
public SourceFieldMappingDescriptor Enabled(bool enabled = true)
{
Self.Enabled = enabled;
return this;
}
public SourceFieldMappingDescriptor Compress(bool compress = true)
{
Self.Compress = compress;
return this;
}
public SourceFieldMappingDescriptor CompressionThreshold(string compressionThreshold)
{
Self.Compress = true;
Self.CompressThreshold = compressionThreshold;
return this;
}
public SourceFieldMappingDescriptor Includes(IEnumerable<string> includes)
{
Self.Includes = includes;
return this;
}
public SourceFieldMappingDescriptor Excludes(IEnumerable<string> excludes)
{
Self.Excludes = excludes;
return this;
}
}
}