Skip to content

Commit c501daf

Browse files
Gabriel MoskoviczGabriel Moskovicz
authored andcommitted
Support reindex with to better syntax
1 parent 6811958 commit c501daf

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/Nest/ElasticClient-Reindex.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ public IObservable<IReindexResponse<T>> Reindex<T>(Func<ReindexDescriptor<T>, Re
1414
var observable = new ReindexObservable<T>(this, _connectionSettings, reindexDescriptor);
1515
return observable;
1616
}
17+
18+
/// <inheritdoc />
19+
public IObservable<IReindexResponse<object>> Reindex(Func<ReindexDescriptor<object>, ReindexDescriptor<object>> reindexSelector)
20+
{
21+
return Reindex<object>(reindexSelector);
22+
}
1723
}
1824
}

src/Nest/IElasticClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ public interface IElasticClient
1919
IObservable<IReindexResponse<T>> Reindex<T>(Func<ReindexDescriptor<T>, ReindexDescriptor<T>> reindexSelector)
2020
where T : class;
2121

22+
/// <summary>
23+
/// Helper method that allows you to reindex from one index into another using SCAN and SCROLL.
24+
/// </summary>
25+
/// <returns>An IObservable you can subscribe to to listen to the progress of the reindexation process</returns>
26+
IObservable<IReindexResponse<object>> Reindex(Func<ReindexDescriptor<object>, ReindexDescriptor<object>> reindexSelector);
27+
2228
/// <summary>
2329
/// A search request can be scrolled by specifying the scroll parameter.
2430
/// <para>The scroll parameter is a time value parameter (for example: scroll=5m),

src/Tests/Nest.Tests.Integration/Index/ReindexTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ReindexTests : IntegrationTests
1313
public void ReindexMinimal()
1414
{
1515
var toIndex = ElasticsearchConfiguration.NewUniqueIndexName();
16-
var observable = this.Client.Reindex<object>(r => r
16+
var observable = this.Client.Reindex(r => r
1717
.FromIndex(ElasticsearchConfiguration.DefaultIndex)
1818
.ToIndex(toIndex)
1919
);
@@ -42,7 +42,7 @@ public void ReindexMinimal()
4242
public void Reindex()
4343
{
4444
var toIndex = ElasticsearchConfiguration.NewUniqueIndexName();
45-
var observable = this.Client.Reindex<object>(r => r
45+
var observable = this.Client.Reindex(r => r
4646
.FromIndex(ElasticsearchConfiguration.DefaultIndex)
4747
.ToIndex(toIndex)
4848
.Query(q=>q.MatchAll())

0 commit comments

Comments
 (0)