Skip to content

Commit 613f234

Browse files
sumithubrusscam
authored andcommitted
Fix Missing Batch Size property in ReindexSource while performing Reindexing by ReindexOnServer API
Closes #2145
1 parent c0ca4eb commit 613f234

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/Nest/Document/Multiple/ReindexOnServer/ReindexSource.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public interface IReindexSource
1717

1818
[JsonProperty("type")]
1919
Types Type { get; set; }
20-
}
20+
21+
[JsonProperty("size")]
22+
int? Size { get; set; }
23+
}
2124

2225
public class ReindexSource : IReindexSource
2326
{
@@ -28,16 +31,19 @@ public class ReindexSource : IReindexSource
2831
public Indices Index { get; set; }
2932

3033
public Types Type { get; set; }
31-
}
34+
35+
public int? Size { get; set; }
36+
}
3237

3338
public class ReindexSourceDescriptor : DescriptorBase<ReindexSourceDescriptor, IReindexSource>, IReindexSource
3439
{
3540
QueryContainer IReindexSource.Query { get; set; }
3641
IList<ISort> IReindexSource.Sort { get; set; }
3742
Indices IReindexSource.Index { get; set; }
3843
Types IReindexSource.Type { get; set; }
44+
int? IReindexSource.Size { get; set; }
3945

40-
public ReindexSourceDescriptor Query<T>(Func<QueryContainerDescriptor<T>, QueryContainer> querySelector) where T : class =>
46+
public ReindexSourceDescriptor Query<T>(Func<QueryContainerDescriptor<T>, QueryContainer> querySelector) where T : class =>
4147
Assign(a => a.Query = querySelector?.Invoke(new QueryContainerDescriptor<T>()));
4248

4349
public ReindexSourceDescriptor Sort<T>(Func<SortDescriptor<T>, IPromise<IList<ISort>>> selector) where T : class =>
@@ -47,5 +53,6 @@ public ReindexSourceDescriptor Sort<T>(Func<SortDescriptor<T>, IPromise<IList<IS
4753

4854
public ReindexSourceDescriptor Type(Types types) => Assign(a => a.Type = types);
4955

50-
}
56+
public ReindexSourceDescriptor Size(int? size) => Assign(a => a.Size = size);
57+
}
5158
}

src/Tests/Document/Multiple/ReindexOnServer/ReindexOnServerApiTests.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ protected override LazyResponses ClientUsage() => Calls(
5454
.Source(s=>s
5555
.Index(CallIsolatedValue)
5656
.Type("test")
57-
.Query<Test>(q=>q
57+
.Size(100)
58+
.Query<Test>(q=>q
5859
.Match(m=>m
5960
.Field(p=>p.Flag)
6061
.Query("bar")
@@ -81,9 +82,10 @@ protected override LazyResponses ClientUsage() => Calls(
8182
Index = CallIsolatedValue,
8283
Type = "test",
8384
Query = new MatchQuery { Field = Field<Test>(p=>p.Flag), Query = "bar"},
84-
Sort = new List<ISort> { new SortField { Field = "id", Order = SortOrder.Ascending } }
85+
Sort = new List<ISort> { new SortField { Field = "id", Order = SortOrder.Ascending } },
86+
Size = 100
8587

86-
},
88+
},
8789
Destination = new ReindexDestination
8890
{
8991
Index = CallIsolatedValue + "-clone",
@@ -130,8 +132,9 @@ protected override void ExpectResponse(IReindexOnServerResponse response)
130132
index = CallIsolatedValue,
131133
query = new { match = new { flag = new { query = "bar" } } },
132134
sort = new [] { new { id = new { order = "asc" } } },
133-
type = new [] { "test" }
134-
}
135+
type = new [] { "test" },
136+
size = 100
137+
}
135138
};
136139
}
137140
}

0 commit comments

Comments
 (0)