Skip to content

Commit 2f8670e

Browse files
committed
Add support for the graph API that is part of xpack
Include GraphExploreControls in integration test Remove JsonProperty attributes from GraphExploreControls Conflicts: src/Nest/Nest.csproj src/Nest/_Generated/_Descriptors.generated.cs src/Nest/_Generated/_Requests.generated.cs src/Tests/Tests.csproj src/Tests/tests.yaml
1 parent 9e0e2b8 commit 2f8670e

23 files changed

+1005
-4
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs

Lines changed: 1 addition & 1 deletion
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
}

src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Graph/graph.explore.json

Lines changed: 3 additions & 2 deletions
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",

src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4519,4 +4519,30 @@ public class DeleteByQueryRequestParameters : FluentRequestParameters<DeleteByQu
45194519
public DeleteByQueryRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
45204520

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

src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7751,6 +7751,126 @@ public ElasticsearchResponse<T> DeleteByQuery<T>(string index, string type, Post
77517751
public Task<ElasticsearchResponse<T>> DeleteByQueryAsync<T>(string index, string type, PostData<object> body, Func<DeleteByQueryRequestParameters, DeleteByQueryRequestParameters> requestParameters = null)
77527752
where T : class => this.DoRequestAsync<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_query"), body, _params(requestParameters));
77537753

7754+
///<summary>Represents a GET on /{index}/_graph/explore
7755+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
7756+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7757+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7758+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7759+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7760+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7761+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7762+
///</summary>
7763+
///<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>
7764+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7765+
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7766+
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));
7767+
7768+
///<summary>Represents a GET on /{index}/_graph/explore
7769+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
7770+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7771+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7772+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7773+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7774+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7775+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7776+
///</summary>
7777+
///<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>
7778+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7779+
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7780+
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));
7781+
7782+
///<summary>Represents a GET on /{index}/{type}/_graph/explore
7783+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
7784+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7785+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7786+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7787+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7788+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7789+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7790+
///</summary>
7791+
///<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>
7792+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
7793+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7794+
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7795+
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));
7796+
7797+
///<summary>Represents a GET on /{index}/{type}/_graph/explore
7798+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
7799+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7800+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7801+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7802+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7803+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7804+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7805+
///</summary>
7806+
///<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>
7807+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
7808+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7809+
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7810+
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));
7811+
7812+
///<summary>Represents a POST on /{index}/_graph/explore
7813+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
7814+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7815+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7816+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7817+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7818+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7819+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7820+
///</summary>
7821+
///<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>
7822+
///<param name="body">Graph Query DSL</param>
7823+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7824+
public ElasticsearchResponse<T> GraphExplore<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7825+
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));
7826+
7827+
///<summary>Represents a POST on /{index}/_graph/explore
7828+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
7829+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7830+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7831+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7832+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7833+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7834+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7835+
///</summary>
7836+
///<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>
7837+
///<param name="body">Graph Query DSL</param>
7838+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7839+
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7840+
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));
7841+
7842+
///<summary>Represents a POST on /{index}/{type}/_graph/explore
7843+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
7844+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7845+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7846+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7847+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7848+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7849+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7850+
///</summary>
7851+
///<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>
7852+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
7853+
///<param name="body">Graph Query DSL</param>
7854+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7855+
public ElasticsearchResponse<T> GraphExplore<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7856+
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));
7857+
7858+
///<summary>Represents a POST on /{index}/{type}/_graph/explore
7859+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
7860+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
7861+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
7862+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
7863+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
7864+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
7865+
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
7866+
///</summary>
7867+
///<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>
7868+
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
7869+
///<param name="body">Graph Query DSL</param>
7870+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
7871+
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
7872+
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));
7873+
77547874

77557875
}
77567876
}

0 commit comments

Comments
 (0)