Skip to content

Commit 267540a

Browse files
committed
Fix Missing Batch Size property in ReindexSource while performing Reindexing by ReindexOnServer API #2145
1 parent 2575f97 commit 267540a

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

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

Lines changed: 13 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,7 +31,9 @@ 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
{
@@ -37,7 +42,9 @@ public class ReindexSourceDescriptor : DescriptorBase<ReindexSourceDescriptor, I
3742
Indices IReindexSource.Index { get; set; }
3843
Types IReindexSource.Type { get; set; }
3944

40-
public ReindexSourceDescriptor Query<T>(Func<QueryContainerDescriptor<T>, QueryContainer> querySelector) where T : class =>
45+
int? IReindexSource.Size { get; set; }
46+
47+
public ReindexSourceDescriptor Query<T>(Func<QueryContainerDescriptor<T>, QueryContainer> querySelector) where T : class =>
4148
Assign(a => a.Query = querySelector?.Invoke(new QueryContainerDescriptor<T>()));
4249

4350
public ReindexSourceDescriptor Sort<T>(Func<SortDescriptor<T>, IPromise<IList<ISort>>> selector) where T : class =>
@@ -47,5 +54,7 @@ public ReindexSourceDescriptor Sort<T>(Func<SortDescriptor<T>, IPromise<IList<IS
4754

4855
public ReindexSourceDescriptor Type(Types types) => Assign(a => a.Type = types);
4956

50-
}
57+
public ReindexSourceDescriptor Size(int? size) => Assign(a => a.Size = size);
58+
59+
}
5160
}

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

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

85-
},
87+
},
8688
Destination = new ReindexDestination
8789
{
8890
Index = CallIsolatedValue + "-clone",
@@ -129,8 +131,9 @@ protected override void ExpectResponse(IReindexOnServerResponse response)
129131
index = CallIsolatedValue,
130132
query = new { match = new { flag = new { query = "bar" } } },
131133
sort = new [] { new { id = new { order = "asc" } } },
132-
type = new [] { "test" }
133-
}
134+
type = new [] { "test" },
135+
Size = 100
136+
}
134137
};
135138
}
136139
}

0 commit comments

Comments
 (0)