Skip to content

Commit 2b39ce3

Browse files
committed
Merge branch 'master' of github.com:elastic/elasticsearch-net
2 parents 488e6e9 + 82b56eb commit 2b39ce3

File tree

35 files changed

+1881
-1861
lines changed

35 files changed

+1881
-1861
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiUrl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace CodeGeneration.LowLevelClient.Domain
66
// ReSharper disable once ClassNeverInstantiated.Global
77
public class ApiUrl
88
{
9-
//these are aliases we much rather pass along inside the querystring
9+
//these are aliases we much rather pass along inside the querystring (or body)
1010
//allowing these will cause too many overloads being generated which helps noone
11-
public static readonly string[] BlackListRouteValues = { "{search_groups}", "{indexing_types}", "{body}"};
11+
public static readonly string[] BlackListRouteValues = { "{search_groups}", "{indexing_types}", "{body}", "{scroll_id}" };
1212
private IEnumerable<string> _paths;
1313

1414
public string Path { get; set; }

src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/CsharpMethod.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,20 @@ public static CsharpMethod Clone(CsharpMethod method)
5959
};
6060
}
6161

62-
private bool IsPartless => this.Url.Parts == null || !this.Url.Parts.Any();
63-
6462
private string MetricPrefix => this.RequestType.Replace("Request", "");
6563
private string ClrParamType(string clrType) => clrType.EndsWith("Metrics", StringComparison.OrdinalIgnoreCase)
6664
? this.MetricPrefix + clrType.Replace("Metrics", "Metric") : clrType;
6765

6866
public IEnumerable<Constructor> RequestConstructors()
6967
{
7068
var ctors = new List<Constructor>();
69+
7170
if (IsPartless) return ctors;
71+
72+
// Do not generate ctors for scroll apis
73+
// Scroll ids should always be passed as part of the request body and enforced via manual ctors
74+
if (IsScroll) return ctors;
75+
7276
var m = this.RequestType;
7377
foreach (var url in this.Url.Paths)
7478
{
@@ -272,6 +276,9 @@ public IEnumerable<FluentRouteSetter> GetFluentRouteSetters()
272276
return setters;
273277
}
274278

279+
280+
private bool IsPartless => this.Url.Parts == null || !this.Url.Parts.Any();
281+
private bool IsScroll => this.Url.Parts.All(p => p.Key == "scroll_id");
275282
public bool IndicesAndTypes => AllParts.Count() == 2 && AllParts.All(p => p.Type == "list") && AllParts.All(p => new[] { "index", "type" }.Contains(p.Name));
276283
public bool IsDocumentPath => AllParts.Count() == 3 && AllParts.All(p => p.Type != "list") && AllParts.All(p => new[] { "index", "type", "id" }.Contains(p.Name));
277284
public IEnumerable<ApiUrlPart> AllParts => (this.Url?.Parts?.Values ?? Enumerable.Empty<ApiUrlPart>()).Where(p => !string.IsNullOrWhiteSpace(p.Name));

src/Elasticsearch.Net/ElasticsearchClient.Generated.cs

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -837,36 +837,6 @@ public ElasticsearchResponse<T> CatThreadPool<T>(Func<CatThreadPoolRequestParame
837837
public Task<ElasticsearchResponse<T>> CatThreadPoolAsync<T>(Func<CatThreadPoolRequestParameters, CatThreadPoolRequestParameters> requestParameters = null)
838838
where T : class => this.DoRequestAsync<T>(GET, Url($"_cat/thread_pool"), null, _params(requestParameters, contentType: "text/plain"));
839839

840-
///<summary>Represents a DELETE on /_search/scroll/{scroll_id}
841-
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
842-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
843-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
844-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
845-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
846-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
847-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
848-
///</summary>
849-
///<param name="scroll_id">A comma-separated list of scroll IDs to clear</param>
850-
///<param name="body">A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter</param>
851-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
852-
public ElasticsearchResponse<T> ClearScroll<T>(string scroll_id, PostData<object> body, Func<ClearScrollRequestParameters, ClearScrollRequestParameters> requestParameters = null)
853-
where T : class => this.DoRequest<T>(DELETE, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), body, _params(requestParameters));
854-
855-
///<summary>Represents a DELETE on /_search/scroll/{scroll_id}
856-
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
857-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
858-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
859-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
860-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
861-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
862-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
863-
///</summary>
864-
///<param name="scroll_id">A comma-separated list of scroll IDs to clear</param>
865-
///<param name="body">A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter</param>
866-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
867-
public Task<ElasticsearchResponse<T>> ClearScrollAsync<T>(string scroll_id, PostData<object> body, Func<ClearScrollRequestParameters, ClearScrollRequestParameters> requestParameters = null)
868-
where T : class => this.DoRequestAsync<T>(DELETE, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), body, _params(requestParameters));
869-
870840
///<summary>Represents a DELETE on /_search/scroll
871841
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
872842
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
@@ -6553,34 +6523,6 @@ public ElasticsearchResponse<T> ScrollGet<T>(Func<ScrollRequestParameters, Scrol
65536523
public Task<ElasticsearchResponse<T>> ScrollGetAsync<T>(Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
65546524
where T : class => this.DoRequestAsync<T>(GET, Url($"_search/scroll"), null, _params(requestParameters));
65556525

6556-
///<summary>Represents a GET on /_search/scroll/{scroll_id}
6557-
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
6558-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
6559-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
6560-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
6561-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
6562-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
6563-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
6564-
///</summary>
6565-
///<param name="scroll_id">The scroll ID</param>
6566-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
6567-
public ElasticsearchResponse<T> ScrollGet<T>(string scroll_id, Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
6568-
where T : class => this.DoRequest<T>(GET, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), null, _params(requestParameters));
6569-
6570-
///<summary>Represents a GET on /_search/scroll/{scroll_id}
6571-
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
6572-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
6573-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
6574-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
6575-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
6576-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
6577-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
6578-
///</summary>
6579-
///<param name="scroll_id">The scroll ID</param>
6580-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
6581-
public Task<ElasticsearchResponse<T>> ScrollGetAsync<T>(string scroll_id, Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
6582-
where T : class => this.DoRequestAsync<T>(GET, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), null, _params(requestParameters));
6583-
65846526
///<summary>Represents a POST on /_search/scroll
65856527
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
65866528
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
@@ -6609,36 +6551,6 @@ public ElasticsearchResponse<T> Scroll<T>(PostData<object> body, Func<ScrollRequ
66096551
public Task<ElasticsearchResponse<T>> ScrollAsync<T>(PostData<object> body, Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
66106552
where T : class => this.DoRequestAsync<T>(POST, Url($"_search/scroll"), body, _params(requestParameters));
66116553

6612-
///<summary>Represents a POST on /_search/scroll/{scroll_id}
6613-
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
6614-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
6615-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
6616-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
6617-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
6618-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
6619-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
6620-
///</summary>
6621-
///<param name="scroll_id">The scroll ID</param>
6622-
///<param name="body">The scroll ID if not passed by URL or query parameter.</param>
6623-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
6624-
public ElasticsearchResponse<T> Scroll<T>(string scroll_id, PostData<object> body, Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
6625-
where T : class => this.DoRequest<T>(POST, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), body, _params(requestParameters));
6626-
6627-
///<summary>Represents a POST on /_search/scroll/{scroll_id}
6628-
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
6629-
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>
6630-
///<para> - byte[], no deserialization, but the response stream will be closed</para>
6631-
///<para> - Stream, no deserialization, response stream is your responsibility</para>
6632-
///<para> - VoidResponse, no deserialization, response stream never read and closed</para>
6633-
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth
6634-
///<para>See also: http://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-request-scroll.html</para>
6635-
///</summary>
6636-
///<param name="scroll_id">The scroll ID</param>
6637-
///<param name="body">The scroll ID if not passed by URL or query parameter.</param>
6638-
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
6639-
public Task<ElasticsearchResponse<T>> ScrollAsync<T>(string scroll_id, PostData<object> body, Func<ScrollRequestParameters, ScrollRequestParameters> requestParameters = null)
6640-
where T : class => this.DoRequestAsync<T>(POST, Url($"_search/scroll/{scroll_id.NotNull("scroll_id")}"), body, _params(requestParameters));
6641-
66426554
///<summary>Represents a GET on /_search
66436555
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
66446556
///<para> - T, an object you own that the elasticsearch response will be deserialized to /para>

0 commit comments

Comments
 (0)