Skip to content

Add support for the Graph API that is part of xpack #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void Main(string[] args)
if (redownloadCoreSpecification)
RestSpecDownloader.Download(downloadBranch);

ApiGenerator.Generate("Core", "DeleteByQuery");
ApiGenerator.Generate("Core", "DeleteByQuery", "Graph");
//ApiGenerator.Generate("Core", "Graph", "License");
//ApiGenerator.Generate(); //generates everything under ApiSpecification
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"paths": ["/{index}/_graph/explore", "/{index}/{type}/_graph/explore"],
"parts" : {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices"
"required" : true,
"type": "list",
"description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices"
},
"type": {
"type" : "list",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4515,4 +4515,30 @@ public class DeleteByQueryRequestParameters : FluentRequestParameters<DeleteByQu
public DeleteByQueryRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);

}

///<summary>Request parameters descriptor for GraphExplore
///<pre>
///https://www.elastic.co/guide/en/graph/current/explore.html
///</pre>
///</summary>
public class GraphExploreRequestParameters : FluentRequestParameters<GraphExploreRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;

///<summary>Specific routing value</summary>
public GraphExploreRequestParameters Routing(string routing) => this.AddQueryString("routing", routing);


///<summary>Explicit operation timeout</summary>
public GraphExploreRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit());


///<summary>The URL-encoded request definition</summary>
public GraphExploreRequestParameters Source(string source) => this.AddQueryString("source", source);


///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
public GraphExploreRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);

}
}
120 changes: 120 additions & 0 deletions src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8285,6 +8285,126 @@ public ElasticsearchResponse<T> DeleteByQuery<T>(string index, string type, Post
public Task<ElasticsearchResponse<T>> DeleteByQueryAsync<T>(string index, string type, PostData<object> body, Func<DeleteByQueryRequestParameters, DeleteByQueryRequestParameters> requestParameters = null)
where T : class => this.DoRequestAsync<T>(DELETE, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_query"), body, _params(requestParameters));

///<summary>Represents a GET on /{index}/_graph/explore
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));

///<summary>Represents a GET on /{index}/_graph/explore
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/_graph/explore"), null, _params(requestParameters));

///<summary>Represents a GET on /{index}/{type}/_graph/explore
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> GraphExploreGet<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));

///<summary>Represents a GET on /{index}/{type}/_graph/explore
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> GraphExploreGetAsync<T>(string index, string type, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), null, _params(requestParameters));

///<summary>Represents a POST on /{index}/_graph/explore
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="body">Graph Query DSL</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> GraphExplore<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));

///<summary>Represents a POST on /{index}/_graph/explore
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="body">Graph Query DSL</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/_graph/explore"), body, _params(requestParameters));

///<summary>Represents a POST on /{index}/{type}/_graph/explore
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
///<param name="body">Graph Query DSL</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> GraphExplore<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));

///<summary>Represents a POST on /{index}/{type}/_graph/explore
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
///<para> - byte[], no deserialization, but the response stream will be closed </para>
///<para> - Stream, no deserialization, response stream is your responsibility </para>
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
///<para>See also: https://www.elastic.co/guide/en/graph/current/explore.html </para>
///</summary>
///<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>
///<param name="type">A comma-separated list of document types to search; leave empty to perform the operation on all types</param>
///<param name="body">Graph Query DSL</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null)
where T : class => this.DoRequestAsync<T>(POST, Url($"{index.NotNull("index")}/{type.NotNull("type")}/_graph/explore"), body, _params(requestParameters));


}
}
Expand Down
Loading