Skip to content

Commit ac30ce2

Browse files
committed
DateRangeExpression fix typo, TypeMapping missing SourceField, MultiSearch operation index, type should override request index, type if exists
1 parent b90796f commit ac30ce2

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/Nest/Aggregations/Bucket/DateRange/DateRangeExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public class DateRangeExpressionDescriptor
3434
public DateRangeExpressionDescriptor To(DateMath to) => Assign(a => a.To = to);
3535

3636
string IDateRangeExpression.Key { get; set; }
37-
public DateRangeExpressionDescriptor From(string key) => Assign(a => a.Key = key);
37+
public DateRangeExpressionDescriptor Key(string key) => Assign(a => a.Key = key);
3838
}
3939
}

src/Nest/Mapping/TypeMapping.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ public TypeMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int max
173173
/// <inheritdoc/>
174174
public TypeMappingDescriptor<T> SizeField(Func<SizeFieldDescriptor, SizeFieldDescriptor> sizeFieldSelector) => Assign(a => a.SizeField = sizeFieldSelector?.Invoke(new SizeFieldDescriptor()));
175175

176-
/// <inheritdoc/>
177-
public TypeMappingDescriptor<T> DisableSizeField(bool disabled = true) => Assign(a => a.SizeField = new SizeField { Enabled = !disabled });
176+
/// <inheritdoc/>
177+
public TypeMappingDescriptor<T> SourceField(Func<SourceFieldDescriptor, SourceFieldDescriptor> sourceFieldSelector) => Assign(a => a.SourceField = sourceFieldSelector?.Invoke(new SourceFieldDescriptor()));
178+
179+
/// <inheritdoc/>
180+
public TypeMappingDescriptor<T> DisableSizeField(bool disabled = true) => Assign(a => a.SizeField = new SizeField { Enabled = !disabled });
178181

179182
/// <inheritdoc/>
180183
public TypeMappingDescriptor<T> DisableIndexField(bool disabled = true) => Assign(a => a.IndexField = new IndexField { Enabled = !disabled });

src/Nest/Search/MultiSearch/MultiSearchJsonConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
2222

2323
foreach (var operation in request.Operations.Values)
2424
{
25-
var indices = (request.Index != null && !request.Index.Equals(operation.Index))
25+
var indices = operation.Index != null
2626
? operation.Index
27-
: null;
27+
: request.Index;
2828

29-
var types = (request.Type != null && !request.Type.Equals(operation.Type))
29+
var types = operation.Type != null
3030
? operation.Type
31-
: null;
31+
: request.Type;
3232

3333
var searchType = operation.RequestParameters.GetQueryStringValue<SearchType>("search_type").GetStringValue();
3434
if (searchType == "query_then_fetch")

0 commit comments

Comments
 (0)