diff --git a/src/Elastic.Clients.Elasticsearch/Client/IndicesNamespace.cs b/src/Elastic.Clients.Elasticsearch/Client/IndicesNamespace.cs new file mode 100644 index 00000000000..187acf853cf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/Client/IndicesNamespace.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; +using System.Threading; + +namespace Elastic.Clients.Elasticsearch.IndexManagement; + +public partial class IndicesNamespace +{ + /// + /// Refresh one or more indices. A refresh makes recent operations performed on one or more indices available for search. For data streams, + /// the API runs the refresh operation on the stream’s backing indices. + /// + /// The index and/or data streams to refresh. + /// A from the server. + public RefreshResponse Refresh(Indices indices) + { + var request = new RefreshRequest(indices); + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// Refresh one or more indices. A refresh makes recent operations performed on one or more indices available for search. For data streams, + /// the API runs the refresh operation on the stream’s backing indices. + /// + /// The index and/or data streams to refresh. + /// A used to cancel the asynchronous operation. + /// A from the server. + public Task RefreshAsync(Indices indices, CancellationToken cancellationToken = default) + { + var request = new RefreshRequest(indices); + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs index fcfb7f86f9e..8c140d47ecd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.AsyncSearch.g.cs @@ -21,7 +21,7 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.AsyncSearch; -public class AsyncSearchNamespace : NamespacedClientProxy +public sealed partial class AsyncSearchNamespace : NamespacedClientProxy { internal AsyncSearchNamespace(ElasticsearchClient client) : base(client) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs index 519428cb15f..8ae5b74372c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs @@ -21,7 +21,7 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.Cluster; -public class ClusterNamespace : NamespacedClientProxy +public sealed partial class ClusterNamespace : NamespacedClientProxy { internal ClusterNamespace(ElasticsearchClient client) : base(client) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs index f5a282f2d9e..2a2a7caee9a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Eql.g.cs @@ -21,7 +21,7 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.Eql; -public class EqlNamespace : NamespacedClientProxy +public sealed partial class EqlNamespace : NamespacedClientProxy { internal EqlNamespace(ElasticsearchClient client) : base(client) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs index 4c242a6570a..20f1338ee7a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Indices.g.cs @@ -21,7 +21,7 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.IndexManagement; -public class IndicesNamespace : NamespacedClientProxy +public sealed partial class IndicesNamespace : NamespacedClientProxy { internal IndicesNamespace(ElasticsearchClient client) : base(client) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs index c587405594e..833b2d706df 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Sql.g.cs @@ -21,7 +21,7 @@ #nullable restore namespace Elastic.Clients.Elasticsearch.Sql; -public class SqlNamespace : NamespacedClientProxy +public sealed partial class SqlNamespace : NamespacedClientProxy { internal SqlNamespace(ElasticsearchClient client) : base(client) { diff --git a/tests/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs b/tests/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs index 6c4f4792c30..c62df5a6a28 100644 --- a/tests/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs +++ b/tests/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Elastic.Clients.Elasticsearch.IndexManagement; using Elastic.Clients.Elasticsearch.Mapping; using Elastic.Clients.Elasticsearch.QueryDsl; using Tests.Core.Extensions; @@ -91,7 +90,7 @@ protected override void IntegrationSetup(ElasticsearchClient client, CallUniqueV Client.IndexMany(Project.Projects, index); var cloneIndex = index + "-clone"; Client.Indices.Create(cloneIndex); - Client.Indices.Refresh(new RefreshRequest(Infer.Index(index).And(cloneIndex))); + Client.Indices.Refresh(Infer.Index(index).And(cloneIndex)); } } @@ -102,7 +101,7 @@ protected override LazyResponses ClientUsage() => Calls( (client, r) => client.DeleteByQueryAsync(r) ); - protected override void OnAfterCall(ElasticsearchClient client) => client.Indices.Refresh(new RefreshRequest(CallIsolatedValue)); + protected override void OnAfterCall(ElasticsearchClient client) => client.Indices.Refresh(CallIsolatedValue); protected override DeleteByQueryRequestDescriptor NewDescriptor() => new(Indices); @@ -276,7 +275,7 @@ protected override void ExpectResponse(DeleteByQueryResponse response) // Since we only executed one slice of the two, some of the documents that // match the query will still exist. - Client.Indices.Refresh(new RefreshRequest(CallIsolatedValue)); + Client.Indices.Refresh(CallIsolatedValue); var countResponse = Client.Count(c => c .Indices(CallIsolatedValue) diff --git a/tests/Tests/Document/Multiple/DeleteByQueryRethrottle/DeleteByQueryRethrottleApiTests.cs b/tests/Tests/Document/Multiple/DeleteByQueryRethrottle/DeleteByQueryRethrottleApiTests.cs index a487d208716..50939f8c0bf 100644 --- a/tests/Tests/Document/Multiple/DeleteByQueryRethrottle/DeleteByQueryRethrottleApiTests.cs +++ b/tests/Tests/Document/Multiple/DeleteByQueryRethrottle/DeleteByQueryRethrottleApiTests.cs @@ -48,7 +48,7 @@ protected override void IntegrationSetup(ElasticsearchClient client, CallUniqueV foreach (var callUniqueValue in values) { client.IndexMany(Project.Projects, callUniqueValue.Value); - client.Indices.Refresh(new RefreshRequest(callUniqueValue.Value)); + client.Indices.Refresh(CallIsolatedValue); } } @@ -62,7 +62,7 @@ protected override LazyResponses ClientUsage() => Calls( protected override void OnBeforeCall(ElasticsearchClient client) { client.IndexMany(Project.Projects, CallIsolatedValue); - client.Indices.Refresh(new RefreshRequest(CallIsolatedValue)); + client.Indices.Refresh(CallIsolatedValue); var deleteByQuery = client.DeleteByQuery(CallIsolatedValue, u => u .Conflicts(Conflicts.Proceed)