Skip to content

Commit 7ee66fa

Browse files
russcamMpdreamz
andcommitted
Implement async_search APIs (#4637)
Relates: #4610 This commit implements the async search APIs that are part of basic Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com> (cherry picked from commit a17338e)
1 parent 2cd4161 commit 7ee66fa

39 files changed

+1783
-348
lines changed

src/ApiGenerator/Configuration/CodeConfiguration.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,33 @@ public static class CodeConfiguration
3131

3232
public static string[] IgnoredApisHighLevel { get; } =
3333
{
34+
"autoscaling.delete_autoscaling_decision.json",
35+
"autoscaling.get_autoscaling_policy.json",
36+
"autoscaling.put_autoscaling_policy.json",
37+
"autoscaling.delete_autoscaling_policy.json",
38+
39+
"indices.delete_index_template.json",
40+
"indices.exists_index_template.json",
41+
"indices.get_index_template.json",
42+
"indices.put_index_template.json",
43+
"indices.simulate_index_template.json",
44+
"indices.simulate_template.json",
45+
46+
"searchable_snapshots.stats.json",
47+
"searchable_snapshots.clear_cache.json",
48+
"searchable_snapshots.mount.json",
49+
"searchable_snapshots.repository_stats.json",
50+
51+
"cluster.delete_voting_config_exclusions.json",
52+
"cluster.post_voting_config_exclusions.json",
53+
3454
"autoscaling.get_autoscaling_decision.json", // 7.7 experimental
3555
"eql.search.json", // 7.7 beta
3656
"get_script_context.json", // 7.7 experimental
3757
"get_script_languages.json", // 7.7 experimental
3858
"indices.create_data_stream.json", // 7.7 experimental
3959
"indices.delete_data_stream.json", // 7.7 experimental
60+
"indices.get_data_stream.json", // 7.7 experimental
4061
"indices.get_data_streams.json", // 7.7 experimental
4162
"ml.delete_data_frame_analytics.json", // 7.7 experimental
4263
"ml.delete_trained_model.json", // 7.7 experimental
@@ -55,12 +76,10 @@ public static class CodeConfiguration
5576
"scripts_painless_context.json", // 7.7 experimental
5677

5778
// 7.7 - to be implemented
58-
"async_search.delete.json",
59-
"async_search.get.json",
60-
"async_search.submit.json",
6179
"cluster.delete_component_template.json",
6280
"cluster.get_component_template.json",
6381
"cluster.put_component_template.json",
82+
"cluster.exists_component_template.json",
6483
"transform.delete_transform.json",
6584
"transform.get_transform.json",
6685
"transform.get_transform_stats.json",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Collections.Generic;
2+
3+
namespace ApiGenerator.Configuration.Overrides.Endpoints
4+
{
5+
// ReSharper disable once UnusedMember.Global
6+
public class AsyncSearchSubmitOverrides : EndpointOverridesBase
7+
{
8+
public override IEnumerable<string> SkipQueryStringParams => new[]
9+
{
10+
"size",
11+
"from",
12+
"timeout",
13+
"explain",
14+
"version",
15+
"sort",
16+
"_source",
17+
"_source_includes",
18+
"_source_excludes",
19+
"track_scores",
20+
"terminate_after",
21+
};
22+
23+
public override IEnumerable<string> RenderPartial => new[]
24+
{
25+
"track_total_hits"
26+
};
27+
}
28+
}

src/ApiGenerator/RestSpecification/Core/root.html

Lines changed: 98 additions & 88 deletions
Large diffs are not rendered by default.

src/ApiGenerator/RestSpecification/Core/snapshot.cleanup_repository.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"snapshot.cleanup_repository": {
33
"documentation": {
4-
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html",
4+
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html",
55
"description": "Removes stale data from repository."
66
},
77
"stability": "stable",

src/ApiGenerator/RestSpecification/Core/snapshot.delete_repository.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"parts":{
1616
"repository":{
1717
"type":"list",
18-
"description":"A comma-separated list of repository names"
18+
"description":"Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported."
1919
}
2020
}
2121
}

src/ApiGenerator/RestSpecification/XPack/ml.validate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ml.validate":{
33
"documentation":{
4-
"url":null,
4+
"url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html",
55
"description":"Validates an anomaly detection job."
66
},
77
"stability":"stable",

src/ApiGenerator/RestSpecification/XPack/ml.validate_detector.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ml.validate_detector":{
33
"documentation":{
4-
"url":null,
4+
"url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html",
55
"description":"Validates an anomaly detection detector."
66
},
77
"stability":"stable",

src/ApiGenerator/RestSpecification/XPack/root.html

Lines changed: 98 additions & 88 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
namespace Elasticsearch.Net.Specification.AsyncSearchApi
2626
{
2727
///<summary>Request options for Delete <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</para></summary>
28-
public class DeleteRequestParameters : RequestParameters<DeleteRequestParameters>
28+
public class AsyncSearchDeleteRequestParameters : RequestParameters<AsyncSearchDeleteRequestParameters>
2929
{
3030
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
3131
}
3232

3333
///<summary>Request options for Get <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</para></summary>
34-
public class GetRequestParameters : RequestParameters<GetRequestParameters>
34+
public class AsyncSearchGetRequestParameters : RequestParameters<AsyncSearchGetRequestParameters>
3535
{
3636
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
3737
///<summary>Specify the time interval in which the results (partial or final) for this search will be available</summary>
@@ -57,7 +57,7 @@ public TimeSpan WaitForCompletionTimeout
5757
}
5858

5959
///<summary>Request options for Submit <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</para></summary>
60-
public class SubmitRequestParameters : RequestParameters<SubmitRequestParameters>
60+
public class AsyncSearchSubmitRequestParameters : RequestParameters<AsyncSearchSubmitRequestParameters>
6161
{
6262
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
6363
///<summary>
@@ -129,20 +129,6 @@ public ExpandWildcards? ExpandWildcards
129129
set => Q("expand_wildcards", value);
130130
}
131131

132-
///<summary>Specify whether to return detailed information about score computation as part of a hit</summary>
133-
public bool? Explain
134-
{
135-
get => Q<bool? >("explain");
136-
set => Q("explain", value);
137-
}
138-
139-
///<summary>Starting offset (default: 0)</summary>
140-
public long? From
141-
{
142-
get => Q<long? >("from");
143-
set => Q("from", value);
144-
}
145-
146132
///<summary>Whether specified concrete, expanded or aliased indices should be ignored when throttled</summary>
147133
public bool? IgnoreThrottled
148134
{
@@ -233,41 +219,6 @@ public bool? SequenceNumberPrimaryTerm
233219
set => Q("seq_no_primary_term", value);
234220
}
235221

236-
///<summary>Number of hits to return (default: 10)</summary>
237-
public long? Size
238-
{
239-
get => Q<long? >("size");
240-
set => Q("size", value);
241-
}
242-
243-
///<summary>A comma-separated list of <field>:<direction> pairs</summary>
244-
public string[] Sort
245-
{
246-
get => Q<string[]>("sort");
247-
set => Q("sort", value);
248-
}
249-
250-
///<summary>True or false to return the _source field or not, or a list of fields to return</summary>
251-
public bool? SourceEnabled
252-
{
253-
get => Q<bool? >("_source");
254-
set => Q("_source", value);
255-
}
256-
257-
///<summary>A list of fields to exclude from the returned _source field</summary>
258-
public string[] SourceExcludes
259-
{
260-
get => Q<string[]>("_source_excludes");
261-
set => Q("_source_excludes", value);
262-
}
263-
264-
///<summary>A list of fields to extract and return from the _source field</summary>
265-
public string[] SourceIncludes
266-
{
267-
get => Q<string[]>("_source_includes");
268-
set => Q("_source_includes", value);
269-
}
270-
271222
///<summary>Specific 'tag' of the request for logging and statistical purposes</summary>
272223
public string[] Stats
273224
{
@@ -310,27 +261,6 @@ public string SuggestText
310261
set => Q("suggest_text", value);
311262
}
312263

313-
///<summary>The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.</summary>
314-
public long? TerminateAfter
315-
{
316-
get => Q<long? >("terminate_after");
317-
set => Q("terminate_after", value);
318-
}
319-
320-
///<summary>Explicit operation timeout</summary>
321-
public TimeSpan Timeout
322-
{
323-
get => Q<TimeSpan>("timeout");
324-
set => Q("timeout", value);
325-
}
326-
327-
///<summary>Whether to calculate and return scores even if they are not used for sorting</summary>
328-
public bool? TrackScores
329-
{
330-
get => Q<bool? >("track_scores");
331-
set => Q("track_scores", value);
332-
}
333-
334264
///<summary>Indicate if the number of documents that match the query should be tracked</summary>
335265
public bool? TrackTotalHits
336266
{
@@ -345,13 +275,6 @@ public bool? TypedKeys
345275
set => Q("typed_keys", value);
346276
}
347277

348-
///<summary>Specify whether to return document version as part of a hit</summary>
349-
public bool? Version
350-
{
351-
get => Q<bool? >("version");
352-
set => Q("version", value);
353-
}
354-
355278
///<summary>Specify the time that the request should block waiting for the final response</summary>
356279
public TimeSpan WaitForCompletionTimeout
357280
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,13 @@ public class UpdateModelSnapshotRequestParameters : RequestParameters<UpdateMode
815815
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
816816
}
817817

818-
///<summary>Request options for ValidateJob</summary>
818+
///<summary>Request options for ValidateJob <para>https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html</para></summary>
819819
public class ValidateJobRequestParameters : RequestParameters<ValidateJobRequestParameters>
820820
{
821821
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
822822
}
823823

824-
///<summary>Request options for ValidateDetector</summary>
824+
///<summary>Request options for ValidateDetector <para>https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html</para></summary>
825825
public class ValidateDetectorRequestParameters : RequestParameters<ValidateDetectorRequestParameters>
826826
{
827827
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;

0 commit comments

Comments
 (0)