Skip to content

Commit d39b47e

Browse files
committed
Add support for the graph API that is part of xpack
Include GraphExploreControls in integration test Remove JsonProperty attributes from GraphExploreControls
1 parent b02cf96 commit d39b47e

23 files changed

+1006
-5
lines changed

Diff for: src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void Main(string[] args)
2828
if (redownloadCoreSpecification)
2929
RestSpecDownloader.Download(downloadBranch);
3030

31-
ApiGenerator.Generate("Core", "DeleteByQuery");
31+
ApiGenerator.Generate("Core", "DeleteByQuery", "Graph");
3232
//ApiGenerator.Generate("Core", "Graph", "License");
3333
//ApiGenerator.Generate(); //generates everything under ApiSpecification
3434
}

Diff for: src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"paths": ["/{index}/_graph/explore", "/{index}/{type}/_graph/explore"],
88
"parts" : {
99
"index": {
10-
"type" : "list",
11-
"description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices"
10+
"required" : true,
11+
"type": "list",
12+
"description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices"
1213
},
1314
"type": {
1415
"type" : "list",

Diff for: src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs

+26
Original file line numberDiff line numberDiff line change
@@ -4515,4 +4515,30 @@ public class DeleteByQueryRequestParameters : FluentRequestParameters<DeleteByQu
45154515
public DeleteByQueryRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
45164516

45174517
}
4518+
4519+
///<summary>Request parameters descriptor for GraphExplore
4520+
///<pre>
4521+
///https://www.elastic.co/guide/en/graph/current/explore.html
4522+
///</pre>
4523+
///</summary>
4524+
public class GraphExploreRequestParameters : FluentRequestParameters<GraphExploreRequestParameters>
4525+
{
4526+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
4527+
4528+
///<summary>Specific routing value</summary>
4529+
public GraphExploreRequestParameters Routing(string routing) => this.AddQueryString("routing", routing);
4530+
4531+
4532+
///<summary>Explicit operation timeout</summary>
4533+
public GraphExploreRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit());
4534+
4535+
4536+
///<summary>The URL-encoded request definition</summary>
4537+
public GraphExploreRequestParameters Source(string source) => this.AddQueryString("source", source);
4538+
4539+
4540+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4541+
public GraphExploreRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4542+
4543+
}
45184544
}

Diff for: src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

+120
Original file line numberDiff line numberDiff line change
@@ -8285,6 +8285,126 @@ public ElasticsearchResponse<T> DeleteByQuery<T>(string index, string type, Post
82858285
public Task<ElasticsearchResponse<T>> DeleteByQueryAsync<T>(string index, string type, PostData<object> body, Func<DeleteByQueryRequestParameters, DeleteByQueryRequestParameters> requestParameters = null)
82868286
where T : class => this.DoRequestAsync<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_query"), body, _params(requestParameters));
82878287

8288+
///<summary>Represents a GET on /{index}/_graph/explore
8289+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8290+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8291+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8292+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8293+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8294+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8295+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8296+
///</summary>
8297+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8298+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8299+
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8300+
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));
8301+
8302+
///<summary>Represents a GET on /{index}/_graph/explore
8303+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8304+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8305+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8306+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8307+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8308+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8309+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8310+
///</summary>
8311+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8312+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8313+
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8314+
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));
8315+
8316+
///<summary>Represents a GET on /{index}/{type}/_graph/explore
8317+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8318+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8319+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8320+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8321+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8322+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8323+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8324+
///</summary>
8325+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8326+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
8327+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8328+
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8329+
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));
8330+
8331+
///<summary>Represents a GET on /{index}/{type}/_graph/explore
8332+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8333+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8334+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8335+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8336+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8337+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8338+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8339+
///</summary>
8340+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8341+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
8342+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8343+
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8344+
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));
8345+
8346+
///<summary>Represents a POST on /{index}/_graph/explore
8347+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8348+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8349+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8350+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8351+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8352+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8353+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8354+
///</summary>
8355+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8356+
///<param name="body">Graph Query DSL</param>
8357+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8358+
public ElasticsearchResponse<T> GraphExplore<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8359+
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));
8360+
8361+
///<summary>Represents a POST on /{index}/_graph/explore
8362+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8363+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8364+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8365+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8366+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8367+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8368+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8369+
///</summary>
8370+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8371+
///<param name="body">Graph Query DSL</param>
8372+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8373+
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8374+
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));
8375+
8376+
///<summary>Represents a POST on /{index}/{type}/_graph/explore
8377+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8378+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8379+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8380+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8381+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8382+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8383+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8384+
///</summary>
8385+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8386+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
8387+
///<param name="body">Graph Query DSL</param>
8388+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8389+
public ElasticsearchResponse<T> GraphExplore<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8390+
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));
8391+
8392+
///<summary>Represents a POST on /{index}/{type}/_graph/explore
8393+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8394+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8395+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8396+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8397+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8398+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8399+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
8400+
///</summary>
8401+
///<param name="index">A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices</param>
8402+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
8403+
///<param name="body">Graph Query DSL</param>
8404+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8405+
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
8406+
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));
8407+
82888408

82898409
}
82908410
}

0 commit comments

Comments
 (0)