-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement indices.reload_search_analyzers
- Loading branch information
Showing
9 changed files
with
219 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
public class ReloadDetails | ||
{ | ||
[DataMember(Name ="index")] | ||
public string Index { get; internal set; } | ||
|
||
[DataMember(Name ="reloaded_analyzers")] | ||
public IReadOnlyCollection<string> ReloadedAnalyzers { get; internal set; } = EmptyReadOnly<string>.Collection; | ||
|
||
[DataMember(Name ="reloaded_node_ids")] | ||
public IReadOnlyCollection<string> ReloadedNodeIds { get; internal set; } = EmptyReadOnly<string>.Collection; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Nest/Indices/ReloadSearchAnalyzers/ReloadSearchAnalyzersRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Nest | ||
{ | ||
[MapsApi("indices.reload_search_analyzers.json")] | ||
public partial interface IReloadSearchAnalyzersRequest { } | ||
|
||
public partial class ReloadSearchAnalyzersRequest { } | ||
|
||
public partial class ReloadSearchAnalyzersDescriptor { } | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Nest/Indices/ReloadSearchAnalyzers/ReloadSearchAnalyzersResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
public class ReloadSearchAnalyzersResponse : ResponseBase | ||
{ | ||
[DataMember(Name ="_shards")] | ||
public ShardStatistics Shards { get; internal set; } | ||
|
||
[DataMember(Name ="reload_details")] | ||
public IReadOnlyCollection<ReloadDetails> ReloadDetails { get; internal set; } = EmptyReadOnly<ReloadDetails>.Collection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/Tests/Indices/ReloadSearchAnalyzers/ReloadSearchAnalyzersApiTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using Elasticsearch.Net; | ||
using Nest; | ||
using Tests.Core.ManagedElasticsearch.Clusters; | ||
using Tests.Framework.EndpointTests; | ||
using Tests.Framework.EndpointTests.TestState; | ||
|
||
namespace Tests.Indices.ReloadSearchAnalyzers | ||
{ | ||
public class ReloadSearchAnalyzersApiTests | ||
: ApiIntegrationTestBase<ReadOnlyCluster, ReloadSearchAnalyzersResponse, IReloadSearchAnalyzersRequest, ReloadSearchAnalyzersDescriptor, ReloadSearchAnalyzersRequest> | ||
{ | ||
public ReloadSearchAnalyzersApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } | ||
|
||
protected override bool ExpectIsValid => true; | ||
protected override int ExpectStatusCode => 200; | ||
|
||
protected override ReloadSearchAnalyzersDescriptor NewDescriptor() => new ReloadSearchAnalyzersDescriptor(CallIsolatedValue); | ||
|
||
protected override Func<ReloadSearchAnalyzersDescriptor, IReloadSearchAnalyzersRequest> Fluent => d => d.Index(CallIsolatedValue); | ||
protected override HttpMethod HttpMethod => HttpMethod.POST; | ||
|
||
protected override ReloadSearchAnalyzersRequest Initializer => new ReloadSearchAnalyzersRequest(CallIsolatedValue); | ||
protected override string UrlPath => $"/{CallIsolatedValue}/_reload_search_analyzers"; | ||
|
||
protected override LazyResponses ClientUsage() => Calls( | ||
(client, f) => client.Indices.ReloadSearchAnalyzers(CallIsolatedValue, f), | ||
(client, f) => client.Indices.ReloadSearchAnalyzersAsync(CallIsolatedValue, f), | ||
(client, r) => client.Indices.ReloadSearchAnalyzers(r), | ||
(client, r) => client.Indices.ReloadSearchAnalyzersAsync(r) | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/Tests/Indices/ReloadSearchAnalyzers/ReloadSearchAnalyzersUrlTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Threading.Tasks; | ||
using Elastic.Xunit.XunitPlumbing; | ||
using Nest; | ||
using Tests.Framework.EndpointTests; | ||
using static Tests.Framework.EndpointTests.UrlTester; | ||
using static Nest.Indices; | ||
|
||
namespace Tests.Indices.ReloadSearchAnalyzers | ||
{ | ||
public class ReloadSearchAnalyzersUrlTests | ||
{ | ||
[U] public async Task Urls() | ||
{ | ||
await POST($"/_all/_reload_search_analyzers") | ||
.Fluent(c => c.Indices.ReloadSearchAnalyzers(All)) | ||
.Request(c => c.Indices.ReloadSearchAnalyzers(new ReloadSearchAnalyzersRequest(All))) | ||
.FluentAsync(c => c.Indices.ReloadSearchAnalyzersAsync(All)) | ||
.RequestAsync(c => c.Indices.ReloadSearchAnalyzersAsync(new ReloadSearchAnalyzersRequest(All))) | ||
; | ||
|
||
var index = "index1,index2"; | ||
await POST($"/index1%2Cindex2/_reload_search_analyzers") | ||
.Fluent(c => c.Indices.ReloadSearchAnalyzers(index)) | ||
.Request(c => c.Indices.ReloadSearchAnalyzers(new ReloadSearchAnalyzersRequest(index))) | ||
.FluentAsync(c => c.Indices.ReloadSearchAnalyzersAsync(index)) | ||
.RequestAsync(c => c.Indices.ReloadSearchAnalyzersAsync(new ReloadSearchAnalyzersRequest(index))) | ||
; | ||
} | ||
} | ||
} |