|
| 1 | +using System.Diagnostics; |
| 2 | +using System.Runtime.Serialization; |
| 3 | +using Elasticsearch.Net.Utf8Json; |
| 4 | + |
| 5 | +namespace Nest |
| 6 | +{ |
| 7 | + /// <summary> |
| 8 | + /// A field to store pre-aggregated numerical data representing a histogram. |
| 9 | + /// <para /> |
| 10 | + /// Available in Elasticsearch 7.6.0+ with at least basic license level |
| 11 | + /// </summary> |
| 12 | + [InterfaceDataContract] |
| 13 | + public interface IHistogramProperty : IProperty |
| 14 | + { |
| 15 | + /// <summary> |
| 16 | + /// Whether to ignore malformed input values. |
| 17 | + /// </summary> |
| 18 | + [DataMember(Name = "ignore_malformed")] |
| 19 | + bool? IgnoreMalformed { get; set; } |
| 20 | + } |
| 21 | + |
| 22 | + /// <inheritdoc cref="IHistogramProperty"/> |
| 23 | + [DebuggerDisplay("{DebugDisplay}")] |
| 24 | + public class HistogramProperty : PropertyBase, IHistogramProperty |
| 25 | + { |
| 26 | + public HistogramProperty() : base(FieldType.Histogram) { } |
| 27 | + |
| 28 | + /// <inheritdoc /> |
| 29 | + public bool? IgnoreMalformed { get; set; } |
| 30 | + } |
| 31 | + |
| 32 | + /// <inheritdoc cref="IHistogramProperty"/> |
| 33 | + [DebuggerDisplay("{DebugDisplay}")] |
| 34 | + public class HistogramPropertyDescriptor<T> |
| 35 | + : PropertyDescriptorBase<HistogramPropertyDescriptor<T>, IHistogramProperty, T>, IHistogramProperty |
| 36 | + where T : class |
| 37 | + { |
| 38 | + bool? IHistogramProperty.IgnoreMalformed { get; set; } |
| 39 | + |
| 40 | + public HistogramPropertyDescriptor() : base(FieldType.Histogram) { } |
| 41 | + |
| 42 | + /// <inheritdoc cref="IHistogramProperty.IgnoreMalformed"/> |
| 43 | + public HistogramPropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) => |
| 44 | + Assign(ignoreMalformed, (a, v) => a.IgnoreMalformed = v); |
| 45 | + } |
| 46 | +} |
0 commit comments