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
2 changes: 2 additions & 0 deletions src/Nest/Mapping/NonStringIndexOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace Nest
[JsonConverter(typeof(StringEnumConverter))]
public enum NonStringIndexOption
{
[EnumMember(Value = "not_analyzed")]
NotAnalyzed,
[EnumMember(Value = "no")]
No
}
Expand Down
6 changes: 3 additions & 3 deletions src/Nest/Mapping/Types/Core/Boolean/BooleanProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface IBooleanProperty : IProperty
[JsonProperty("fielddata")]
INumericFielddata Fielddata { get; set; }
}

public class BooleanProperty : PropertyBase, IBooleanProperty
{
public BooleanProperty() : base("boolean") { }
Expand All @@ -42,9 +42,9 @@ public class BooleanPropertyDescriptor<T>
public BooleanPropertyDescriptor() : base("boolean") { }

public BooleanPropertyDescriptor<T> Boost(double boost) => Assign(a => a.Boost = boost);
public BooleanPropertyDescriptor<T> Index(NonStringIndexOption index) => Assign(a => a.Index = index);
public BooleanPropertyDescriptor<T> Index(NonStringIndexOption index = NonStringIndexOption.NotAnalyzed) => Assign(a => a.Index = index);
public BooleanPropertyDescriptor<T> NullValue(bool nullValue) => Assign(a => a.NullValue = nullValue);
public BooleanPropertyDescriptor<T> Fielddata(Func<NumericFielddataDescriptor, INumericFielddata> selector) =>
Assign(a => a.Fielddata = selector(new NumericFielddataDescriptor()));
}
}
}
12 changes: 6 additions & 6 deletions src/Nest/Mapping/Types/Core/Date/DateProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public interface IDateProperty : IProperty

[JsonProperty("precision_step")]
int? PrecisionStep { get; set; }

[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

[JsonProperty("format")]
string Format { get; set; }

[JsonProperty("numeric_resolution")]
NumericResolutionUnit? NumericResolution { get; set; }

Expand All @@ -49,7 +49,7 @@ public DateProperty() : base("date") { }
public INumericFielddata Fielddata { get; set; }
}

public class DatePropertyDescriptor<T>
public class DatePropertyDescriptor<T>
: PropertyDescriptorBase<DatePropertyDescriptor<T>, IDateProperty, T>, IDateProperty
where T : class
{
Expand All @@ -65,7 +65,7 @@ public class DatePropertyDescriptor<T>

public DatePropertyDescriptor() : base("date") { }

public DatePropertyDescriptor<T> Index(NonStringIndexOption index = NonStringIndexOption.No) => Assign(a => a.Index = index);
public DatePropertyDescriptor<T> Index(NonStringIndexOption index = NonStringIndexOption.NotAnalyzed) => Assign(a => a.Index = index);
public DatePropertyDescriptor<T> Boost(double boost) => Assign(a => a.Boost = boost);
public DatePropertyDescriptor<T> NullValue(DateTime nullValue) => Assign(a => a.NullValue = nullValue);
public DatePropertyDescriptor<T> IncludeInAll(bool includeInAll = true) => Assign(a => a.IncludeInAll = includeInAll);
Expand All @@ -76,4 +76,4 @@ public DatePropertyDescriptor() : base("date") { }
public DatePropertyDescriptor<T> Fielddata(Func<NumericFielddataDescriptor, INumericFielddata> selector) =>
Assign(a => a.Fielddata = selector(new NumericFielddataDescriptor()));
}
}
}
6 changes: 3 additions & 3 deletions src/Nest/Mapping/Types/Core/Number/NumberProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected NumberPropertyDescriptorBase(string type) : base(type) { }

public TDescriptor Type(NumberType type) => Assign(a => a.Type = type.GetStringValue());

public TDescriptor Index(NonStringIndexOption index = NonStringIndexOption.No) => Assign(a => a.Index = index);
public TDescriptor Index(NonStringIndexOption index = NonStringIndexOption.NotAnalyzed) => Assign(a => a.Index = index);

public TDescriptor Boost(double boost) => Assign(a => a.Boost = boost);

Expand All @@ -86,9 +86,9 @@ public TDescriptor Fielddata(Func<NumericFielddataDescriptor, INumericFielddata>
Assign(a => a.Fielddata = selector(new NumericFielddataDescriptor()));
}

public class NumberPropertyDescriptor<T>
public class NumberPropertyDescriptor<T>
: NumberPropertyDescriptorBase<NumberPropertyDescriptor<T>, INumberProperty, T>, INumberProperty
where T : class
{
}
}
}
4 changes: 2 additions & 2 deletions src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class IpPropertyDescriptor<T>

public IpPropertyDescriptor() : base("ip") { }

public IpPropertyDescriptor<T> Index(NonStringIndexOption? index) => Assign(a => a.Index = index);
public IpPropertyDescriptor<T> Index(NonStringIndexOption? index = NonStringIndexOption.NotAnalyzed) => Assign(a => a.Index = index);

public IpPropertyDescriptor<T> Boost(double boost) => Assign(a => a.Boost = boost);

Expand All @@ -54,4 +54,4 @@ public IpPropertyDescriptor() : base("ip") { }

public IpPropertyDescriptor<T> IncludeInAll(bool includeInAll = true) => Assign(a => a.IncludeInAll = includeInAll);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public TokenCountProperty() : base("token_count") { }
public string Analyzer { get; set; }
}

public class TokenCountPropertyDescriptor<T>
public class TokenCountPropertyDescriptor<T>
: NumberPropertyDescriptorBase<TokenCountPropertyDescriptor<T>, ITokenCountProperty, T>, ITokenCountProperty
where T : class
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ protected override LazyResponses ClientUsage() => Calls(
},
numberOfCommits = new
{
type = "integer"
type = "integer",
index = "not_analyzed"
},
startedOn = new
{
type = "date"
type = "date",
index = "no"
},
state = new
{
Expand Down Expand Up @@ -160,6 +162,15 @@ protected override LazyResponses ClientUsage() => Calls(
.Index(CallIsolatedValue)
.AutoMap()
.Properties(prop => prop
.Number(n => n
.Name(p => p.NumberOfCommits)
.Type(NumberType.Integer)
.Index()
)
.Date(dt => dt
.Name(p => p.StartedOn)
.Index(NonStringIndexOption.No)
)
.String(s => s
.Name(p => p.Name)
.NotAnalyzed()
Expand Down Expand Up @@ -211,8 +222,8 @@ protected override LazyResponses ClientUsage() => Calls(
},
{ p => p.Metadata, new ObjectProperty() },
{ p => p.Name, new StringProperty { Index = FieldIndexOption.NotAnalyzed } },
{ p => p.NumberOfCommits, new NumberProperty(NumberType.Integer) },
{ p => p.StartedOn, new DateProperty() },
{ p => p.NumberOfCommits, new NumberProperty(NumberType.Integer) { Index = NonStringIndexOption.NotAnalyzed } },
{ p => p.StartedOn, new DateProperty { Index = NonStringIndexOption.No } },
{ p => p.State, new NumberProperty(NumberType.Integer) },
{ p => p.Suggest, new CompletionProperty() },
{ p => p.Tags, new ObjectProperty
Expand Down