From ac57660f235301297528171ba53e646c2391a7bd Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Tue, 26 Apr 2016 11:06:30 +0200 Subject: [PATCH 01/13] Started on ingest API support --- .../CodeGeneration.LowLevelClient.csproj | 6 + .../Core/ingest.simulate.json | 2 +- .../RequestParameters.Generated.cs | 36 +-- .../ElasticLowLevelClient.Generated.cs | 44 ++-- .../IElasticLowLevelClient.Generated.cs | 36 +-- .../DeletePipeline/DeletePipelineRequest.cs | 9 + .../DeletePipeline/DeletePipelineResponse.cs | 12 + .../ElasticClient-DeletePipeline.cs | 46 ++++ .../GetPipeline/ElasticClient-GetPipeline.cs | 48 ++++ .../Ingest/GetPipeline/GetPipelineRequest.cs | 9 + .../Ingest/GetPipeline/GetPipelineResponse.cs | 16 ++ src/Nest/Ingest/Processor.cs | 38 +++ src/Nest/Ingest/Processors/AppendProcessor.cs | 46 ++++ .../Ingest/Processors/ConvertProcessor.cs | 66 +++++ src/Nest/Ingest/ProcessorsDescriptor.cs | 13 + .../PutPipeline/ElasticClient-PutPipeline.cs | 42 ++++ .../Ingest/PutPipeline/PutPipelineRequest.cs | 51 ++++ .../Ingest/PutPipeline/PutPipelineResponse.cs | 12 + .../ElasticClient-SimulatePipeline.cs | 42 ++++ .../SimulatePiipelineResponse.cs | 12 + .../SimulatePipelineRequest.cs | 23 ++ src/Nest/Nest.csproj | 12 + src/Nest/_Generated/_Descriptors.generated.cs | 66 ++--- .../_Generated/_LowLevelDispatch.generated.cs | 20 +- src/Nest/_Generated/_Requests.generated.cs | 236 +++++++++--------- .../CodeStandards/NamingConventions.doc.cs | 4 - .../DeletePipeline/DeletePipelineApiTests.cs | 33 +++ .../DeletePipeline/DeletePipelineUrlTests.cs | 22 ++ .../Ingest/GetPipeline/GetPipelineApiTests.cs | 33 +++ .../Ingest/GetPipeline/GetPipelineUrlTests.cs | 22 ++ .../Ingest/PutPipeline/PutPipelineApiTests.cs | 44 ++++ .../Ingest/PutPipeline/PutPipelineUrlTests.cs | 22 ++ .../SImulatePipelineApiTests.cs | 40 +++ .../SimulatePipelineUrlTests.cs | 28 +++ src/Tests/Tests.csproj | 9 + src/Tests/tests.yaml | 2 +- 36 files changed, 967 insertions(+), 235 deletions(-) create mode 100644 src/Nest/Ingest/DeletePipeline/DeletePipelineRequest.cs create mode 100644 src/Nest/Ingest/DeletePipeline/DeletePipelineResponse.cs create mode 100644 src/Nest/Ingest/DeletePipeline/ElasticClient-DeletePipeline.cs create mode 100644 src/Nest/Ingest/GetPipeline/ElasticClient-GetPipeline.cs create mode 100644 src/Nest/Ingest/GetPipeline/GetPipelineRequest.cs create mode 100644 src/Nest/Ingest/GetPipeline/GetPipelineResponse.cs create mode 100644 src/Nest/Ingest/Processor.cs create mode 100644 src/Nest/Ingest/Processors/AppendProcessor.cs create mode 100644 src/Nest/Ingest/Processors/ConvertProcessor.cs create mode 100644 src/Nest/Ingest/ProcessorsDescriptor.cs create mode 100644 src/Nest/Ingest/PutPipeline/ElasticClient-PutPipeline.cs create mode 100644 src/Nest/Ingest/PutPipeline/PutPipelineRequest.cs create mode 100644 src/Nest/Ingest/PutPipeline/PutPipelineResponse.cs create mode 100644 src/Nest/Ingest/SimulatePipeline/ElasticClient-SimulatePipeline.cs create mode 100644 src/Nest/Ingest/SimulatePipeline/SimulatePiipelineResponse.cs create mode 100644 src/Nest/Ingest/SimulatePipeline/SimulatePipelineRequest.cs create mode 100644 src/Tests/Ingest/DeletePipeline/DeletePipelineApiTests.cs create mode 100644 src/Tests/Ingest/DeletePipeline/DeletePipelineUrlTests.cs create mode 100644 src/Tests/Ingest/GetPipeline/GetPipelineApiTests.cs create mode 100644 src/Tests/Ingest/GetPipeline/GetPipelineUrlTests.cs create mode 100644 src/Tests/Ingest/PutPipeline/PutPipelineApiTests.cs create mode 100644 src/Tests/Ingest/PutPipeline/PutPipelineUrlTests.cs create mode 100644 src/Tests/Ingest/SimulatePipeline/SImulatePipelineApiTests.cs create mode 100644 src/Tests/Ingest/SimulatePipeline/SimulatePipelineUrlTests.cs diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj index 78e9f51af64..f5cd8699b90 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj @@ -98,6 +98,7 @@ + @@ -153,6 +154,10 @@ + + + + @@ -165,6 +170,7 @@ + diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/Core/ingest.simulate.json b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/Core/ingest.simulate.json index a4904cef80a..d02f97d81dd 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/Core/ingest.simulate.json +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/Core/ingest.simulate.json @@ -4,7 +4,7 @@ "methods": [ "GET", "POST" ], "url": { "path": "/_ingest/pipeline/_simulate", - "paths": [ "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate/" ], + "paths": [ "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate" ], "parts": { "id": { "type" : "string", diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs index 9ce1c871222..3b511e23a70 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs @@ -3005,24 +3005,24 @@ public class RootNodeInfoRequestParameters : FluentRequestParameters /// - public class IngestDeletePipelineRequestParameters : FluentRequestParameters + public class DeletePipelineRequestParameters : FluentRequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; ///Explicit operation timeout for connection to master node - public IngestDeletePipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); + public DeletePipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); ///Explicit operation timeout - public IngestDeletePipelineRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); + public DeletePipelineRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); ///The URL-encoded request definition - public IngestDeletePipelineRequestParameters Source(string source) => this.AddQueryString("source", source); + public DeletePipelineRequestParameters Source(string source) => this.AddQueryString("source", source); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestDeletePipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + public DeletePipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); } @@ -3031,20 +3031,20 @@ public class IngestDeletePipelineRequestParameters : FluentRequestParameters /// - public class IngestGetPipelineRequestParameters : FluentRequestParameters + public class GetPipelineRequestParameters : FluentRequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.GET; ///Explicit operation timeout for connection to master node - public IngestGetPipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); + public GetPipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); ///The URL-encoded request definition - public IngestGetPipelineRequestParameters Source(string source) => this.AddQueryString("source", source); + public GetPipelineRequestParameters Source(string source) => this.AddQueryString("source", source); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestGetPipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + public GetPipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); } @@ -3053,24 +3053,24 @@ public class IngestGetPipelineRequestParameters : FluentRequestParameters /// - public class IngestPutPipelineRequestParameters : FluentRequestParameters + public class PutPipelineRequestParameters : FluentRequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; ///Explicit operation timeout for connection to master node - public IngestPutPipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); + public PutPipelineRequestParameters MasterTimeout(TimeSpan master_timeout) => this.AddQueryString("master_timeout", master_timeout.ToTimeUnit()); ///Explicit operation timeout - public IngestPutPipelineRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); + public PutPipelineRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); ///The URL-encoded request definition - public IngestPutPipelineRequestParameters Source(string source) => this.AddQueryString("source", source); + public PutPipelineRequestParameters Source(string source) => this.AddQueryString("source", source); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestPutPipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + public PutPipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); } @@ -3079,20 +3079,20 @@ public class IngestPutPipelineRequestParameters : FluentRequestParameters /// - public class IngestSimulateRequestParameters : FluentRequestParameters + public class SimulatePipelineRequestParameters : FluentRequestParameters { public override HttpMethod DefaultHttpMethod => HttpMethod.POST; ///Verbose mode. Display data output for each processor in executed pipeline - public IngestSimulateRequestParameters Verbose(bool verbose) => this.AddQueryString("verbose", verbose); + public SimulatePipelineRequestParameters Verbose(bool verbose) => this.AddQueryString("verbose", verbose); ///The URL-encoded request definition - public IngestSimulateRequestParameters Source(string source) => this.AddQueryString("source", source); + public SimulatePipelineRequestParameters Source(string source) => this.AddQueryString("source", source); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestSimulateRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); + public SimulatePipelineRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path); } diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs index 3f06810a8fa..599ea41c492 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs @@ -4596,7 +4596,7 @@ public Task> InfoAsync(Func ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestDeletePipeline(string id, Func requestParameters = null) + public ElasticsearchResponse IngestDeletePipeline(string id, Func requestParameters = null) where T : class => this.DoRequest(DELETE, Url($"_ingest/pipeline/{id.NotNull("id")}"), null, _params(requestParameters)); ///Represents a DELETE on /_ingest/pipeline/{id} @@ -4610,7 +4610,7 @@ public ElasticsearchResponse IngestDeletePipeline(string id, Func ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestDeletePipelineAsync(string id, Func requestParameters = null) + public Task> IngestDeletePipelineAsync(string id, Func requestParameters = null) where T : class => this.DoRequestAsync(DELETE, Url($"_ingest/pipeline/{id.NotNull("id")}"), null, _params(requestParameters)); ///Represents a GET on /_ingest/pipeline/{id} @@ -4624,7 +4624,7 @@ public Task> IngestDeletePipelineAsync(string id, Fu /// ///Comma separated list of pipeline ids. Wildcards supported ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestGetPipeline(string id, Func requestParameters = null) + public ElasticsearchResponse IngestGetPipeline(string id, Func requestParameters = null) where T : class => this.DoRequest(GET, Url($"_ingest/pipeline/{id.NotNull("id")}"), null, _params(requestParameters)); ///Represents a GET on /_ingest/pipeline/{id} @@ -4638,7 +4638,7 @@ public ElasticsearchResponse IngestGetPipeline(string id, Func ///Comma separated list of pipeline ids. Wildcards supported ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestGetPipelineAsync(string id, Func requestParameters = null) + public Task> IngestGetPipelineAsync(string id, Func requestParameters = null) where T : class => this.DoRequestAsync(GET, Url($"_ingest/pipeline/{id.NotNull("id")}"), null, _params(requestParameters)); ///Represents a PUT on /_ingest/pipeline/{id} @@ -4653,7 +4653,7 @@ public Task> IngestGetPipelineAsync(string id, Func< ///Pipeline ID ///The ingest definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestPutPipeline(string id, PostData body, Func requestParameters = null) + public ElasticsearchResponse IngestPutPipeline(string id, PostData body, Func requestParameters = null) where T : class => this.DoRequest(PUT, Url($"_ingest/pipeline/{id.NotNull("id")}"), body, _params(requestParameters)); ///Represents a PUT on /_ingest/pipeline/{id} @@ -4668,7 +4668,7 @@ public ElasticsearchResponse IngestPutPipeline(string id, PostData ///Pipeline ID ///The ingest definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestPutPipelineAsync(string id, PostData body, Func requestParameters = null) + public Task> IngestPutPipelineAsync(string id, PostData body, Func requestParameters = null) where T : class => this.DoRequestAsync(PUT, Url($"_ingest/pipeline/{id.NotNull("id")}"), body, _params(requestParameters)); ///Represents a GET on /_ingest/pipeline/_simulate @@ -4681,7 +4681,7 @@ public Task> IngestPutPipelineAsync(string id, PostD ///See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html /// ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestSimulateGet(Func requestParameters = null) + public ElasticsearchResponse IngestSimulateGet(Func requestParameters = null) where T : class => this.DoRequest(GET, Url($"_ingest/pipeline/_simulate"), null, _params(requestParameters)); ///Represents a GET on /_ingest/pipeline/_simulate @@ -4694,10 +4694,10 @@ public ElasticsearchResponse IngestSimulateGet(FuncSee also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html /// ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestSimulateGetAsync(Func requestParameters = null) + public Task> IngestSimulateGetAsync(Func requestParameters = null) where T : class => this.DoRequestAsync(GET, Url($"_ingest/pipeline/_simulate"), null, _params(requestParameters)); - ///Represents a GET on /_ingest/pipeline/{id}/_simulate/ + ///Represents a GET on /_ingest/pipeline/{id}/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4708,10 +4708,10 @@ public Task> IngestSimulateGetAsync(Func ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestSimulateGet(string id, Func requestParameters = null) - where T : class => this.DoRequest(GET, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate/"), null, _params(requestParameters)); + public ElasticsearchResponse IngestSimulateGet(string id, Func requestParameters = null) + where T : class => this.DoRequest(GET, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate"), null, _params(requestParameters)); - ///Represents a GET on /_ingest/pipeline/{id}/_simulate/ + ///Represents a GET on /_ingest/pipeline/{id}/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4722,8 +4722,8 @@ public ElasticsearchResponse IngestSimulateGet(string id, Func ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestSimulateGetAsync(string id, Func requestParameters = null) - where T : class => this.DoRequestAsync(GET, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate/"), null, _params(requestParameters)); + public Task> IngestSimulateGetAsync(string id, Func requestParameters = null) + where T : class => this.DoRequestAsync(GET, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate"), null, _params(requestParameters)); ///Represents a POST on /_ingest/pipeline/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: @@ -4736,7 +4736,7 @@ public Task> IngestSimulateGetAsync(string id, Func< /// ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestSimulate(PostData body, Func requestParameters = null) + public ElasticsearchResponse IngestSimulate(PostData body, Func requestParameters = null) where T : class => this.DoRequest(POST, Url($"_ingest/pipeline/_simulate"), body, _params(requestParameters)); ///Represents a POST on /_ingest/pipeline/_simulate @@ -4750,10 +4750,10 @@ public ElasticsearchResponse IngestSimulate(PostData body, Func ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestSimulateAsync(PostData body, Func requestParameters = null) + public Task> IngestSimulateAsync(PostData body, Func requestParameters = null) where T : class => this.DoRequestAsync(POST, Url($"_ingest/pipeline/_simulate"), body, _params(requestParameters)); - ///Represents a POST on /_ingest/pipeline/{id}/_simulate/ + ///Represents a POST on /_ingest/pipeline/{id}/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4765,10 +4765,10 @@ public Task> IngestSimulateAsync(PostData bo ///Pipeline ID ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public ElasticsearchResponse IngestSimulate(string id, PostData body, Func requestParameters = null) - where T : class => this.DoRequest(POST, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate/"), body, _params(requestParameters)); + public ElasticsearchResponse IngestSimulate(string id, PostData body, Func requestParameters = null) + where T : class => this.DoRequest(POST, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate"), body, _params(requestParameters)); - ///Represents a POST on /_ingest/pipeline/{id}/_simulate/ + ///Represents a POST on /_ingest/pipeline/{id}/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4780,8 +4780,8 @@ public ElasticsearchResponse IngestSimulate(string id, PostData bo ///Pipeline ID ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - public Task> IngestSimulateAsync(string id, PostData body, Func requestParameters = null) - where T : class => this.DoRequestAsync(POST, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate/"), body, _params(requestParameters)); + public Task> IngestSimulateAsync(string id, PostData body, Func requestParameters = null) + where T : class => this.DoRequestAsync(POST, Url($"_ingest/pipeline/{id.NotNull("id")}/_simulate"), body, _params(requestParameters)); ///Represents a GET on /_mget ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: diff --git a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs index 75f13081338..eda1a18a658 100644 --- a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs @@ -4281,7 +4281,7 @@ public partial interface IElasticLowLevelClient /// ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestDeletePipeline(string id, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestDeletePipeline(string id, Func requestParameters = null) where T : class; ///Represents a DELETE on /_ingest/pipeline/{id} ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: @@ -4294,7 +4294,7 @@ public partial interface IElasticLowLevelClient /// ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestDeletePipelineAsync(string id, Func requestParameters = null) where T : class; + Task> IngestDeletePipelineAsync(string id, Func requestParameters = null) where T : class; ///Represents a GET on /_ingest/pipeline/{id} ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: @@ -4307,7 +4307,7 @@ public partial interface IElasticLowLevelClient /// ///Comma separated list of pipeline ids. Wildcards supported ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestGetPipeline(string id, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestGetPipeline(string id, Func requestParameters = null) where T : class; ///Represents a GET on /_ingest/pipeline/{id} ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: @@ -4320,7 +4320,7 @@ public partial interface IElasticLowLevelClient /// ///Comma separated list of pipeline ids. Wildcards supported ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestGetPipelineAsync(string id, Func requestParameters = null) where T : class; + Task> IngestGetPipelineAsync(string id, Func requestParameters = null) where T : class; ///Represents a PUT on /_ingest/pipeline/{id} ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: @@ -4334,7 +4334,7 @@ public partial interface IElasticLowLevelClient ///Pipeline ID ///The ingest definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestPutPipeline(string id, PostData body, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestPutPipeline(string id, PostData body, Func requestParameters = null) where T : class; ///Represents a PUT on /_ingest/pipeline/{id} ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: @@ -4348,7 +4348,7 @@ public partial interface IElasticLowLevelClient ///Pipeline ID ///The ingest definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestPutPipelineAsync(string id, PostData body, Func requestParameters = null) where T : class; + Task> IngestPutPipelineAsync(string id, PostData body, Func requestParameters = null) where T : class; ///Represents a GET on /_ingest/pipeline/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: @@ -4360,7 +4360,7 @@ public partial interface IElasticLowLevelClient ///See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html /// ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestSimulateGet(Func requestParameters = null) where T : class; + ElasticsearchResponse IngestSimulateGet(Func requestParameters = null) where T : class; ///Represents a GET on /_ingest/pipeline/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: @@ -4372,9 +4372,9 @@ public partial interface IElasticLowLevelClient ///See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html /// ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestSimulateGetAsync(Func requestParameters = null) where T : class; + Task> IngestSimulateGetAsync(Func requestParameters = null) where T : class; - ///Represents a GET on /_ingest/pipeline/{id}/_simulate/ + ///Represents a GET on /_ingest/pipeline/{id}/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4385,9 +4385,9 @@ public partial interface IElasticLowLevelClient /// ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestSimulateGet(string id, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestSimulateGet(string id, Func requestParameters = null) where T : class; - ///Represents a GET on /_ingest/pipeline/{id}/_simulate/ + ///Represents a GET on /_ingest/pipeline/{id}/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4398,7 +4398,7 @@ public partial interface IElasticLowLevelClient /// ///Pipeline ID ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestSimulateGetAsync(string id, Func requestParameters = null) where T : class; + Task> IngestSimulateGetAsync(string id, Func requestParameters = null) where T : class; ///Represents a POST on /_ingest/pipeline/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: @@ -4411,7 +4411,7 @@ public partial interface IElasticLowLevelClient /// ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestSimulate(PostData body, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestSimulate(PostData body, Func requestParameters = null) where T : class; ///Represents a POST on /_ingest/pipeline/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: @@ -4424,9 +4424,9 @@ public partial interface IElasticLowLevelClient /// ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestSimulateAsync(PostData body, Func requestParameters = null) where T : class; + Task> IngestSimulateAsync(PostData body, Func requestParameters = null) where T : class; - ///Represents a POST on /_ingest/pipeline/{id}/_simulate/ + ///Represents a POST on /_ingest/pipeline/{id}/_simulate ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4438,9 +4438,9 @@ public partial interface IElasticLowLevelClient ///Pipeline ID ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - ElasticsearchResponse IngestSimulate(string id, PostData body, Func requestParameters = null) where T : class; + ElasticsearchResponse IngestSimulate(string id, PostData body, Func requestParameters = null) where T : class; - ///Represents a POST on /_ingest/pipeline/{id}/_simulate/ + ///Represents a POST on /_ingest/pipeline/{id}/_simulate ///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T: /// - T, an object you own that the elasticsearch response will be deserialized to /// - byte[], no deserialization, but the response stream will be closed @@ -4452,7 +4452,7 @@ public partial interface IElasticLowLevelClient ///Pipeline ID ///The simulate definition ///A func that allows you to describe the querystring parameters & request specific connection settings. - Task> IngestSimulateAsync(string id, PostData body, Func requestParameters = null) where T : class; + Task> IngestSimulateAsync(string id, PostData body, Func requestParameters = null) where T : class; ///Represents a GET on /_mget ///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T: diff --git a/src/Nest/Ingest/DeletePipeline/DeletePipelineRequest.cs b/src/Nest/Ingest/DeletePipeline/DeletePipelineRequest.cs new file mode 100644 index 00000000000..5119ed8b7d7 --- /dev/null +++ b/src/Nest/Ingest/DeletePipeline/DeletePipelineRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + public partial interface IDeletePipelineRequest { } + + public partial class DeletePipelineRequest { } + + [DescriptorFor("IngestDeletePipeline")] + public partial class DeletePipelineDescriptor { } +} diff --git a/src/Nest/Ingest/DeletePipeline/DeletePipelineResponse.cs b/src/Nest/Ingest/DeletePipeline/DeletePipelineResponse.cs new file mode 100644 index 00000000000..8d18b0dd9f0 --- /dev/null +++ b/src/Nest/Ingest/DeletePipeline/DeletePipelineResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Nest +{ + public interface IDeletePipelineResponse : IAcknowledgedResponse { } + + public class DeletePipelineResponse : AcknowledgedResponseBase, IDeletePipelineResponse { } +} diff --git a/src/Nest/Ingest/DeletePipeline/ElasticClient-DeletePipeline.cs b/src/Nest/Ingest/DeletePipeline/ElasticClient-DeletePipeline.cs new file mode 100644 index 00000000000..387bfd16776 --- /dev/null +++ b/src/Nest/Ingest/DeletePipeline/ElasticClient-DeletePipeline.cs @@ -0,0 +1,46 @@ +using System; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + IDeletePipelineResponse DeletePipeline( Id id, Func selector = null); + + /// + IDeletePipelineResponse DeletePipeline(IDeletePipelineRequest request); + + /// + Task DeletePipelineAsync( Id id, Func selector = null); + + /// + Task DeletePipelineAsync(IDeletePipelineRequest request); + + } + public partial class ElasticClient + { + /// + public IDeletePipelineResponse DeletePipeline(IDeletePipelineRequest request) => + this.Dispatcher.Dispatch( + request, + (p, d) => this.LowLevelDispatch.IngestDeletePipelineDispatch(p) + ); + + /// + public IDeletePipelineResponse DeletePipeline( Id id, Func selector = null) => + this.DeletePipeline(selector.InvokeOrDefault(new DeletePipelineDescriptor( id))); + + /// + public Task DeletePipelineAsync( Id id, Func selector = null) => + this.DeletePipelineAsync(selector.InvokeOrDefault(new DeletePipelineDescriptor( id))); + + /// + public Task DeletePipelineAsync(IDeletePipelineRequest request) => + this.Dispatcher.DispatchAsync( + request, + (p, d) => this.LowLevelDispatch.IngestDeletePipelineDispatchAsync(p) + ); + } +} diff --git a/src/Nest/Ingest/GetPipeline/ElasticClient-GetPipeline.cs b/src/Nest/Ingest/GetPipeline/ElasticClient-GetPipeline.cs new file mode 100644 index 00000000000..7f9dc8d58d2 --- /dev/null +++ b/src/Nest/Ingest/GetPipeline/ElasticClient-GetPipeline.cs @@ -0,0 +1,48 @@ +using System; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + + /// + IGetPipelineResponse GetPipeline(Id id, Func selector = null); + + /// + IGetPipelineResponse GetPipeline(IGetPipelineRequest request); + + /// + Task GetPipelineAsync(Id id, Func selector = null); + + /// + Task GetPipelineAsync(IGetPipelineRequest request); + } + + + public partial class ElasticClient + { + /// + public IGetPipelineResponse GetPipeline( Id id, Func selector = null) => + this.GetPipeline(selector.InvokeOrDefault(new GetPipelineDescriptor( id))); + + /// + public IGetPipelineResponse GetPipeline(IGetPipelineRequest request) => + this.Dispatcher.Dispatch( + request, + (p, d) => this.LowLevelDispatch.IngestGetPipelineDispatch(p) + ); + + /// + public Task GetPipelineAsync(Id id, Func selector = null) => + this.GetPipelineAsync(selector.InvokeOrDefault(new GetPipelineDescriptor( id))); + + /// + public Task GetPipelineAsync(IGetPipelineRequest request) => + this.Dispatcher.DispatchAsync( + request, + (p, d) => this.LowLevelDispatch.IngestGetPipelineDispatchAsync(p) + ); + } +} diff --git a/src/Nest/Ingest/GetPipeline/GetPipelineRequest.cs b/src/Nest/Ingest/GetPipeline/GetPipelineRequest.cs new file mode 100644 index 00000000000..37297bc8070 --- /dev/null +++ b/src/Nest/Ingest/GetPipeline/GetPipelineRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + public partial interface IGetPipelineRequest { } + + public partial class GetPipelineRequest { } + + [DescriptorFor("IngestGetPipeline")] + public partial class GetPipelineDescriptor { } +} diff --git a/src/Nest/Ingest/GetPipeline/GetPipelineResponse.cs b/src/Nest/Ingest/GetPipeline/GetPipelineResponse.cs new file mode 100644 index 00000000000..9d48e281a54 --- /dev/null +++ b/src/Nest/Ingest/GetPipeline/GetPipelineResponse.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace Nest +{ + public interface IGetPipelineResponse : IResponse + { + string Pipeline { get; } + } + + [JsonObject(MemberSerialization.OptIn)] + public class GetPipelineResponse : ResponseBase, IGetPipelineResponse + { + [JsonProperty("script")] + public string Pipeline { get; set; } + } +} diff --git a/src/Nest/Ingest/Processor.cs b/src/Nest/Ingest/Processor.cs new file mode 100644 index 00000000000..19ee29097e5 --- /dev/null +++ b/src/Nest/Ingest/Processor.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + public interface IProcessor + { + string Name { get; } + + [JsonProperty("on_failure")] + IEnumerable OnFailure { get; set; } + } + + public abstract class ProcessorBase : IProcessor + { + string IProcessor.Name => this.Name; + protected virtual string Name { get; } + + public IEnumerable OnFailure { get; set; } + } + + public abstract class ProcessorDescriptorBase : DescriptorBase, IProcessor + where TProcessorDescriptor : ProcessorDescriptorBase, TProcessorInterface + where TProcessorInterface : class, IProcessor + { + IEnumerable IProcessor.OnFailure { get; set; } + string IProcessor.Name => this.Name; + protected virtual string Name { get; } + + /// + public TProcessorDescriptor OnFailure(IEnumerable processors) => Assign(a => a.OnFailure = processors.ToListOrNullIfEmpty()); + + /// + public TProcessorDescriptor OnFailure(Func>> selector) => + Assign(a => a.OnFailure = selector?.Invoke(new ProcessorsDescriptor())?.Value); + } +} diff --git a/src/Nest/Ingest/Processors/AppendProcessor.cs b/src/Nest/Ingest/Processors/AppendProcessor.cs new file mode 100644 index 00000000000..82c5134c2e7 --- /dev/null +++ b/src/Nest/Ingest/Processors/AppendProcessor.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Newtonsoft.Json; + +namespace Nest +{ + public interface IAppendProcessor : IProcessor + { + [JsonProperty("field")] + Field Field { get; set; } + [JsonProperty("values")] + IEnumerable Values { get; set; } + } + + public class AppendProcessor : ProcessorBase, IAppendProcessor + { + protected override string Name => "append"; + public Field Field { get; set; } + public IEnumerable Values { get; set; } + } + + public class AppendProcessorDescriptor : ProcessorDescriptorBase, IAppendProcessor>, IAppendProcessor + where T : class + { + protected override string Name => "append"; + Field IAppendProcessor.Field { get; set; } + IEnumerable IAppendProcessor.Values { get; set; } + + public AppendProcessorDescriptor Field(Field field) => Assign(a => a.Field = field); + + public AppendProcessorDescriptor Field(Expression> objectPath) => + Assign(a => a.Field = objectPath); + + public AppendProcessorDescriptor Terms(IEnumerable terms) => Assign(a => a.Values = terms?.Cast()); + + public AppendProcessorDescriptor Terms(params TValue[] terms) => Assign(a => { + if(terms?.Length == 1 && typeof(IEnumerable).IsAssignableFrom(typeof(TValue)) && typeof(TValue) != typeof(string)) + a.Values = (terms.First() as IEnumerable)?.Cast(); + else a.Values = terms?.Cast(); + }); + } + +} diff --git a/src/Nest/Ingest/Processors/ConvertProcessor.cs b/src/Nest/Ingest/Processors/ConvertProcessor.cs new file mode 100644 index 00000000000..fac9dcaf17f --- /dev/null +++ b/src/Nest/Ingest/Processors/ConvertProcessor.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Nest +{ + public interface IConvertProcessor : IProcessor + { + [JsonProperty("field")] + Field Field { get; set; } + [JsonProperty("target_field")] + Field TargetField { get; set; } + [JsonProperty("type")] + ConvertProcessorType? Type { get; set; } + } + + public class ConvertProcessor : ProcessorBase, IConvertProcessor + { + protected override string Name => "convert"; + public Field Field { get; set; } + public Field TargetField { get; set; } + public ConvertProcessorType? Type { get; set; } + } + + public class ConvertProcessorDescriptor : ProcessorDescriptorBase, IConvertProcessor>, IConvertProcessor + where T : class + { + protected override string Name => "convert"; + Field IConvertProcessor.Field { get; set; } + Field IConvertProcessor.TargetField { get; set; } + ConvertProcessorType? IConvertProcessor.Type { get; set; } + + public ConvertProcessorDescriptor Field(Field field) => Assign(a => a.Field = field); + + public ConvertProcessorDescriptor Field(Expression> objectPath) => + Assign(a => a.Field = objectPath); + + public ConvertProcessorDescriptor TargetField(Field field) => Assign(a => a.TargetField = field); + + public ConvertProcessorDescriptor TargetField(Expression> objectPath) => + Assign(a => a.TargetField = objectPath); + + public ConvertProcessorDescriptor Type(ConvertProcessorType? type) => Assign(a => a.Type = type); + } + + [JsonConverter(typeof(StringEnumConverter))] + public enum ConvertProcessorType + { + [EnumMember(Value="integer")] + Integer, + [EnumMember(Value="float")] + Float, + [EnumMember(Value="string")] + String, + [EnumMember(Value="boolean")] + Boolean, + [EnumMember(Value="auto")] + Auto + } + +} diff --git a/src/Nest/Ingest/ProcessorsDescriptor.cs b/src/Nest/Ingest/ProcessorsDescriptor.cs new file mode 100644 index 00000000000..2aae9e2d642 --- /dev/null +++ b/src/Nest/Ingest/ProcessorsDescriptor.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace Nest +{ + public class ProcessorsDescriptor : DescriptorPromiseBase> + { + public ProcessorsDescriptor() : base(new List()) { } + + public ProcessorsDescriptor Append(Func, IAppendProcessor> selector) where T : class => + Assign(a => a.AddIfNotNull(selector?.Invoke(new AppendProcessorDescriptor()))); + } +} diff --git a/src/Nest/Ingest/PutPipeline/ElasticClient-PutPipeline.cs b/src/Nest/Ingest/PutPipeline/ElasticClient-PutPipeline.cs new file mode 100644 index 00000000000..9875e2372f4 --- /dev/null +++ b/src/Nest/Ingest/PutPipeline/ElasticClient-PutPipeline.cs @@ -0,0 +1,42 @@ +using System; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + IPutPipelineResponse PutPipeline(Id id, Func selector); + + /// + IPutPipelineResponse PutPipeline(IPutPipelineRequest request); + + /// + Task PutPipelineAsync(Id id, Func selector); + + /// + Task PutPipelineAsync(IPutPipelineRequest request); + + } + public partial class ElasticClient + { + public IPutPipelineResponse PutPipeline(Id id, Func selector) => + this.PutPipeline(selector?.Invoke(new PutPipelineDescriptor(id))); + + public IPutPipelineResponse PutPipeline(IPutPipelineRequest request) => + this.Dispatcher.Dispatch( + request, + this.LowLevelDispatch.IngestPutPipelineDispatch + ); + + public Task PutPipelineAsync(Id id, Func selector) => + this.PutPipelineAsync(selector?.Invoke(new PutPipelineDescriptor(id))); + + public Task PutPipelineAsync(IPutPipelineRequest request) => + this.Dispatcher.DispatchAsync( + request, + this.LowLevelDispatch.IngestPutPipelineDispatchAsync + ); + } +} diff --git a/src/Nest/Ingest/PutPipeline/PutPipelineRequest.cs b/src/Nest/Ingest/PutPipeline/PutPipelineRequest.cs new file mode 100644 index 00000000000..44a4b82180a --- /dev/null +++ b/src/Nest/Ingest/PutPipeline/PutPipelineRequest.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + public partial interface IPutPipelineRequest + { + [JsonProperty("description")] + string Description { get; set; } + + [JsonProperty("processors")] + IEnumerable Processors { get; set; } + + [JsonProperty("on_failure")] + IEnumerable OnFailure { get; set; } + + } + + public partial class PutPipelineRequest + { + public string Description { get; set; } + public IEnumerable Processors { get; set; } + public IEnumerable OnFailure { get; set; } + } + + [DescriptorFor("IngestPutPipeline")] + public partial class PutPipelineDescriptor + { + string IPutPipelineRequest.Description { get; set; } + IEnumerable IPutPipelineRequest.Processors { get; set; } + IEnumerable IPutPipelineRequest.OnFailure { get; set; } + + /// + public PutPipelineDescriptor Description(string description) => Assign(a => a.Description = description); + + /// + public PutPipelineDescriptor Processors(IEnumerable processors) => Assign(a => a.Processors = processors.ToListOrNullIfEmpty()); + + /// + public PutPipelineDescriptor Processors(Func>> selector) => + Assign(a => a.Processors = selector?.Invoke(new ProcessorsDescriptor())?.Value); + + /// + public PutPipelineDescriptor OnFailure(IEnumerable processors) => Assign(a => a.OnFailure = processors.ToListOrNullIfEmpty()); + + /// + public PutPipelineDescriptor OnFailure(Func>> selector) => + Assign(a => a.OnFailure = selector?.Invoke(new ProcessorsDescriptor())?.Value); + } +} diff --git a/src/Nest/Ingest/PutPipeline/PutPipelineResponse.cs b/src/Nest/Ingest/PutPipeline/PutPipelineResponse.cs new file mode 100644 index 00000000000..092b760d0cb --- /dev/null +++ b/src/Nest/Ingest/PutPipeline/PutPipelineResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Nest +{ + public interface IPutPipelineResponse : IAcknowledgedResponse { } + + public class PutPipelineResponse : AcknowledgedResponseBase, IPutPipelineResponse { } +} diff --git a/src/Nest/Ingest/SimulatePipeline/ElasticClient-SimulatePipeline.cs b/src/Nest/Ingest/SimulatePipeline/ElasticClient-SimulatePipeline.cs new file mode 100644 index 00000000000..9d81d2d894b --- /dev/null +++ b/src/Nest/Ingest/SimulatePipeline/ElasticClient-SimulatePipeline.cs @@ -0,0 +1,42 @@ +using System; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + ISimulatePipelineResponse SimulatePipeline(Func selector); + + /// + ISimulatePipelineResponse SimulatePipeline(ISimulatePipelineRequest request); + + /// + Task SimulatePipelineAsync(Func selector); + + /// + Task SimulatePipelineAsync(ISimulatePipelineRequest request); + + } + public partial class ElasticClient + { + public ISimulatePipelineResponse SimulatePipeline(Func selector) => + this.SimulatePipeline(selector?.Invoke(new SimulatePipelineDescriptor())); + + public ISimulatePipelineResponse SimulatePipeline(ISimulatePipelineRequest request) => + this.Dispatcher.Dispatch( + request, + this.LowLevelDispatch.IngestSimulateDispatch + ); + + public Task SimulatePipelineAsync(Func selector) => + this.SimulatePipelineAsync(selector?.Invoke(new SimulatePipelineDescriptor())); + + public Task SimulatePipelineAsync(ISimulatePipelineRequest request) => + this.Dispatcher.DispatchAsync( + request, + this.LowLevelDispatch.IngestSimulateDispatchAsync + ); + } +} diff --git a/src/Nest/Ingest/SimulatePipeline/SimulatePiipelineResponse.cs b/src/Nest/Ingest/SimulatePipeline/SimulatePiipelineResponse.cs new file mode 100644 index 00000000000..f976cc42c3f --- /dev/null +++ b/src/Nest/Ingest/SimulatePipeline/SimulatePiipelineResponse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Nest +{ + public interface ISimulatePipelineResponse : IAcknowledgedResponse { } + + public class SimulatePipelineResponse : AcknowledgedResponseBase, ISimulatePipelineResponse { } +} diff --git a/src/Nest/Ingest/SimulatePipeline/SimulatePipelineRequest.cs b/src/Nest/Ingest/SimulatePipeline/SimulatePipelineRequest.cs new file mode 100644 index 00000000000..5c26c65d305 --- /dev/null +++ b/src/Nest/Ingest/SimulatePipeline/SimulatePipelineRequest.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json; + +namespace Nest +{ + public partial interface ISimulatePipelineRequest + { + [JsonProperty("script")] + string Pipeline { get; set; } + } + + public partial class SimulatePipelineRequest + { + public string Pipeline { get; set; } + } + + [DescriptorFor("IngestSimulate")] + public partial class SimulatePipelineDescriptor + { + string ISimulatePipelineRequest.Pipeline { get; set; } + + public SimulatePipelineDescriptor Pipeline(string script) => Assign(a => a.Pipeline = script); + } +} diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index b5cd3a2c327..eda9350a776 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -746,6 +746,18 @@ + + + + + + + + + + + + diff --git a/src/Nest/_Generated/_Descriptors.generated.cs b/src/Nest/_Generated/_Descriptors.generated.cs index 09e9ff64be4..ae4ace9a386 100644 --- a/src/Nest/_Generated/_Descriptors.generated.cs +++ b/src/Nest/_Generated/_Descriptors.generated.cs @@ -3128,106 +3128,94 @@ public partial class RootNodeInfoDescriptor : RequestDescriptorBasedescriptor for IngestDeletePipeline
https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
- public partial class IngestDeletePipelineDescriptor : RequestDescriptorBase, IIngestDeletePipelineRequest + public partial class DeletePipelineDescriptor : RequestDescriptorBase, IDeletePipelineRequest { - Id IIngestDeletePipelineRequest.Id => Self.RouteValues.Get("id"); + Id IDeletePipelineRequest.Id => Self.RouteValues.Get("id"); /// /_ingest/pipeline/{id} /// this parameter is required - public IngestDeletePipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} + public DeletePipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} ///Explicit operation timeout for connection to master node - public IngestDeletePipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); + public DeletePipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); ///Explicit operation timeout - public IngestDeletePipelineDescriptor Timeout(Time timeout) => AssignParam(p=>p.Timeout(timeout.ToTimeSpan())); + public DeletePipelineDescriptor Timeout(Time timeout) => AssignParam(p=>p.Timeout(timeout.ToTimeSpan())); ///The URL-encoded request definition - public IngestDeletePipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + public DeletePipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestDeletePipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); - - //TODO THIS METHOD IS UNMAPPED! - + public DeletePipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); } ///descriptor for IngestGetPipeline
https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
- public partial class IngestGetPipelineDescriptor : RequestDescriptorBase, IIngestGetPipelineRequest + public partial class GetPipelineDescriptor : RequestDescriptorBase, IGetPipelineRequest { - Id IIngestGetPipelineRequest.Id => Self.RouteValues.Get("id"); + Id IGetPipelineRequest.Id => Self.RouteValues.Get("id"); /// /_ingest/pipeline/{id} /// this parameter is required - public IngestGetPipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} + public GetPipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} ///Explicit operation timeout for connection to master node - public IngestGetPipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); + public GetPipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); ///The URL-encoded request definition - public IngestGetPipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + public GetPipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestGetPipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); - - //TODO THIS METHOD IS UNMAPPED! - + public GetPipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); } ///descriptor for IngestPutPipeline
https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
- public partial class IngestPutPipelineDescriptor : RequestDescriptorBase, IIngestPutPipelineRequest + public partial class PutPipelineDescriptor : RequestDescriptorBase, IPutPipelineRequest { - Id IIngestPutPipelineRequest.Id => Self.RouteValues.Get("id"); + Id IPutPipelineRequest.Id => Self.RouteValues.Get("id"); /// /_ingest/pipeline/{id} /// this parameter is required - public IngestPutPipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} + public PutPipelineDescriptor(Id id) : base(r=>r.Required("id", id)){} ///Explicit operation timeout for connection to master node - public IngestPutPipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); + public PutPipelineDescriptor MasterTimeout(Time master_timeout) => AssignParam(p=>p.MasterTimeout(master_timeout.ToTimeSpan())); ///Explicit operation timeout - public IngestPutPipelineDescriptor Timeout(Time timeout) => AssignParam(p=>p.Timeout(timeout.ToTimeSpan())); + public PutPipelineDescriptor Timeout(Time timeout) => AssignParam(p=>p.Timeout(timeout.ToTimeSpan())); ///The URL-encoded request definition - public IngestPutPipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + public PutPipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestPutPipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); - - //TODO THIS METHOD IS UNMAPPED! - + public PutPipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); } ///descriptor for IngestSimulate
https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
- public partial class IngestSimulateDescriptor : RequestDescriptorBase, IIngestSimulateRequest + public partial class SimulatePipelineDescriptor : RequestDescriptorBase, ISimulatePipelineRequest { - Id IIngestSimulateRequest.Id => Self.RouteValues.Get("id"); + Id ISimulatePipelineRequest.Id => Self.RouteValues.Get("id"); /// /_ingest/pipeline/_simulate - public IngestSimulateDescriptor() : base(){} + public SimulatePipelineDescriptor() : base(){} ///Pipeline ID - public IngestSimulateDescriptor Id(Id id) => Assign(a=>a.RouteValues.Optional("id", id)); + public SimulatePipelineDescriptor Id(Id id) => Assign(a=>a.RouteValues.Optional("id", id)); ///Verbose mode. Display data output for each processor in executed pipeline - public IngestSimulateDescriptor Verbose(bool verbose = true) => AssignParam(p=>p.Verbose(verbose)); + public SimulatePipelineDescriptor Verbose(bool verbose = true) => AssignParam(p=>p.Verbose(verbose)); ///The URL-encoded request definition - public IngestSimulateDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + public SimulatePipelineDescriptor Source(string source) => AssignParam(p=>p.Source(source)); ///Comma separated list of filters used to reduce the response returned by Elasticsearch - public IngestSimulateDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); - - //TODO THIS METHOD IS UNMAPPED! - + public SimulatePipelineDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path)); } diff --git a/src/Nest/_Generated/_LowLevelDispatch.generated.cs b/src/Nest/_Generated/_LowLevelDispatch.generated.cs index 9373bd8bac0..a21040417d8 100644 --- a/src/Nest/_Generated/_LowLevelDispatch.generated.cs +++ b/src/Nest/_Generated/_LowLevelDispatch.generated.cs @@ -1994,7 +1994,7 @@ internal Task> InfoDispatchAsync(IRequest IngestDeletePipelineDispatch(IRequest p ) where T : class + internal ElasticsearchResponse IngestDeletePipelineDispatch(IRequest p ) where T : class { switch(p.HttpMethod) { @@ -2006,7 +2006,7 @@ internal ElasticsearchResponse IngestDeletePipelineDispatch(IRequest> IngestDeletePipelineDispatchAsync(IRequest p ) where T : class + internal Task> IngestDeletePipelineDispatchAsync(IRequest p ) where T : class { switch(p.HttpMethod) { @@ -2018,7 +2018,7 @@ internal Task> IngestDeletePipelineDispatchAsync(IRe throw InvalidDispatch("IngestDeletePipeline", p, new [] { DELETE }, "/_ingest/pipeline/{id}"); } - internal ElasticsearchResponse IngestGetPipelineDispatch(IRequest p ) where T : class + internal ElasticsearchResponse IngestGetPipelineDispatch(IRequest p ) where T : class { switch(p.HttpMethod) { @@ -2030,7 +2030,7 @@ internal ElasticsearchResponse IngestGetPipelineDispatch(IRequest> IngestGetPipelineDispatchAsync(IRequest p ) where T : class + internal Task> IngestGetPipelineDispatchAsync(IRequest p ) where T : class { switch(p.HttpMethod) { @@ -2042,7 +2042,7 @@ internal Task> IngestGetPipelineDispatchAsync(IReque throw InvalidDispatch("IngestGetPipeline", p, new [] { GET }, "/_ingest/pipeline/{id}"); } - internal ElasticsearchResponse IngestPutPipelineDispatch(IRequest p , PostData body) where T : class + internal ElasticsearchResponse IngestPutPipelineDispatch(IRequest p , PostData body) where T : class { switch(p.HttpMethod) { @@ -2054,7 +2054,7 @@ internal ElasticsearchResponse IngestPutPipelineDispatch(IRequest> IngestPutPipelineDispatchAsync(IRequest p , PostData body) where T : class + internal Task> IngestPutPipelineDispatchAsync(IRequest p , PostData body) where T : class { switch(p.HttpMethod) { @@ -2066,7 +2066,7 @@ internal Task> IngestPutPipelineDispatchAsync(IReque throw InvalidDispatch("IngestPutPipeline", p, new [] { PUT }, "/_ingest/pipeline/{id}"); } - internal ElasticsearchResponse IngestSimulateDispatch(IRequest p , PostData body) where T : class + internal ElasticsearchResponse IngestSimulateDispatch(IRequest p , PostData body) where T : class { switch(p.HttpMethod) { @@ -2079,10 +2079,10 @@ internal ElasticsearchResponse IngestSimulateDispatch(IRequest(body,u => p.RequestParameters); } - throw InvalidDispatch("IngestSimulate", p, new [] { GET, POST }, "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate/"); + throw InvalidDispatch("IngestSimulate", p, new [] { GET, POST }, "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate"); } - internal Task> IngestSimulateDispatchAsync(IRequest p , PostData body) where T : class + internal Task> IngestSimulateDispatchAsync(IRequest p , PostData body) where T : class { switch(p.HttpMethod) { @@ -2095,7 +2095,7 @@ internal Task> IngestSimulateDispatchAsync(IRequest< return _lowLevel.IngestSimulateAsync(body,u => p.RequestParameters); } - throw InvalidDispatch("IngestSimulate", p, new [] { GET, POST }, "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate/"); + throw InvalidDispatch("IngestSimulate", p, new [] { GET, POST }, "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate"); } internal ElasticsearchResponse MgetDispatch(IRequest p , PostData body) where T : class diff --git a/src/Nest/_Generated/_Requests.generated.cs b/src/Nest/_Generated/_Requests.generated.cs index 40d36ce68a0..80bf1f7e75c 100644 --- a/src/Nest/_Generated/_Requests.generated.cs +++ b/src/Nest/_Generated/_Requests.generated.cs @@ -1760,6 +1760,35 @@ public partial class DeleteLicenseRequest : PlainRequestBase + { + Id Id { get; } + } + ///Request parameters for IngestDeletePipeline
https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
+ public partial class DeletePipelineRequest : PlainRequestBase, IDeletePipelineRequest + { + protected IDeletePipelineRequest Self => this; + Id IDeletePipelineRequest.Id => Self.RouteValues.Get("id"); + /// /_ingest/pipeline/{id} +///this parameter is required + public DeletePipelineRequest(Id id) : base(r=>r.Required("id", id)){} + + + ///Explicit operation timeout for connection to master node + public Time MasterTimeout { get { return Q