Skip to content

Commit 9914ccd

Browse files
authored
Skip max_docs query string params (#4075)
This commit skips max_docs as query string params on DeleteByQuery,UpdateByQuery and ReindexOnServer. The parameter can also be defined in the request body, so prefer this.
1 parent ea2fb30 commit 9914ccd

File tree

7 files changed

+30
-48
lines changed

7 files changed

+30
-48
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace ApiGenerator.Configuration.Overrides.Endpoints
4+
{
5+
public class DeleteByQueryOverrides : EndpointOverridesBase
6+
{
7+
public override IEnumerable<string> SkipQueryStringParams => new[] { "max_docs", };
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace ApiGenerator.Configuration.Overrides.Endpoints
4+
{
5+
public class ReindexOnServerOverrides : EndpointOverridesBase
6+
{
7+
public override IEnumerable<string> SkipQueryStringParams => new[] { "max_docs", };
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace ApiGenerator.Configuration.Overrides.Endpoints
4+
{
5+
public class UpdateByQueryOverrides : EndpointOverridesBase
6+
{
7+
public override IEnumerable<string> SkipQueryStringParams => new[] { "max_docs", };
8+
}
9+
}

src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,6 @@ public bool? Lenient
417417
set => Q("lenient", value);
418418
}
419419

420-
///<summary>Maximum number of documents to process (default: all documents)</summary>
421-
public long? MaxDocs
422-
{
423-
get => Q<long? >("max_docs");
424-
set => Q("max_docs", value);
425-
}
426-
427420
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
428421
public string Preference
429422
{
@@ -1422,13 +1415,6 @@ public TimeSpan Timeout
14221415
public class ReindexOnServerRequestParameters : RequestParameters<ReindexOnServerRequestParameters>
14231416
{
14241417
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
1425-
///<summary>Maximum number of documents to process (default: all documents)</summary>
1426-
public long? MaxDocs
1427-
{
1428-
get => Q<long? >("max_docs");
1429-
set => Q("max_docs", value);
1430-
}
1431-
14321418
///<summary>Should the effected indexes be refreshed?</summary>
14331419
public bool? Refresh
14341420
{
@@ -2131,13 +2117,6 @@ public bool? Lenient
21312117
set => Q("lenient", value);
21322118
}
21332119

2134-
///<summary>Maximum number of documents to process (default: all documents)</summary>
2135-
public long? MaxDocs
2136-
{
2137-
get => Q<long? >("max_docs");
2138-
set => Q("max_docs", value);
2139-
}
2140-
21412120
///<summary>Ingest pipeline to set on index requests made by this action. (default: none)</summary>
21422121
public string Pipeline
21432122
{

src/Nest/Descriptors.NoNamespace.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,6 @@ public DeleteByQueryDescriptor<TDocument> Index<TOther>()
316316
public DeleteByQueryDescriptor<TDocument> IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable);
317317
///<summary>Specify whether format-based query failures (such as providing text to a numeric field) should be ignored</summary>
318318
public DeleteByQueryDescriptor<TDocument> Lenient(bool? lenient = true) => Qs("lenient", lenient);
319-
///<summary>Maximum number of documents to process (default: all documents)</summary>
320-
public DeleteByQueryDescriptor<TDocument> MaxDocs(long? maxdocs) => Qs("max_docs", maxdocs);
321319
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
322320
public DeleteByQueryDescriptor<TDocument> Preference(string preference) => Qs("preference", preference);
323321
///<summary>Query in the Lucene query string syntax</summary>
@@ -1140,8 +1138,6 @@ public partial class ReindexOnServerDescriptor : RequestDescriptorBase<ReindexOn
11401138
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceReindexOnServer;
11411139
// values part of the url path
11421140
// Request parameters
1143-
///<summary>Maximum number of documents to process (default: all documents)</summary>
1144-
public ReindexOnServerDescriptor MaxDocs(long? maxdocs) => Qs("max_docs", maxdocs);
11451141
///<summary>Should the effected indexes be refreshed?</summary>
11461142
public ReindexOnServerDescriptor Refresh(bool? refresh = true) => Qs("refresh", refresh);
11471143
///<summary>The throttle to set on this request in sub-requests per second. -1 means no throttle.</summary>
@@ -1596,8 +1592,6 @@ public UpdateByQueryDescriptor<TDocument> Index<TOther>()
15961592
public UpdateByQueryDescriptor<TDocument> IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable);
15971593
///<summary>Specify whether format-based query failures (such as providing text to a numeric field) should be ignored</summary>
15981594
public UpdateByQueryDescriptor<TDocument> Lenient(bool? lenient = true) => Qs("lenient", lenient);
1599-
///<summary>Maximum number of documents to process (default: all documents)</summary>
1600-
public UpdateByQueryDescriptor<TDocument> MaxDocs(long? maxdocs) => Qs("max_docs", maxdocs);
16011595
///<summary>Ingest pipeline to set on index requests made by this action. (default: none)</summary>
16021596
public UpdateByQueryDescriptor<TDocument> Pipeline(string pipeline) => Qs("pipeline", pipeline);
16031597
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>

src/Nest/Requests.NoNamespace.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -674,13 +674,6 @@ public bool? Lenient
674674
set => Q("lenient", value);
675675
}
676676

677-
///<summary>Maximum number of documents to process (default: all documents)</summary>
678-
public long? MaxDocs
679-
{
680-
get => Q<long? >("max_docs");
681-
set => Q("max_docs", value);
682-
}
683-
684677
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
685678
public string Preference
686679
{
@@ -2413,13 +2406,6 @@ public partial class ReindexOnServerRequest : PlainRequestBase<ReindexOnServerRe
24132406
internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceReindexOnServer;
24142407
// values part of the url path
24152408
// Request parameters
2416-
///<summary>Maximum number of documents to process (default: all documents)</summary>
2417-
public long? MaxDocs
2418-
{
2419-
get => Q<long? >("max_docs");
2420-
set => Q("max_docs", value);
2421-
}
2422-
24232409
///<summary>Should the effected indexes be refreshed?</summary>
24242410
public bool? Refresh
24252411
{
@@ -3471,13 +3457,6 @@ public bool? Lenient
34713457
set => Q("lenient", value);
34723458
}
34733459

3474-
///<summary>Maximum number of documents to process (default: all documents)</summary>
3475-
public long? MaxDocs
3476-
{
3477-
get => Q<long? >("max_docs");
3478-
set => Q("max_docs", value);
3479-
}
3480-
34813460
///<summary>Ingest pipeline to set on index requests made by this action. (default: none)</summary>
34823461
public string Pipeline
34833462
{

src/Tests/Tests/Document/Multiple/DeleteByQuery/DeleteByQueryApiTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public DeleteByQueryApiTests(IntrusiveOperationCluster cluster, EndpointUsage us
2424

2525
protected override object ExpectJson { get; } = new
2626
{
27+
max_docs = Project.Projects.Count,
2728
query = new
2829
{
2930
ids = new
@@ -38,6 +39,7 @@ public DeleteByQueryApiTests(IntrusiveOperationCluster cluster, EndpointUsage us
3839
protected override Func<DeleteByQueryDescriptor<Project>, IDeleteByQueryRequest> Fluent => d => d
3940
.Index(Indices)
4041
.IgnoreUnavailable()
42+
.MaximumDocuments(Project.Projects.Count)
4143
.Query(q => q
4244
.Ids(ids => ids
4345
.Values(Project.First.Name, "x")
@@ -49,6 +51,7 @@ public DeleteByQueryApiTests(IntrusiveOperationCluster cluster, EndpointUsage us
4951
protected override DeleteByQueryRequest Initializer => new DeleteByQueryRequest(Indices)
5052
{
5153
IgnoreUnavailable = true,
54+
MaximumDocuments = Project.Projects.Count,
5255
Query = new IdsQuery
5356
{
5457
Values = new Id[] { Project.First.Name, "x" }

0 commit comments

Comments
 (0)