From f395ffb9a64575c3922706c6d3aebbe6e3aeb3bc Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Mon, 7 Aug 2017 21:59:24 +1000 Subject: [PATCH] Add ML APIs to client - Unzip ML integration test data tar archives using SharpZipLib. Add net45 compatible version to Tests - Derive XPackMachineLearningCluster from XPackCluster that seeds ML data and includes additional methods for testing ML APIs - Skip ML integration tests for versions < 5.4.0 - Introduce IntegrationTeardown method to close jobs that may be opened as part of tests - Increase concurrent ML job allocations and max open jobs when starting ML cluster - Explain why certain URL parts are not replaced during code generation Remove special treatment for task_id. This no longer seems to be needed. - Specify node startup timeout on ClusterBase starting up an ML cluster with Fiddler attached could take some time so bump the start timeout for it. - Increase the FAKE process tooling timeout --- build/scripts/Tooling.fsx | 3 +- paket-files/paket.restore.cached | 14 + .../ApiGenerator/ApiGenerator.cs | 12 +- .../ApiGenerator/Domain/ApiEndpoint.cs | 15 +- .../ApiGenerator/Domain/ApiQueryParameters.cs | 2 + .../ApiGenerator/Domain/ApiUrlPart.cs | 12 +- .../ApiGenerator/Domain/CsharpMethod.cs | 7 + .../FlushJobDescriptorOverrides.cs | 15 + .../GetAnomalyRecordsDescriptorOverrides.cs | 21 + .../GetBucketsDescriptorOverrides.cs | 22 + .../GetCategoriesDescriptorOverrides.cs | 15 + .../GetInfluencersDescriptorOverrides.cs | 21 + .../GetModelSnapshotsDescriptorOverrides.cs | 19 + .../PostJobDataDescriptorOverrides.cs | 16 + .../RevertModelSnapshotDescriptorOverrides.cs | 14 + .../StartDatafeedDescriptorOverrides.cs | 14 + .../StopDatafeedDescriptorOverrides.cs | 13 + .../UpdateModelSnapshotDescriptorOverrides.cs | 13 + src/CodeGeneration/ApiGenerator/Program.cs | 2 +- .../xpack.ml.delete_filter.json | 17 - .../xpack.ml.get_buckets.replace.json | 60 + .../MachineLearning/xpack.ml.get_filters.json | 26 - .../MachineLearning/xpack.ml.put_filter.json | 20 - .../xpack.ml.revert_model_snapshot.patch.json | 11 + .../ElasticLowLevelClient.Generated.cshtml | 16 +- .../RequestParameters.Generated.cs | 864 ++++++++++++ .../ElasticLowLevelClient.Generated.cs | 1196 ++++++++++++++++- .../IElasticLowLevelClient.Generated.cs | 1102 +++++++++++++++ .../Serialization/UrlFormatProvider.cs | 3 + src/Nest/Cluster/ClusterState/NodeState.cs | 2 - .../Extensions/Extensions.cs | 4 +- .../Infer/CategoryId/CategoryId.cs | 19 + src/Nest/CommonAbstractions/Infer/Id/Id.cs | 1 - .../Infer/Indices/IndicesJsonConverter.cs | 3 +- .../Infer/Types/TypesJsonConverter.cs | 2 +- .../CommonAbstractions/Request/RouteValues.cs | 6 + .../EpochMillisecondsDateTimeJsonConverter.cs | 55 + .../EpochSecondsDateTimeJsonConverter.cs | 58 +- .../SimulatePipelineDocument.cs | 3 - .../Container/QueryContainerDescriptor.cs | 4 +- .../CloseJob/CloseJobRequest.cs | 9 + .../CloseJob/CloseJobResponse.cs | 15 + .../CloseJob/ElasticClient-CloseJob.cs | 51 + .../Datafeed/ChunkingConfig.cs | 78 ++ .../Datafeed/DatafeedConfig.cs | 80 ++ .../MachineLearning/Datafeed/DatafeedState.cs | 19 + .../MachineLearning/Datafeed/DatafeedStats.cs | 20 + .../MachineLearning/Datafeed/DiscoveryNode.cs | 40 + .../DeleteDatafeed/DeleteDatafeedRequest.cs | 9 + .../DeleteDatafeed/DeleteDatafeedResponse.cs | 6 + .../ElasticClient-DeleteDatafeed.cs | 50 + .../DeleteExpiredDataRequest.cs | 9 + .../DeleteExpiredDataResponse.cs | 15 + .../ElasticClient-DeleteExpiredData.cs | 50 + .../DeleteJob/DeleteJobRequest.cs | 11 + .../DeleteJob/DeleteJobResponse.cs | 6 + .../DeleteJob/ElasticClient-DeleteJob.cs | 52 + .../DeleteModelSnapshotRequest.cs | 9 + .../DeleteModelSnapshotResponse.cs | 6 + .../ElasticClient-DeleteModelSnapshot.cs | 54 + .../FlushJob/ElasticClient-FlushJob.cs | 50 + .../FlushJob/FlushJobRequest.cs | 74 + .../FlushJob/FlushJobResponse.cs | 15 + .../ElasticClient-GetAnomalyRecords.cs | 50 + .../GetAnomalyRecordsRequest.cs | 119 ++ .../GetAnomalyRecordsResponse.cs | 21 + .../GetBuckets/ElasticClient-GetBuckets.cs | 50 + .../GetBuckets/GetBucketsRequest.cs | 137 ++ .../GetBuckets/GetBucketsResponse.cs | 21 + .../ElasticClient-GetCategories.cs | 50 + .../GetCategories/GetCategoriesRequest.cs | 34 + .../GetCategories/GetCategoriesResponse.cs | 21 + .../ElasticClient-GetDatafeedStats.cs | 50 + .../GetDatafeedStatsRequest.cs | 17 + .../GetDatafeedStatsResponse.cs | 22 + .../ElasticClient-GetDatafeeds.cs | 50 + .../GetDatafeeds/GetDatafeedsRequest.cs | 17 + .../GetDatafeeds/GetDatafeedsResponse.cs | 21 + .../ElasticClient-GetInfluencers.cs | 50 + .../GetInfluencers/GetInfluencersRequest.cs | 115 ++ .../GetInfluencers/GetInfluencersResponse.cs | 23 + .../GetJobStats/ElasticClient-GetJobStats.cs | 50 + .../GetJobStats/GetJobStatsRequest.cs | 17 + .../GetJobStats/GetJobStatsResponse.cs | 21 + .../GetJobs/ElasticClient-GetJobs.cs | 50 + .../MachineLearning/GetJobs/GetJobsRequest.cs | 17 + .../GetJobs/GetJobsResponse.cs | 33 + .../ElasticClient-GetModelSnapshots.cs | 50 + .../GetModelSnapshotsRequest.cs | 89 ++ .../GetModelSnapshotsResponse.cs | 21 + .../Job/Config/AnalysisConfig.cs | 145 ++ .../Job/Config/AnalysisLimits.cs | 87 ++ .../Job/Config/DataDescription.cs | 63 + .../XPack/MachineLearning/Job/Config/Job.cs | 116 ++ .../MachineLearning/Job/Config/JobState.cs | 42 + .../MachineLearning/Job/Config/JobStats.cs | 53 + .../Job/Config/MemoryStatus.cs | 33 + .../Job/Config/ModelPlotConfig.cs | 80 ++ .../Job/Detectors/CountDetector.cs | 241 ++++ .../MachineLearning/Job/Detectors/Detector.cs | 289 ++++ .../Job/Detectors/GeographicDetector.cs | 65 + .../Job/Detectors/InfoContentDetector.cs | 86 ++ .../Job/Detectors/MetricDetector.cs | 163 +++ .../Job/Detectors/RareDetector.cs | 76 ++ .../Job/Detectors/SumDetector.cs | 163 +++ .../Job/Detectors/TimeDetector.cs | 72 + src/Nest/XPack/MachineLearning/Job/Page.cs | 40 + .../MachineLearning/Job/Process/DataCounts.cs | 126 ++ .../Job/Process/ModelSizeStats.cs | 76 ++ .../Job/Process/ModelSnapshot.cs | 68 + .../Job/Results/AnomalyCause.cs | 54 + .../Job/Results/AnomalyRecord.cs | 168 +++ .../MachineLearning/Job/Results/Bucket.cs | 76 ++ .../Job/Results/BucketInfluencer.cs | 70 + .../Job/Results/CategoryDefinition.cs | 45 + .../MachineLearning/Job/Results/Influence.cs | 21 + .../Job/Results/PartitionScore.cs | 38 + .../OpenJob/ElasticClient-OpenJob.cs | 52 + .../MachineLearning/OpenJob/OpenJobRequest.cs | 33 + .../OpenJob/OpenJobResponse.cs | 15 + .../PostJobData/ElasticClient-PostJobData.cs | 50 + .../PostJobData/PostJobDataRequest.cs | 78 ++ .../PostJobData/PostJobDataResponse.cs | 130 ++ .../ElasticClient-PreviewDatafeed.cs | 59 + .../PreviewDatafeed/PreviewDatafeedRequest.cs | 13 + .../PreviewDatafeedResponse.cs | 14 + .../PutDatafeed/ElasticClient-PutDatafeed.cs | 51 + .../PutDatafeed/PutDatafeedRequest.cs | 168 +++ .../PutDatafeed/PutDatafeedResponse.cs | 106 ++ .../PutJob/ElasticClient-PutJob.cs | 50 + .../MachineLearning/PutJob/PutJobRequest.cs | 136 ++ .../MachineLearning/PutJob/PutJobResponse.cs | 154 +++ .../ElasticClient-RevertModelSnapshot.cs | 50 + .../RevertModelSnapshotRequest.cs | 36 + .../RevertModelSnapshotResponse.cs | 15 + .../ElasticClient-StartDatafeed.cs | 51 + .../StartDatafeed/StartDatafeedRequest.cs | 59 + .../StartDatafeed/StartDatafeedResponse.cs | 15 + .../ElasticClient-StopDatafeed.cs | 51 + .../StopDatafeed/StopDatafeedRequest.cs | 44 + .../StopDatafeed/StopDatafeedResponse.cs | 15 + .../ElasticClient-UpdateDatafeed.cs | 50 + .../UpdateDataFeed/UpdateDatafeedRequest.cs | 169 +++ .../UpdateDataFeed/UpdateDatafeedResponse.cs | 94 ++ .../UpdateJob/ElasticClient-UpdateJob.cs | 50 + .../UpdateJob/UpdateJobRequest.cs | 122 ++ .../UpdateJob/UpdateJobResponse.cs | 10 + .../ElasticClient-UpdateModelSnapshot.cs | 50 + .../UpdateModelSnapshotRequest.cs | 47 + .../UpdateModelSnapshotResponse.cs | 15 + .../ElasticClient-ValidateDetector.cs | 50 + .../ValidateDetectorRequest.cs | 150 +++ .../ValidateDetectorResponse.cs | 8 + .../ValidateJob/ElasticClient-ValidateJob.cs | 50 + .../ValidateJob/ValidateJobRequest.cs | 114 ++ .../ValidateJob/ValidateJobResponse.cs | 6 + src/Nest/_Generated/_Descriptors.generated.cs | 778 +++++++++++ .../_Generated/_LowLevelDispatch.generated.cs | 714 ++++++++++ src/Nest/_Generated/_Requests.generated.cs | 966 ++++++++++++- .../CodeStandards/Serialization/Enums.cs | 12 +- .../Configuration/EnvironmentConfiguration.cs | 6 +- .../Framework/EndpointTests/ApiTestBase.cs | 8 + .../EndpointTests/TestState/EndpointUsage.cs | 1 + .../Clusters/ClusterBase.cs | 5 +- .../Clusters/XPackCluster.cs | 1 + .../Clusters/XPackMachineLearningCluster.cs | 41 + .../NodeSeeders/MachineLearningSeeder.cs | 120 ++ .../Nodes/ElasticsearchNode.cs | 14 +- ...adMachineLearningSampleDataDistribution.cs | 37 + .../EnsureSecurityRolesFileExists.cs | 7 + .../Tasks/NodeTaskRunner.cs | 16 +- src/Tests/Framework/MockData/Metric.cs | 53 + src/Tests/Framework/TestClient.cs | 12 +- src/Tests/Program.cs | 9 +- src/Tests/Tests.csproj | 9 +- .../CloseJob/CloseJobApiTests.cs | 46 + .../CloseJob/CloseJobUrlTests.cs | 20 + .../DeleteDatafeed/DeleteDatafeedApiTests.cs | 47 + .../DeleteDatafeed/DeleteDatafeedUrlTests.cs | 20 + .../DeleteExpiredDataApiTests.cs | 37 + .../DeleteExpiredDataUrlTests.cs | 20 + .../DeleteJob/DeleteJobApiTests.cs | 47 + .../DeleteJob/DeleteJobUrlTests.cs | 20 + .../DeleteModelSnapshotApiTests.cs | 49 + .../DeleteModelSnapshotUrlTests.cs | 20 + .../DetectorSerializationTests.cs | 33 + .../FlushJob/FlushJobApiTests.cs | 67 + .../FlushJob/FlushJobUrlTests.cs | 20 + .../GetAnomalyRecordsApiTests.cs | 57 + .../GetAnomalyRecordsUrlTests.cs | 21 + .../GetBuckets/GetBucketsApiTests.cs | 113 ++ .../GetBuckets/GetBucketsUrlTests.cs | 20 + .../GetCategories/GetCategoriesApiTests.cs | 111 ++ .../GetCategories/GetCategoriesUrlTests.cs | 28 + .../GetDatafeedStatsApiTests.cs | 85 ++ .../GetDatafeedStatsUrlTests.cs | 28 + .../GetDatafeeds/GetDatafeedsApiTests.cs | 132 ++ .../GetDatafeeds/GetDatafeedsUrlTests.cs | 28 + .../GetInfluencers/GetInfluencersApiTests.cs | 60 + .../GetInfluencers/GetInfluencersUrlTests.cs | 21 + .../GetJobStats/GetJobStatsApiTests.cs | 140 ++ .../GetJobStats/GetJobStatsUrlTests.cs | 28 + .../GetJobs/GetJobsApiTests.cs | 135 ++ .../GetJobs/GetJobsUrlTests.cs | 28 + .../GetModelSnapshotsApiTests.cs | 101 ++ .../GetModelSnapshotsUrlTests.cs | 28 + .../MachineLearningIntegrationTestBase.cs | 173 +++ .../OpenJob/OpenJobApiTests.cs | 54 + .../OpenJob/OpenJobUrlTests.cs | 20 + .../PostJobData/PostJobDataApiTests.cs | 207 +++ .../PostJobData/PostJobDataUrlTests.cs | 20 + .../PreviewDataFeedApiTests.cs | 49 + .../PreviewDataFeedUrlTests.cs | 21 + .../PutDatafeed/PutDatafeedApiTests.cs | 87 ++ .../PutDatafeed/PutDatafeedUrlTests.cs | 20 + .../MachineLearning/PutJob/PutJobApiTests.cs | 122 ++ .../MachineLearning/PutJob/PutJobUrlTests.cs | 20 + .../RevertModelSnapshotApiTests.cs | 66 + .../RevertModelSnapshotUrlTests.cs | 21 + .../StartDatafeed/StartDatafeedApiTests.cs | 56 + .../StartDatafeed/StartDatafeedUrlTests.cs | 20 + .../StopDatafeed/StopDatafeedApiTests.cs | 56 + .../StopDatafeed/StopDatafeedUrlTests.cs | 20 + .../UpdateDatafeed/UpdateDatafeedApiTests.cs | 99 ++ .../UpdateDatafeed/UpdateDatafeedUrlTests.cs | 20 + .../UpdateJob/UpdateJobApiTests.cs | 61 + .../UpdateJob/UpdateJobUrlTests.cs | 20 + .../UpdateModelSnapshotApiTests.cs | 58 + .../UpdateModelSnapshotUrlTests.cs | 20 + .../ValidateDetectorApiTests.cs | 75 ++ .../ValidateDetectorUrlTests.cs | 21 + .../ValidateJob/ValidateJobApiTests.cs | 91 ++ .../ValidateJob/ValidateJobUrlTests.cs | 21 + 233 files changed, 16442 insertions(+), 147 deletions(-) create mode 100644 paket-files/paket.restore.cached create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/FlushJobDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetAnomalyRecordsDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetBucketsDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetCategoriesDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetInfluencersDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetModelSnapshotsDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/PostJobDataDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/RevertModelSnapshotDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StartDatafeedDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StopDatafeedDescriptorOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Descriptors/UpdateModelSnapshotDescriptorOverrides.cs delete mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_filter.json create mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_buckets.replace.json delete mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_filters.json delete mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.put_filter.json create mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.revert_model_snapshot.patch.json create mode 100644 src/Nest/CommonAbstractions/Infer/CategoryId/CategoryId.cs create mode 100644 src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochMillisecondsDateTimeJsonConverter.cs create mode 100644 src/Nest/XPack/MachineLearning/CloseJob/CloseJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/CloseJob/CloseJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/CloseJob/ElasticClient-CloseJob.cs create mode 100644 src/Nest/XPack/MachineLearning/Datafeed/ChunkingConfig.cs create mode 100644 src/Nest/XPack/MachineLearning/Datafeed/DatafeedConfig.cs create mode 100644 src/Nest/XPack/MachineLearning/Datafeed/DatafeedState.cs create mode 100644 src/Nest/XPack/MachineLearning/Datafeed/DatafeedStats.cs create mode 100644 src/Nest/XPack/MachineLearning/Datafeed/DiscoveryNode.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteDatafeed/ElasticClient-DeleteDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteExpiredData/ElasticClient-DeleteExpiredData.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteJob/ElasticClient-DeleteJob.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteModelSnapshot/ElasticClient-DeleteModelSnapshot.cs create mode 100644 src/Nest/XPack/MachineLearning/FlushJob/ElasticClient-FlushJob.cs create mode 100644 src/Nest/XPack/MachineLearning/FlushJob/FlushJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/FlushJob/FlushJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetAnomalyRecords/ElasticClient-GetAnomalyRecords.cs create mode 100644 src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetBuckets/ElasticClient-GetBuckets.cs create mode 100644 src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCategories/ElasticClient-GetCategories.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeedStats/ElasticClient-GetDatafeedStats.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeeds/ElasticClient-GetDatafeeds.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetInfluencers/ElasticClient-GetInfluencers.cs create mode 100644 src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobStats/ElasticClient-GetJobStats.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobs/GetJobsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetJobs/GetJobsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetModelSnapshots/ElasticClient-GetModelSnapshots.cs create mode 100644 src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/AnalysisConfig.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/AnalysisLimits.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/DataDescription.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/Job.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/JobState.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/MemoryStatus.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Config/ModelPlotConfig.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/CountDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/GeographicDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/InfoContentDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/MetricDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/RareDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/SumDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Detectors/TimeDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Page.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Process/DataCounts.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Process/ModelSizeStats.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Process/ModelSnapshot.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/AnomalyCause.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/AnomalyRecord.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/Bucket.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/BucketInfluencer.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/CategoryDefinition.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/Influence.cs create mode 100644 src/Nest/XPack/MachineLearning/Job/Results/PartitionScore.cs create mode 100644 src/Nest/XPack/MachineLearning/OpenJob/ElasticClient-OpenJob.cs create mode 100644 src/Nest/XPack/MachineLearning/OpenJob/OpenJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PostJobData/ElasticClient-PostJobData.cs create mode 100644 src/Nest/XPack/MachineLearning/PostJobData/PostJobDataRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PostJobData/PostJobDataResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PreviewDatafeed/ElasticClient-PreviewDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PutDatafeed/ElasticClient-PutDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PutJob/ElasticClient-PutJob.cs create mode 100644 src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PutJob/PutJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/RevertModelSnapshot/ElasticClient-RevertModelSnapshot.cs create mode 100644 src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/StartDatafeed/ElasticClient-StartDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/StopDatafeed/ElasticClient-StopDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateDataFeed/ElasticClient-UpdateDatafeed.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateJob/ElasticClient-UpdateJob.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateModelSnapshot/ElasticClient-UpdateModelSnapshot.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateDetector/ElasticClient-ValidateDetector.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateJob/ElasticClient-ValidateJob.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobResponse.cs create mode 100644 src/Tests/Framework/ManagedElasticsearch/Clusters/XPackMachineLearningCluster.cs create mode 100644 src/Tests/Framework/ManagedElasticsearch/NodeSeeders/MachineLearningSeeder.cs create mode 100644 src/Tests/Framework/ManagedElasticsearch/Tasks/InstallationTasks/DownloadMachineLearningSampleDataDistribution.cs create mode 100644 src/Tests/Framework/MockData/Metric.cs create mode 100644 src/Tests/XPack/MachineLearning/CloseJob/CloseJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/CloseJob/CloseJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteJob/DeleteJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteJob/DeleteJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/DetectorSerializationTests.cs create mode 100644 src/Tests/XPack/MachineLearning/FlushJob/FlushJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/FlushJob/FlushJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetBuckets/GetBucketsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetBuckets/GetBucketsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetCategories/GetCategoriesApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetCategories/GetCategoriesUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetDatafeeds/GetDatafeedsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetDatafeeds/GetDatafeedsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetInfluencers/GetInfluencersApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetInfluencers/GetInfluencersUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetJobStats/GetJobStatsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetJobStats/GetJobStatsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetJobs/GetJobsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetJobs/GetJobsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/MachineLearningIntegrationTestBase.cs create mode 100644 src/Tests/XPack/MachineLearning/OpenJob/OpenJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/OpenJob/OpenJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PostJobData/PostJobDataApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PostJobData/PostJobDataUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PreviewDataFeed/PreviewDataFeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PreviewDataFeed/PreviewDataFeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PutDatafeed/PutDatafeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PutDatafeed/PutDatafeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PutJob/PutJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/PutJob/PutJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/StartDatafeed/StartDatafeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/StartDatafeed/StartDatafeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/StopDatafeed/StopDatafeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/StopDatafeed/StopDatafeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateDatafeed/UpdateDatafeedApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateDatafeed/UpdateDatafeedUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateJob/UpdateJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateJob/UpdateJobUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/ValidateDetector/ValidateDetectorApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/ValidateDetector/ValidateDetectorUrlTests.cs create mode 100644 src/Tests/XPack/MachineLearning/ValidateJob/ValidateJobApiTests.cs create mode 100644 src/Tests/XPack/MachineLearning/ValidateJob/ValidateJobUrlTests.cs diff --git a/build/scripts/Tooling.fsx b/build/scripts/Tooling.fsx index 70ecc0232b0..cb0a420b1e1 100644 --- a/build/scripts/Tooling.fsx +++ b/build/scripts/Tooling.fsx @@ -69,7 +69,7 @@ module Tooling = ) timeout code - let private defaultTimeout = TimeSpan.FromMinutes 15.0 + let private defaultTimeout = TimeSpan.FromMinutes 20.0 let execProcessInDirectory proc arguments workingDir = let exitCode = execProcessWithTimeout proc arguments defaultTimeout workingDir @@ -179,6 +179,7 @@ module Tooling = Targets = ["Build"] Properties = [ + "OutputPathBaseDir", Path.GetFullPath "build\\output" "Optimize", "True" "Configuration", "Release" "TargetFrameworkVersion", identifier.MSBuild diff --git a/paket-files/paket.restore.cached b/paket-files/paket.restore.cached new file mode 100644 index 00000000000..f9c80275af9 --- /dev/null +++ b/paket-files/paket.restore.cached @@ -0,0 +1,14 @@ + + +GROUP build +NUGET + remote: https://www.nuget.org/api/v2 + Elasticsearch.Net (5.3) - framework: net45 + FAKE (4.57.4) + FSharp.Data (2.3.2) + Zlib.Portable (>= 1.11) - framework: >= netstandard11, portable-net45+sl5+win8, portable-net45+win8, portable-net45+win8+wp8+wpa81 + NEST (5.3) - framework: net45 + Elasticsearch.Net (>= 5.3 < 6.0) - framework: net45, >= net46, >= netstandard13 + Newtonsoft.Json (>= 9.0 < 10.0) - framework: net45, >= net46, >= netstandard13 + Newtonsoft.Json (9.0.1) - framework: net45 + Zlib.Portable (1.11) - framework: >= netstandard11, portable-net45+sl5+win8, portable-net45+win8, portable-net45+win8+wp8+wpa81 diff --git a/src/CodeGeneration/ApiGenerator/ApiGenerator.cs b/src/CodeGeneration/ApiGenerator/ApiGenerator.cs index 077d0f31611..8ffa75ae401 100644 --- a/src/CodeGeneration/ApiGenerator/ApiGenerator.cs +++ b/src/CodeGeneration/ApiGenerator/ApiGenerator.cs @@ -59,6 +59,7 @@ private static RestApiSpec CreateRestApiSpecModel(string downloadBranch, string[ if (file.EndsWith("_common.json")) RestApiSpec.CommonApiQueryParameters = CreateCommonApiQueryParameters(file); else if (file.EndsWith(".obsolete.json")) continue; else if (file.EndsWith(".patch.json")) continue; + else if (file.EndsWith(".replace.json")) continue; else { var endpoint = CreateApiEndpoint(file); @@ -74,8 +75,6 @@ private static RestApiSpec CreateRestApiSpecModel(string downloadBranch, string[ return new RestApiSpec { Endpoints = endpoints, Commit = downloadBranch }; } - - public static string PascalCase(string s) { var textInfo = new CultureInfo("en-US").TextInfo; @@ -84,6 +83,15 @@ public static string PascalCase(string s) private static KeyValuePair CreateApiEndpoint(string jsonFile) { + var replaceFile = Path.Combine(Path.GetDirectoryName(jsonFile), Path.GetFileNameWithoutExtension(jsonFile)) + ".replace.json"; + if (File.Exists(replaceFile)) + { + var replaceSpec = JObject.Parse(File.ReadAllText(replaceFile)); + var endpointReplaced = replaceSpec.ToObject>().First(); + endpointReplaced.Value.CsharpMethodName = CreateMethodName(endpointReplaced.Key); + return endpointReplaced; + } + var officialJsonSpec = JObject.Parse(File.ReadAllText(jsonFile)); PatchOfficialSpec(officialJsonSpec, jsonFile); var endpoint = officialJsonSpec.ToObject>().First(); diff --git a/src/CodeGeneration/ApiGenerator/Domain/ApiEndpoint.cs b/src/CodeGeneration/ApiGenerator/Domain/ApiEndpoint.cs index 652b5b7204e..4a4b96b9c82 100644 --- a/src/CodeGeneration/ApiGenerator/Domain/ApiEndpoint.cs +++ b/src/CodeGeneration/ApiGenerator/Domain/ApiEndpoint.cs @@ -17,7 +17,20 @@ public IEnumerable MethodArguments get { var methodArgs = CsharpMethod.Parts - .Select(p => p.Name != "body" ? "p.RouteValues." + p.Name.ToPascalCase() + (p.Type == "enum" ? ".Value" : "") : "body") + .Select(p => + { + if (p.Name == "body") return "body"; + + switch (p.Type) + { + case "enum": + return $"p.RouteValues.{p.Name.ToPascalCase()}.Value"; + case "long": + return $"long.Parse(p.RouteValues.{p.Name.ToPascalCase()})"; + default: + return $"p.RouteValues.{p.Name.ToPascalCase()}"; + } + }) .Concat(new[] {"u => p.RequestParameters"}); return methodArgs; } diff --git a/src/CodeGeneration/ApiGenerator/Domain/ApiQueryParameters.cs b/src/CodeGeneration/ApiGenerator/Domain/ApiQueryParameters.cs index 46841f87326..23f1a366ece 100644 --- a/src/CodeGeneration/ApiGenerator/Domain/ApiQueryParameters.cs +++ b/src/CodeGeneration/ApiGenerator/Domain/ApiQueryParameters.cs @@ -40,6 +40,8 @@ public string CsharpType(string paramName) case "": case null: return "string"; + case "date": + return "DateTimeOffset"; case "enum": return paramName.ToPascalCase(); default: diff --git a/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs b/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs index 933e36855b5..339f688fe5c 100644 --- a/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs +++ b/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs @@ -10,7 +10,11 @@ public class ApiUrlPart private string _description; - public string Description { get { return _description; } set { _description = CleanUpDescription(value); } } + public string Description + { + get => _description; + set => _description = CleanUpDescription(value); + } public bool Required { get; set; } public IEnumerable Options { get; set; } @@ -36,7 +40,12 @@ public string ClrTypeName return "IndexName"; case "type": return this.Type == "string" ? "TypeName" : "Types"; case "watch_id": + case "job_id": + case "datafeed_id": + case "snapshot_id": + case "filter_id": case "id": return this.Type == "string" ? "Id" : "Ids"; + case "category_id": return "CategoryId"; case "node_id": return this.Type == "string" ? "NodeId" : "NodeIds"; case "scroll_id": return this.Type == "string" ? "ScrollId" : "ScrollIds"; case "field": @@ -59,6 +68,7 @@ public string ClrTypeName case "thread_pool_patterns": return this.Type == "string" ? "Name" : "Names"; case "task_id": return "TaskId"; + case "timestamp": return "Timestamp"; default: return this.Type + "_"; } } diff --git a/src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs b/src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs index c461bd0f722..d83082e7e86 100644 --- a/src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs +++ b/src/CodeGeneration/ApiGenerator/Domain/CsharpMethod.cs @@ -226,6 +226,13 @@ public IEnumerable DescriptorConstructors() generated = $"public {m}({par}) : base(r => r.Required(\"index\", (Indices)typeof({generic}))){{}}"; } + // Use generic T to set the Indices and Types by default in the ctor + if (m == "PutDatafeedDescriptor" || m == "UpdateDatafeedDescriptor") + { + doc = AppendToSummary(doc, ". Will infer the index and type from the generic type"); + generated = $"public {m}({par}) : base({routing}){{ Self.Indices = typeof({this.CallTypeGeneric}); Self.Types = typeof({this.CallTypeGeneric}); }}"; + } + var c = new Constructor { Generated = generated, Description = doc }; ctors.Add(c); } diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/FlushJobDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/FlushJobDescriptorOverrides.cs new file mode 100644 index 00000000000..4f8941ee380 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/FlushJobDescriptorOverrides.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class FlushJobDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "advance_time", + "end", + "start", + "calc_interim", + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetAnomalyRecordsDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetAnomalyRecordsDescriptorOverrides.cs new file mode 100644 index 00000000000..53e6b7e40b7 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetAnomalyRecordsDescriptorOverrides.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class GetAnomalyRecordsDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "exclude_interim", + "from", + "size", + "start", + "end", + "record_score", + "sort", + "desc" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetBucketsDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetBucketsDescriptorOverrides.cs new file mode 100644 index 00000000000..6b016264184 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetBucketsDescriptorOverrides.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class GetBucketsDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "expand", + "exclude_interim", + "from", + "size", + "start", + "end", + "anomaly_score", + "sort", + "desc" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetCategoriesDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetCategoriesDescriptorOverrides.cs new file mode 100644 index 00000000000..7fd95438d4c --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetCategoriesDescriptorOverrides.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class GetCategoriesDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetInfluencersDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetInfluencersDescriptorOverrides.cs new file mode 100644 index 00000000000..3fd33dc9c1b --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetInfluencersDescriptorOverrides.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class GetInfluencersDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "exclude_interim", + "from", + "size", + "start", + "end", + "influencer_score", + "sort", + "desc" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetModelSnapshotsDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetModelSnapshotsDescriptorOverrides.cs new file mode 100644 index 00000000000..65db620e5bf --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/GetModelSnapshotsDescriptorOverrides.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class GetModelSnapshotsDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size", + "start", + "end", + "sort", + "desc" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/PostJobDataDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/PostJobDataDescriptorOverrides.cs new file mode 100644 index 00000000000..0a08f0a2922 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/PostJobDataDescriptorOverrides.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class PostJobDataDescriptorOverrides : DescriptorOverridesBase + { + public override CsharpMethod PatchMethod(CsharpMethod method) + { + method.Url.Params["reset_start"].Type = "date"; + method.Url.Params["reset_end"].Type = "date"; + return method; + } + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/RevertModelSnapshotDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/RevertModelSnapshotDescriptorOverrides.cs new file mode 100644 index 00000000000..41b3aeea7db --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/RevertModelSnapshotDescriptorOverrides.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class RevertModelSnapshotDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "delete_intervening_results" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StartDatafeedDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StartDatafeedDescriptorOverrides.cs new file mode 100644 index 00000000000..0d0b1e68805 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StartDatafeedDescriptorOverrides.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class StartDatafeedDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "timeout", + "start", + "end", + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StopDatafeedDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StopDatafeedDescriptorOverrides.cs new file mode 100644 index 00000000000..757c6c3c065 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/StopDatafeedDescriptorOverrides.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class StopDatafeedDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "timeout", + "force" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/UpdateModelSnapshotDescriptorOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/UpdateModelSnapshotDescriptorOverrides.cs new file mode 100644 index 00000000000..cb0ffa3653c --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Descriptors/UpdateModelSnapshotDescriptorOverrides.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Descriptors +{ + public class UpdateModelSnapshotDescriptorOverrides : DescriptorOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "description", + "retain" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Program.cs b/src/CodeGeneration/ApiGenerator/Program.cs index c39c375512b..74229a8916c 100644 --- a/src/CodeGeneration/ApiGenerator/Program.cs +++ b/src/CodeGeneration/ApiGenerator/Program.cs @@ -43,7 +43,7 @@ static void Main(string[] args) if (redownloadCoreSpecification) RestSpecDownloader.Download(downloadBranch); - ApiGenerator.Generate(downloadBranch, "Core", "Graph", "License", "Security", "Watcher", "Info"); + ApiGenerator.Generate(downloadBranch, "Core", "Graph", "License", "Security", "Watcher", "Info", "MachineLearning"); //ApiGenerator.Generate(); //generates everything under ApiSpecification } diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_filter.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_filter.json deleted file mode 100644 index 6c120fc243f..00000000000 --- a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_filter.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "xpack.ml.delete_filter": { - "methods": [ "DELETE" ], - "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters/{filter_id}" ], - "parts": { - "filter_id": { - "type" : "string", - "required" : true, - "description" : "The ID of the filter to delete" - } - } - }, - "body": null - } -} diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_buckets.replace.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_buckets.replace.json new file mode 100644 index 00000000000..03fa17747c1 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_buckets.replace.json @@ -0,0 +1,60 @@ +{ + "xpack.ml.get_buckets": { + "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html", + "methods": [ "GET", "POST" ], + "url": { + "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets/", + "paths": [ + "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets" + ], + "parts": { + "job_id": { + "type" : "string", + "required": true, + "description": "ID of the job to get bucket results from" + } + }, + "params": { + "expand": { + "type": "boolean", + "description" : "Include anomaly records" + }, + "exclude_interim": { + "type": "boolean", + "description" : "Exclude interim results" + }, + "from": { + "type": "int", + "description": "skips a number of buckets" + }, + "size": { + "type": "int", + "description": "specifies a max number of buckets to get" + }, + "start": { + "type": "string", + "description" : "Start time filter for buckets" + }, + "end": { + "type": "string", + "description" : "End time filter for buckets" + }, + "anomaly_score": { + "type": "double", + "description": "Filter for the most anomalous buckets" + }, + "sort": { + "type": "string", + "description": "Sort buckets by a particular field" + }, + "desc": { + "type": "boolean", + "description": "Set the sort direction" + } + } + }, + "body": { + "description" : "Bucket selection details if not provided in URI" + } + } +} diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_filters.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_filters.json deleted file mode 100644 index 828f6c6e530..00000000000 --- a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_filters.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "xpack.ml.get_filters": { - "methods": [ "GET" ], - "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters/", "/_xpack/ml/filters/{filter_id}" ], - "parts": { - "filter_id": { - "type" : "string", - "description" : "The ID of the filter to fetch" - } - }, - "params": { - "from": { - "type": "int", - "description": "skips a number of filters" - }, - "size": { - "type": "int", - "description": "specifies a max number of filters to get" - } - } - }, - "body": null - } -} diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.put_filter.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.put_filter.json deleted file mode 100644 index 36c5f0582cb..00000000000 --- a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.put_filter.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "xpack.ml.put_filter": { - "methods": [ "PUT" ], - "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters/{filter_id}" ], - "parts": { - "filter_id": { - "type": "string", - "required": true, - "description": "The ID of the filter to create" - } - } - }, - "body": { - "description" : "The filter details", - "required" : true - } - } -} diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.revert_model_snapshot.patch.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.revert_model_snapshot.patch.json new file mode 100644 index 00000000000..6e579f8f5e1 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.revert_model_snapshot.patch.json @@ -0,0 +1,11 @@ +{ + "xpack.ml.revert_model_snapshot": { + "url": { + "parts": { + "snapshot_id": { + "required": true + } + } + } + } +} diff --git a/src/CodeGeneration/ApiGenerator/Views/ElasticLowLevelClient.Generated.cshtml b/src/CodeGeneration/ApiGenerator/Views/ElasticLowLevelClient.Generated.cshtml index 6309c48609f..5dc355cbe66 100644 --- a/src/CodeGeneration/ApiGenerator/Views/ElasticLowLevelClient.Generated.cshtml +++ b/src/CodeGeneration/ApiGenerator/Views/ElasticLowLevelClient.Generated.cshtml @@ -1,9 +1,11 @@ +@using System @using System.Collections.Generic @using System.Globalization @using System.Linq @using System.Text.RegularExpressions @using ApiGenerator.Domain @using ApiGenerator +@using CsQuery.StringScanner.Implementation using System; using System.Collections.Generic; using System.Collections.Specialized; @@ -29,17 +31,19 @@ namespace Elasticsearch.Net foreach (var kv in model.Endpoints) { - var identifier = kv.Key; var endpoint = kv.Value; var methods = endpoint.GetCsharpMethods().ToList(); + var partsNotToReplace = new HashSet {"category_id"}; foreach (var method in methods) { var url = method.Path.Split(new[] {'/'}, 2).Last(); - var patchedUrl = url; - if (!url.Contains("{task_id}")) - { - patchedUrl = Regex.Replace(url, @"{(\w+)}", "{$1.NotNull(\"$1\")}"); - } + // Don't replace certain url parts e.g. category_id is defined as a long parameter + // which is .ToString()'ed as part of the URL. A .NotNull() method on long doesn't really make sense. + var partNames = method.Url.Parts != null + ? string.Join("|", method.Url.Parts.Where(p => !partsNotToReplace.Contains(p.Key)).Select(p => p.Key)) + : @"\w+"; + var pattern = string.IsNullOrEmpty(partNames) ? @"\w+" : partNames; + var patchedUrl = Regex.Replace(url, "{(" + pattern + ")}", "{$1.NotNull(\"$1\")}"); bool isAsync = method.ReturnType.StartsWith("Task<"); string requestMethod = isAsync ? "DoRequestAsync" : "DoRequest"; ///Represents a @method.HttpMethod on @method.Path diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs index 2e558a76acc..c349de2a40a 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs @@ -6849,6 +6849,870 @@ public class PostLicenseRequestParameters : FluentRequestParametersRequest parameters descriptor for XpackMlCloseJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html
+	///
+ ///
+ public class CloseJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///True if the job should be forcefully closed + public CloseJobRequestParameters Force(bool force) => this.AddQueryString("force", force); + + + ///Controls the time to wait until a job has closed. Default to 30 minutes + public CloseJobRequestParameters Timeout(TimeSpan timeout) => this.AddQueryString("timeout", timeout.ToTimeUnit()); + + + ///Pretty format the returned JSON response. + public CloseJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public CloseJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public CloseJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public CloseJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public CloseJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlDeleteDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
+	///
+ ///
+ public class DeleteDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///True if the datafeed should be forcefully deleted + public DeleteDatafeedRequestParameters Force(bool force) => this.AddQueryString("force", force); + + + ///Pretty format the returned JSON response. + public DeleteDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public DeleteDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public DeleteDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public DeleteDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlDeleteExpiredData + ///
+	///
+	///
+ ///
+ public class DeleteExpiredDataRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///Pretty format the returned JSON response. + public DeleteExpiredDataRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public DeleteExpiredDataRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public DeleteExpiredDataRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteExpiredDataRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public DeleteExpiredDataRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlDeleteJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html
+	///
+ ///
+ public class DeleteJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///True if the job should be forcefully deleted + public DeleteJobRequestParameters Force(bool force) => this.AddQueryString("force", force); + + + ///Pretty format the returned JSON response. + public DeleteJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public DeleteJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public DeleteJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public DeleteJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlDeleteModelSnapshot + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html
+	///
+ ///
+ public class DeleteModelSnapshotRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + + ///Pretty format the returned JSON response. + public DeleteModelSnapshotRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public DeleteModelSnapshotRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public DeleteModelSnapshotRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteModelSnapshotRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public DeleteModelSnapshotRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlFlushJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html
+	///
+ ///
+ public class FlushJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public FlushJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public FlushJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public FlushJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public FlushJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public FlushJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetBuckets + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html
+	///
+ ///
+ public class GetBucketsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public GetBucketsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetBucketsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetBucketsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetBucketsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetBucketsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetCategories + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
+	///
+ ///
+ public class GetCategoriesRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public GetCategoriesRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetCategoriesRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetCategoriesRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetCategoriesRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetCategoriesRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetDatafeeds + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html
+	///
+ ///
+ public class GetDatafeedsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Pretty format the returned JSON response. + public GetDatafeedsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetDatafeedsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetDatafeedsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetDatafeedsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetDatafeedsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetDatafeedStats + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html
+	///
+ ///
+ public class GetDatafeedStatsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Pretty format the returned JSON response. + public GetDatafeedStatsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetDatafeedStatsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetDatafeedStatsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetDatafeedStatsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetDatafeedStatsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetInfluencers + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html
+	///
+ ///
+ public class GetInfluencersRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public GetInfluencersRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetInfluencersRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetInfluencersRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetInfluencersRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetInfluencersRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetJobs + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html
+	///
+ ///
+ public class GetJobsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Pretty format the returned JSON response. + public GetJobsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetJobsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetJobsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetJobsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetJobsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetJobStats + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html
+	///
+ ///
+ public class GetJobStatsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Pretty format the returned JSON response. + public GetJobStatsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetJobStatsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetJobStatsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetJobStatsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetJobStatsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetModelSnapshots + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html
+	///
+ ///
+ public class GetModelSnapshotsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public GetModelSnapshotsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetModelSnapshotsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetModelSnapshotsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetModelSnapshotsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetModelSnapshotsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlGetRecords + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html
+	///
+ ///
+ public class GetAnomalyRecordsRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public GetAnomalyRecordsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public GetAnomalyRecordsRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public GetAnomalyRecordsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetAnomalyRecordsRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public GetAnomalyRecordsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlOpenJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html
+	///
+ ///
+ public class OpenJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public OpenJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public OpenJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public OpenJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public OpenJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public OpenJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlPostData + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html
+	///
+ ///
+ public class PostJobDataRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Optional parameter to specify the start of the bucket resetting range + public PostJobDataRequestParameters ResetStart(DateTimeOffset reset_start) => this.AddQueryString("reset_start", reset_start); + + + ///Optional parameter to specify the end of the bucket resetting range + public PostJobDataRequestParameters ResetEnd(DateTimeOffset reset_end) => this.AddQueryString("reset_end", reset_end); + + + ///Pretty format the returned JSON response. + public PostJobDataRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public PostJobDataRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public PostJobDataRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PostJobDataRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public PostJobDataRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlPreviewDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html
+	///
+ ///
+ public class PreviewDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + + ///Pretty format the returned JSON response. + public PreviewDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public PreviewDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public PreviewDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PreviewDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public PreviewDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlPutDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html
+	///
+ ///
+ public class PutDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + + ///Pretty format the returned JSON response. + public PutDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public PutDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public PutDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PutDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public PutDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlPutJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html
+	///
+ ///
+ public class PutJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + + ///Pretty format the returned JSON response. + public PutJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public PutJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public PutJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PutJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public PutJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlRevertModelSnapshot + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html
+	///
+ ///
+ public class RevertModelSnapshotRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public RevertModelSnapshotRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public RevertModelSnapshotRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public RevertModelSnapshotRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public RevertModelSnapshotRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public RevertModelSnapshotRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlStartDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html
+	///
+ ///
+ public class StartDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public StartDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public StartDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public StartDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public StartDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public StartDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlStopDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html
+	///
+ ///
+ public class StopDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public StopDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public StopDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public StopDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public StopDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public StopDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlUpdateDatafeed + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html
+	///
+ ///
+ public class UpdateDatafeedRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public UpdateDatafeedRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public UpdateDatafeedRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public UpdateDatafeedRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateDatafeedRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public UpdateDatafeedRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlUpdateJob + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html
+	///
+ ///
+ public class UpdateJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public UpdateJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public UpdateJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public UpdateJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public UpdateJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlUpdateModelSnapshot + ///
+	///http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html
+	///
+ ///
+ public class UpdateModelSnapshotRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public UpdateModelSnapshotRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public UpdateModelSnapshotRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public UpdateModelSnapshotRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateModelSnapshotRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public UpdateModelSnapshotRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlValidate + ///
+	///
+	///
+ ///
+ public class ValidateJobRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public ValidateJobRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public ValidateJobRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public ValidateJobRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public ValidateJobRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public ValidateJobRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + + ///Request parameters descriptor for XpackMlValidateDetector + ///
+	///
+	///
+ ///
+ public class ValidateDetectorRequestParameters : FluentRequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + + ///Pretty format the returned JSON response. + public ValidateDetectorRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty); + + + ///Return human readable values for statistics. + public ValidateDetectorRequestParameters Human(bool human) => this.AddQueryString("human", human); + + + ///Include the stack trace of returned errors. + public ValidateDetectorRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace); + + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public ValidateDetectorRequestParameters Source(string source) => this.AddQueryString("source", source); + + + ///A comma-separated list of filters used to reduce the respone. + public ValidateDetectorRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path); + + } + ///Request parameters descriptor for XpackSecurityAuthenticate ///
 	///https://www.elastic.co/guide/en/x-pack/master/security-api-authenticate.html
diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
index b42da607f2d..72fef173c21 100644
--- a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
+++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
@@ -6959,7 +6959,7 @@ public ElasticsearchResponse Reindex(PostData body, FuncThe task id to rethrottle
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public ElasticsearchResponse ReindexRethrottle(string task_id, Func requestParameters = null)
-			where T : class => this.DoRequest(POST, Url($"_reindex/{task_id}/_rethrottle"), null, _params(requestParameters));
+			where T : class => this.DoRequest(POST, Url($"_reindex/{task_id.NotNull("task_id")}/_rethrottle"), null, _params(requestParameters));
 		
 		///Represents a POST on /_reindex/{task_id}/_rethrottle
 		///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T:
@@ -6973,7 +6973,7 @@ public ElasticsearchResponse ReindexRethrottle(string task_id, FuncThe task id to rethrottle
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public Task> ReindexRethrottleAsync(string task_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
-			where T : class => this.DoRequestAsync(POST, Url($"_reindex/{task_id}/_rethrottle"), cancellationToken, null, _params(requestParameters));
+			where T : class => this.DoRequestAsync(POST, Url($"_reindex/{task_id.NotNull("task_id")}/_rethrottle"), cancellationToken, null, _params(requestParameters));
 		
 		///Represents a GET on /_remote/info
 		///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T:
@@ -8247,7 +8247,7 @@ public ElasticsearchResponse TasksCancel(FuncCancel the task with specified task id (node_id:task_number)
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public ElasticsearchResponse TasksCancel(string task_id, Func requestParameters = null)
-			where T : class => this.DoRequest(POST, Url($"_tasks/{task_id}/_cancel"), null, _params(requestParameters));
+			where T : class => this.DoRequest(POST, Url($"_tasks/{task_id.NotNull("task_id")}/_cancel"), null, _params(requestParameters));
 		
 		///Represents a POST on /_tasks/{task_id}/_cancel
 		///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T:
@@ -8261,7 +8261,7 @@ public ElasticsearchResponse TasksCancel(string task_id, FuncCancel the task with specified task id (node_id:task_number)
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public Task> TasksCancelAsync(string task_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
-			where T : class => this.DoRequestAsync(POST, Url($"_tasks/{task_id}/_cancel"), cancellationToken, null, _params(requestParameters));
+			where T : class => this.DoRequestAsync(POST, Url($"_tasks/{task_id.NotNull("task_id")}/_cancel"), cancellationToken, null, _params(requestParameters));
 		
 		///Represents a GET on /_tasks/{task_id}
 		///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T:
@@ -8275,7 +8275,7 @@ public ElasticsearchResponse TasksCancel(string task_id, FuncReturn the task with specified id (node_id:task_number)
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public ElasticsearchResponse TasksGet(string task_id, Func requestParameters = null)
-			where T : class => this.DoRequest(GET, Url($"_tasks/{task_id}"), null, _params(requestParameters));
+			where T : class => this.DoRequest(GET, Url($"_tasks/{task_id.NotNull("task_id")}"), null, _params(requestParameters));
 		
 		///Represents a GET on /_tasks/{task_id}
 		///Returns: A task of ElasticsearchResponse<T> where the behaviour depends on the type of T:
@@ -8289,7 +8289,7 @@ public ElasticsearchResponse TasksGet(string task_id, FuncReturn the task with specified id (node_id:task_number)
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		public Task> TasksGetAsync(string task_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
-			where T : class => this.DoRequestAsync(GET, Url($"_tasks/{task_id}"), cancellationToken, null, _params(requestParameters));
+			where T : class => this.DoRequestAsync(GET, Url($"_tasks/{task_id.NotNull("task_id")}"), cancellationToken, null, _params(requestParameters));
 		
 		///Represents a GET on /_tasks
 		///Returns: ElasticsearchResponse<T> where the behavior depends on the type of T:
@@ -8793,6 +8793,1190 @@ public ElasticsearchResponse XpackLicensePost(PostData body, Func<
 		public Task> XpackLicensePostAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
 			where T : class => this.DoRequestAsync(PUT, Url($"_xpack/license"), cancellationToken, body, _params(requestParameters));
 		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_close
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html 
+	    ///
+		///The name of the job to close
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlCloseJob(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_close
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html 
+	    ///
+		///The name of the job to close
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlCloseJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html 
+	    ///
+		///The ID of the datafeed to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlDeleteDatafeed(string datafeed_id, Func requestParameters = null)
+			where T : class => this.DoRequest(DELETE, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html 
+	    ///
+		///The ID of the datafeed to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlDeleteDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(DELETE, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/_delete_expired_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlDeleteExpiredData(Func requestParameters = null)
+			where T : class => this.DoRequest(DELETE, Url($"_xpack/ml/_delete_expired_data"), null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/_delete_expired_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlDeleteExpiredDataAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(DELETE, Url($"_xpack/ml/_delete_expired_data"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html 
+	    ///
+		///The ID of the job to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlDeleteJob(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(DELETE, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html 
+	    ///
+		///The ID of the job to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlDeleteJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(DELETE, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlDeleteModelSnapshot(string job_id, string snapshot_id, Func requestParameters = null)
+			where T : class => this.DoRequest(DELETE, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), null, _params(requestParameters));
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlDeleteModelSnapshotAsync(string job_id, string snapshot_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(DELETE, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_flush
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html 
+	    ///
+		///The name of the job to flush
+		///Flush parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlFlushJob(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_flush"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_flush
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html 
+	    ///
+		///The name of the job to flush
+		///Flush parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlFlushJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_flush"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+	    ///
+		///ID of the job to get bucket results from
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetBuckets(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/buckets"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+	    ///
+		///ID of the job to get bucket results from
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetBucketsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/buckets"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+	    ///
+		///ID of the job to get bucket results from
+		///Bucket selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetBuckets(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/buckets"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+	    ///
+		///ID of the job to get bucket results from
+		///Bucket selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetBucketsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/buckets"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetCategories(string job_id, long category_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/{category_id}"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetCategoriesAsync(string job_id, long category_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/{category_id}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetCategories(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetCategoriesAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetCategories(string job_id, long category_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/{category_id}"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetCategoriesAsync(string job_id, long category_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/{category_id}"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetCategories(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+	    ///
+		///The name of the job
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetCategoriesAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/categories/"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+	    ///
+		///The ID of the datafeeds to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetDatafeeds(string datafeed_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+	    ///
+		///The ID of the datafeeds to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetDatafeedsAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetDatafeeds(Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/datafeeds"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetDatafeedsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+	    ///
+		///The ID of the datafeeds stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetDatafeedStats(string datafeed_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_stats"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+	    ///
+		///The ID of the datafeeds stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetDatafeedStatsAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_stats"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetDatafeedStats(Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/datafeeds/_stats"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetDatafeedStatsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds/_stats"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+	    ///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetInfluencers(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/influencers"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+	    ///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetInfluencersAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/influencers"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+	    ///
+		///
+		///Influencer selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetInfluencers(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/influencers"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+	    ///
+		///
+		///Influencer selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetInfluencersAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/influencers"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+	    ///
+		///The ID of the jobs to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetJobs(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+	    ///
+		///The ID of the jobs to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetJobsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetJobs(Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetJobsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetJobStats(Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/_stats"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+	    ///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetJobStatsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/_stats"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+	    ///
+		///The ID of the jobs stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetJobStats(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_stats"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+	    ///
+		///The ID of the jobs stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetJobStatsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_stats"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, string snapshot_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetModelSnapshotsAsync(string job_id, string snapshot_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetModelSnapshotsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, string snapshot_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetModelSnapshotsAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetModelSnapshotsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+	    ///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetRecords(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/records"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+	    ///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetRecordsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/records"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+	    ///
+		///
+		///Record selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlGetRecords(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/records"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+	    ///
+		///
+		///Record selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlGetRecordsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/records"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_open
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html 
+	    ///
+		///The ID of the job to open
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlOpenJob(string job_id, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_open"), null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_open
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html 
+	    ///
+		///The ID of the job to open
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlOpenJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_open"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html 
+	    ///
+		///The name of the job receiving the data
+		///The data to process
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlPostData(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_data"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html 
+	    ///
+		///The name of the job receiving the data
+		///The data to process
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlPostDataAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_data"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_preview
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html 
+	    ///
+		///The ID of the datafeed to preview
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlPreviewDatafeed(string datafeed_id, Func requestParameters = null)
+			where T : class => this.DoRequest(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_preview"), null, _params(requestParameters));
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_preview
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html 
+	    ///
+		///The ID of the datafeed to preview
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlPreviewDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_preview"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a PUT on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html 
+	    ///
+		///The ID of the datafeed to create
+		///The datafeed config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlPutDatafeed(string datafeed_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(PUT, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), body, _params(requestParameters));
+		
+		///Represents a PUT on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html 
+	    ///
+		///The ID of the datafeed to create
+		///The datafeed config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlPutDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(PUT, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a PUT on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html 
+	    ///
+		///The ID of the job to create
+		///The job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlPutJob(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(PUT, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), body, _params(requestParameters));
+		
+		///Represents a PUT on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html 
+	    ///
+		///The ID of the job to create
+		///The job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlPutJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(PUT, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to revert to
+		///Reversion options
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlRevertModelSnapshot(string job_id, string snapshot_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}/_revert"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to revert to
+		///Reversion options
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlRevertModelSnapshotAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}/_revert"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_start
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html 
+	    ///
+		///The ID of the datafeed to start
+		///The start datafeed parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlStartDatafeed(string datafeed_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_start"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_start
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html 
+	    ///
+		///The ID of the datafeed to start
+		///The start datafeed parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlStartDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_start"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_stop
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html 
+	    ///
+		///The ID of the datafeed to stop
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlStopDatafeed(string datafeed_id, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_stop"), null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_stop
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html 
+	    ///
+		///The ID of the datafeed to stop
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlStopDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_stop"), cancellationToken, null, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html 
+	    ///
+		///The ID of the datafeed to update
+		///The datafeed update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlUpdateDatafeed(string datafeed_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_update"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html 
+	    ///
+		///The ID of the datafeed to update
+		///The datafeed update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlUpdateDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_update"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html 
+	    ///
+		///The ID of the job to create
+		///The job update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlUpdateJob(string job_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_update"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html 
+	    ///
+		///The ID of the job to create
+		///The job update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlUpdateJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_update"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to update
+		///The model snapshot properties to update
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlUpdateModelSnapshot(string job_id, string snapshot_id, PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}/_update"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html 
+	    ///
+		///The ID of the job to fetch
+		///The ID of the snapshot to update
+		///The model snapshot properties to update
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlUpdateModelSnapshotAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/model_snapshots/{snapshot_id.NotNull("snapshot_id")}/_update"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///The job config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlValidate(PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/_validate"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///The job config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlValidateAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/_validate"), cancellationToken, body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate/detector
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///The detector
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public ElasticsearchResponse XpackMlValidateDetector(PostData body, Func requestParameters = null)
+			where T : class => this.DoRequest(POST, Url($"_xpack/ml/anomaly_detectors/_validate/detector"), body, _params(requestParameters));
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate/detector
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+	    ///See also:  
+	    ///
+		///The detector
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		public Task> XpackMlValidateDetectorAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
+			where T : class => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/_validate/detector"), cancellationToken, body, _params(requestParameters));
+		
 		///Represents a GET on /_xpack/security/_authenticate
 		///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 
diff --git a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
index a75c7fad670..21eacf7470c 100644
--- a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
+++ b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
@@ -8185,6 +8185,1108 @@ public partial interface IElasticLowLevelClient
 		///A func that allows you to describe the querystring parameters & request specific connection settings.
 		Task> XpackLicensePostAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
 		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_close
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html 
+		///
+		///The name of the job to close
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlCloseJob(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_close
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html 
+		///
+		///The name of the job to close
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlCloseJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html 
+		///
+		///The ID of the datafeed to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlDeleteDatafeed(string datafeed_id, Func requestParameters = null) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html 
+		///
+		///The ID of the datafeed to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlDeleteDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/_delete_expired_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlDeleteExpiredData(Func requestParameters = null) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/_delete_expired_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlDeleteExpiredDataAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html 
+		///
+		///The ID of the job to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlDeleteJob(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html 
+		///
+		///The ID of the job to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlDeleteJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlDeleteModelSnapshot(string job_id, string snapshot_id, Func requestParameters = null) where T : class;
+		
+		///Represents a DELETE on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to delete
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlDeleteModelSnapshotAsync(string job_id, string snapshot_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_flush
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html 
+		///
+		///The name of the job to flush
+		///Flush parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlFlushJob(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_flush
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html 
+		///
+		///The name of the job to flush
+		///Flush parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlFlushJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+		///
+		///ID of the job to get bucket results from
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetBuckets(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+		///
+		///ID of the job to get bucket results from
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetBucketsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+		///
+		///ID of the job to get bucket results from
+		///Bucket selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetBuckets(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/buckets
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html 
+		///
+		///ID of the job to get bucket results from
+		///Bucket selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetBucketsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetCategories(string job_id, long category_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetCategoriesAsync(string job_id, long category_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetCategories(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetCategoriesAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetCategories(string job_id, long category_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///The identifier of the category definition of interest
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetCategoriesAsync(string job_id, long category_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetCategories(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html 
+		///
+		///The name of the job
+		///Category selection details if not provided in URI
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetCategoriesAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+		///
+		///The ID of the datafeeds to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetDatafeeds(string datafeed_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+		///
+		///The ID of the datafeeds to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetDatafeedsAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetDatafeeds(Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetDatafeedsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+		///
+		///The ID of the datafeeds stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetDatafeedStats(string datafeed_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+		///
+		///The ID of the datafeeds stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetDatafeedStatsAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetDatafeedStats(Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetDatafeedStatsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+		///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetInfluencers(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+		///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetInfluencersAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+		///
+		///
+		///Influencer selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetInfluencers(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/influencers
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html 
+		///
+		///
+		///Influencer selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetInfluencersAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+		///
+		///The ID of the jobs to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetJobs(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+		///
+		///The ID of the jobs to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetJobsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetJobs(Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetJobsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetJobStats(Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetJobStatsAsync(Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+		///
+		///The ID of the jobs stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetJobStats(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/_stats
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html 
+		///
+		///The ID of the jobs stats to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetJobStatsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, string snapshot_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetModelSnapshotsAsync(string job_id, string snapshot_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetModelSnapshotsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, string snapshot_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetModelSnapshotsAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetModelSnapshots(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///Model snapshot selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetModelSnapshotsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+		///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetRecords(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+		///
+		///
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetRecordsAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+		///
+		///
+		///Record selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlGetRecords(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/results/records
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html 
+		///
+		///
+		///Record selection criteria
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlGetRecordsAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_open
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html 
+		///
+		///The ID of the job to open
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlOpenJob(string job_id, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_open
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html 
+		///
+		///The ID of the job to open
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlOpenJobAsync(string job_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html 
+		///
+		///The name of the job receiving the data
+		///The data to process
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlPostData(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_data
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html 
+		///
+		///The name of the job receiving the data
+		///The data to process
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlPostDataAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_preview
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html 
+		///
+		///The ID of the datafeed to preview
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlPreviewDatafeed(string datafeed_id, Func requestParameters = null) where T : class;
+		
+		///Represents a GET on /_xpack/ml/datafeeds/{datafeed_id}/_preview
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html 
+		///
+		///The ID of the datafeed to preview
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlPreviewDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a PUT on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html 
+		///
+		///The ID of the datafeed to create
+		///The datafeed config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlPutDatafeed(string datafeed_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a PUT on /_xpack/ml/datafeeds/{datafeed_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html 
+		///
+		///The ID of the datafeed to create
+		///The datafeed config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlPutDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a PUT on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html 
+		///
+		///The ID of the job to create
+		///The job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlPutJob(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a PUT on /_xpack/ml/anomaly_detectors/{job_id}
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html 
+		///
+		///The ID of the job to create
+		///The job
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlPutJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to revert to
+		///Reversion options
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlRevertModelSnapshot(string job_id, string snapshot_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to revert to
+		///Reversion options
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlRevertModelSnapshotAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_start
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html 
+		///
+		///The ID of the datafeed to start
+		///The start datafeed parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlStartDatafeed(string datafeed_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_start
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html 
+		///
+		///The ID of the datafeed to start
+		///The start datafeed parameters
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlStartDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_stop
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html 
+		///
+		///The ID of the datafeed to stop
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlStopDatafeed(string datafeed_id, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_stop
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html 
+		///
+		///The ID of the datafeed to stop
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlStopDatafeedAsync(string datafeed_id, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html 
+		///
+		///The ID of the datafeed to update
+		///The datafeed update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlUpdateDatafeed(string datafeed_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/datafeeds/{datafeed_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html 
+		///
+		///The ID of the datafeed to update
+		///The datafeed update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlUpdateDatafeedAsync(string datafeed_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html 
+		///
+		///The ID of the job to create
+		///The job update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlUpdateJob(string job_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html 
+		///
+		///The ID of the job to create
+		///The job update settings
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlUpdateJobAsync(string job_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to update
+		///The model snapshot properties to update
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlUpdateModelSnapshot(string job_id, string snapshot_id, PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html 
+		///
+		///The ID of the job to fetch
+		///The ID of the snapshot to update
+		///The model snapshot properties to update
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlUpdateModelSnapshotAsync(string job_id, string snapshot_id, PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///The job config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlValidate(PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///The job config
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlValidateAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate/detector
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///The detector
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		ElasticsearchResponse XpackMlValidateDetector(PostData body, Func requestParameters = null) where T : class;
+		
+		///Represents a POST on /_xpack/ml/anomaly_detectors/_validate/detector
+		///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 
+		/// - Stream, no deserialization, response stream is your responsibility 
+		/// - VoidResponse, no deserialization, response stream never read and closed 
+		/// - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth 
+		///See also:  
+		///
+		///The detector
+		///A func that allows you to describe the querystring parameters & request specific connection settings.
+		Task> XpackMlValidateDetectorAsync(PostData body, Func requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+		
 		///Represents a GET on /_xpack/security/_authenticate
 		///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 
diff --git a/src/Elasticsearch.Net/Serialization/UrlFormatProvider.cs b/src/Elasticsearch.Net/Serialization/UrlFormatProvider.cs
index fe9eb119409..96ce6ae43a6 100644
--- a/src/Elasticsearch.Net/Serialization/UrlFormatProvider.cs
+++ b/src/Elasticsearch.Net/Serialization/UrlFormatProvider.cs
@@ -44,6 +44,9 @@ public string GetStringValue(object valueType)
 			if (valueType is bool)
 				return ((bool)valueType) ? "true" : "false";
 
+			if (valueType is DateTimeOffset)
+				return ((DateTimeOffset)valueType).ToString("o");
+
 			return AttemptTheRightToString(valueType);
 		}
 
diff --git a/src/Nest/Cluster/ClusterState/NodeState.cs b/src/Nest/Cluster/ClusterState/NodeState.cs
index 1d9b8594df8..15f6972f7d3 100644
--- a/src/Nest/Cluster/ClusterState/NodeState.cs
+++ b/src/Nest/Cluster/ClusterState/NodeState.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Linq;
 using System.Collections.Generic;
 using Newtonsoft.Json;
 
diff --git a/src/Nest/CommonAbstractions/Extensions/Extensions.cs b/src/Nest/CommonAbstractions/Extensions/Extensions.cs
index 4f2c5fc39dc..8e8d1d18e3f 100644
--- a/src/Nest/CommonAbstractions/Extensions/Extensions.cs
+++ b/src/Nest/CommonAbstractions/Extensions/Extensions.cs
@@ -18,11 +18,11 @@ namespace Nest
 {
 	internal static class EmptyReadOnly
 	{
-		public static readonly IReadOnlyCollection Collection = new ReadOnlyCollection(new List());
+		public static readonly IReadOnlyCollection Collection = new ReadOnlyCollection(new TElement[0]);
 	}
 	internal static class EmptyReadOnly
 	{
-		public static readonly IReadOnlyDictionary Dictionary = new ReadOnlyDictionary(new Dictionary());
+		public static readonly IReadOnlyDictionary Dictionary = new ReadOnlyDictionary(new Dictionary(0));
 	}
 
 	internal static class Extensions
diff --git a/src/Nest/CommonAbstractions/Infer/CategoryId/CategoryId.cs b/src/Nest/CommonAbstractions/Infer/CategoryId/CategoryId.cs
new file mode 100644
index 00000000000..1f8b19c00e1
--- /dev/null
+++ b/src/Nest/CommonAbstractions/Infer/CategoryId/CategoryId.cs
@@ -0,0 +1,19 @@
+using System.Globalization;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public class CategoryId : IUrlParameter
+	{
+		private readonly long _categoryId;
+
+		public CategoryId(long categoryId)
+		{
+			_categoryId = categoryId;
+		}
+
+		public static implicit operator CategoryId(long categoryId) => new CategoryId(categoryId);
+
+		public string GetString(IConnectionConfigurationValues settings) => _categoryId.ToString(CultureInfo.InvariantCulture);
+	}
+}
diff --git a/src/Nest/CommonAbstractions/Infer/Id/Id.cs b/src/Nest/CommonAbstractions/Infer/Id/Id.cs
index 9c3ca574328..047a42db1c4 100644
--- a/src/Nest/CommonAbstractions/Infer/Id/Id.cs
+++ b/src/Nest/CommonAbstractions/Infer/Id/Id.cs
@@ -1,5 +1,4 @@
 using System;
-using System.CodeDom;
 using System.Diagnostics;
 using Elasticsearch.Net;
 using Newtonsoft.Json;
diff --git a/src/Nest/CommonAbstractions/Infer/Indices/IndicesJsonConverter.cs b/src/Nest/CommonAbstractions/Infer/Indices/IndicesJsonConverter.cs
index 43b31a4dcae..ecc27860de9 100644
--- a/src/Nest/CommonAbstractions/Infer/Indices/IndicesJsonConverter.cs
+++ b/src/Nest/CommonAbstractions/Infer/Indices/IndicesJsonConverter.cs
@@ -38,9 +38,8 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
 
 		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 		{
-
 			if (reader.TokenType != JsonToken.StartArray) return null;
-			var indices = new List { };
+			var indices = new List();
 			while (reader.TokenType != JsonToken.EndArray)
 			{
 				var index = reader.ReadAsString();
diff --git a/src/Nest/CommonAbstractions/Infer/Types/TypesJsonConverter.cs b/src/Nest/CommonAbstractions/Infer/Types/TypesJsonConverter.cs
index dbf2d74855d..fa8cd203d1b 100644
--- a/src/Nest/CommonAbstractions/Infer/Types/TypesJsonConverter.cs
+++ b/src/Nest/CommonAbstractions/Infer/Types/TypesJsonConverter.cs
@@ -35,7 +35,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
 		{
 
 			if (reader.TokenType != JsonToken.StartArray) return null;
-			var types = new List { };
+			var types = new List();
 			while (reader.TokenType != JsonToken.EndArray)
 			{
 				var type = reader.ReadAsString();
diff --git a/src/Nest/CommonAbstractions/Request/RouteValues.cs b/src/Nest/CommonAbstractions/Request/RouteValues.cs
index 75a7921374e..530f5c129de 100644
--- a/src/Nest/CommonAbstractions/Request/RouteValues.cs
+++ b/src/Nest/CommonAbstractions/Request/RouteValues.cs
@@ -33,6 +33,12 @@ public class RouteValues
 		public string WatchId => GetResolved("watch_id");
 		public string ThreadPoolPatterns => GetResolved("thread_pool_patterns");
 		public string ActionId => GetResolved("action_id");
+		public string JobId => GetResolved("job_id");
+		public string DatafeedId => GetResolved("datafeed_id");
+		public string FilterId => GetResolved("filter_id");
+		public string SnapshotId => GetResolved("snapshot_id");
+		public string CategoryId => GetResolved("category_id");
+		public string Timestamp => GetResolved("timestamp");
 		public WatcherStatsMetric? WatcherStatsMetric => GetResolved("watcher_stats_metric").ToEnum();
 
 		private string GetResolved(string route)
diff --git a/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochMillisecondsDateTimeJsonConverter.cs b/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochMillisecondsDateTimeJsonConverter.cs
new file mode 100644
index 00000000000..075f419f0e5
--- /dev/null
+++ b/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochMillisecondsDateTimeJsonConverter.cs
@@ -0,0 +1,55 @@
+using System;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	internal class EpochMillisecondsDateTimeJsonConverter : DateTimeConverterBase
+	{
+		private static readonly DateTimeOffset Epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+
+		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+		{
+			var dateTimeOffset = value as DateTimeOffset?;
+
+			if (dateTimeOffset == null)
+			{
+				var dateTime = value as DateTime?;
+				if (dateTime == null)
+				{
+					writer.WriteNull();
+					return;
+				}
+
+				var dateTimeDifference = (dateTime.Value - Epoch).TotalMilliseconds;
+				writer.WriteValue((long)dateTimeDifference);
+				return;
+			}
+
+			var dateTimeOffsetDifference = (dateTimeOffset.Value - Epoch).TotalMilliseconds;
+			writer.WriteValue((long)dateTimeOffsetDifference);
+		}
+
+		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+		{
+			if (reader.TokenType != JsonToken.Integer)
+			{
+				if (objectType == typeof(DateTimeOffset?) || objectType == typeof(DateTime?))
+					return null;
+
+				if (objectType == typeof(DateTimeOffset))
+					return default(DateTimeOffset);
+
+				return default(DateTime);
+			}
+
+			var millisecondsSinceEpoch = Convert.ToDouble(reader.Value);
+			var dateTimeOffset = Epoch.AddMilliseconds(millisecondsSinceEpoch);
+
+			if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?))
+				return dateTimeOffset;
+
+			return dateTimeOffset.DateTime;
+		}
+	}
+}
diff --git a/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochSecondsDateTimeJsonConverter.cs b/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochSecondsDateTimeJsonConverter.cs
index 9e3fe6afccd..cc38a8eff4e 100644
--- a/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochSecondsDateTimeJsonConverter.cs
+++ b/src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/EpochSecondsDateTimeJsonConverter.cs
@@ -4,6 +4,53 @@
 
 namespace Nest
 {
+	internal class EpochStringSecondsDateTimeJsonConverter : DateTimeConverterBase
+	{
+		private static readonly DateTimeOffset Epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+
+		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+		{
+			var dateTimeOffset = value as DateTimeOffset?;
+
+			if (dateTimeOffset == null)
+			{
+				var dateTime = value as DateTime?;
+				if (dateTime == null)
+				{
+					writer.WriteNull();
+					return;
+				}
+
+				var dateTimeDifference = (dateTime.Value - Epoch).TotalSeconds;
+				writer.WriteValue(dateTimeDifference.ToString());
+				return;
+			}
+
+			var dateTimeOffsetDifference = (dateTimeOffset.Value - Epoch).TotalSeconds;
+			writer.WriteValue(dateTimeOffsetDifference.ToString());
+		}
+
+		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+		{
+			if (reader.TokenType != JsonToken.String)
+			{
+				if (objectType == typeof(DateTimeOffset?) || objectType == typeof(DateTime?))
+					return null;
+
+				return objectType == typeof(DateTimeOffset)
+					? default(DateTimeOffset)
+					: default(DateTime);
+			}
+
+			var secondsSinceEpoch = Convert.ToDouble(reader.Value);
+			var dateTimeOffset = Epoch.AddSeconds(secondsSinceEpoch);
+
+			return objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?)
+				? dateTimeOffset
+				: dateTimeOffset.DateTime;
+		}
+	}
+
 	internal class EpochSecondsDateTimeJsonConverter : DateTimeConverterBase
 	{
 		private static readonly DateTimeOffset Epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
@@ -32,7 +79,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
 
 		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 		{
-			if (reader.TokenType != JsonToken.Float)
+			if (reader.TokenType != JsonToken.Float && reader.TokenType != JsonToken.Integer)
 			{
 				if (objectType == typeof(DateTimeOffset?) || objectType == typeof(DateTime?))
 					return null;
@@ -43,11 +90,12 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
 			}
 
 			var secondsSinceEpoch = (double)reader.Value;
-			var dateTimeOffset = Epoch.Add(TimeSpan.FromSeconds(secondsSinceEpoch));
+			var dateTimeOffset = Epoch.AddSeconds(secondsSinceEpoch);
 
-			return objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?)
-				? dateTimeOffset
-				: dateTimeOffset.DateTime;
+			if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?))
+				return dateTimeOffset;
+
+			return dateTimeOffset.DateTime;
 		}
 	}
 }
diff --git a/src/Nest/Ingest/SimulatePipeline/SimulatePipelineDocument.cs b/src/Nest/Ingest/SimulatePipeline/SimulatePipelineDocument.cs
index d29c28b096c..e03a1879ebd 100644
--- a/src/Nest/Ingest/SimulatePipeline/SimulatePipelineDocument.cs
+++ b/src/Nest/Ingest/SimulatePipeline/SimulatePipelineDocument.cs
@@ -1,9 +1,6 @@
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Nest
 {
diff --git a/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs b/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs
index 7629fa45a5c..925355c6299 100644
--- a/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs
+++ b/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs
@@ -71,7 +71,7 @@ public QueryContainer Terms(Func, ITermsQuery> selector)
 
 		/// 
 		/// A fuzzy based query that uses similarity based on Levenshtein (edit distance) algorithm.
-		/// Warning: this query is not very scalable with its default prefix length of 0  in this case,
+		/// Warning: this query is not very scalable with its default prefix length of 0 – in this case,
 		/// every term will be enumerated and cause an edit score calculation or max_expansions is not set.
 		/// 
 		public QueryContainer Fuzzy(Func, IFuzzyQuery> selector) =>
@@ -157,7 +157,7 @@ public QueryContainer TermRange(Func, ITermRangeQuer
 			WrapInContainer(selector, (query, container) => container.Range = query);
 
 		/// 
-		/// More like this query find documents that are like provided text by running it against one or more fields.
+		/// More like this query find documents that are “like” provided text by running it against one or more fields.
 		/// 
 		public QueryContainer MoreLikeThis(Func, IMoreLikeThisQuery> selector) =>
 			WrapInContainer(selector, (query, container) => container.MoreLikeThis = query);
diff --git a/src/Nest/XPack/MachineLearning/CloseJob/CloseJobRequest.cs b/src/Nest/XPack/MachineLearning/CloseJob/CloseJobRequest.cs
new file mode 100644
index 00000000000..72be85a6f4e
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/CloseJob/CloseJobRequest.cs
@@ -0,0 +1,9 @@
+namespace Nest
+{
+	public partial interface ICloseJobRequest {}
+
+	public partial class CloseJobRequest {}
+
+	[DescriptorFor("XpackMlCloseJob")]
+	public partial class CloseJobDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/CloseJob/CloseJobResponse.cs b/src/Nest/XPack/MachineLearning/CloseJob/CloseJobResponse.cs
new file mode 100644
index 00000000000..8b5e80b2cf3
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/CloseJob/CloseJobResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface ICloseJobResponse : IResponse
+	{
+		[JsonProperty("closed")]
+		bool Closed { get; }
+	}
+
+	public class CloseJobResponse : ResponseBase, ICloseJobResponse
+	{
+		public bool Closed { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/CloseJob/ElasticClient-CloseJob.cs b/src/Nest/XPack/MachineLearning/CloseJob/ElasticClient-CloseJob.cs
new file mode 100644
index 00000000000..766e9c9061b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/CloseJob/ElasticClient-CloseJob.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Closes a Machine Learning job.
+		/// A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results.
+		/// 
+		ICloseJobResponse CloseJob(Id jobId, Func selector = null);
+
+		/// 
+		ICloseJobResponse CloseJob(ICloseJobRequest request);
+
+		/// 
+		Task CloseJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task CloseJobAsync(ICloseJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public ICloseJobResponse CloseJob(Id jobId, Func selector = null) =>
+			this.CloseJob(selector.InvokeOrDefault(new CloseJobDescriptor(jobId)));
+
+		/// 
+		public ICloseJobResponse CloseJob(ICloseJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlCloseJobDispatch(p)
+			);
+
+		/// 
+		public Task CloseJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.CloseJobAsync(selector.InvokeOrDefault(new CloseJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task CloseJobAsync(ICloseJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlCloseJobDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Datafeed/ChunkingConfig.cs b/src/Nest/XPack/MachineLearning/Datafeed/ChunkingConfig.cs
new file mode 100644
index 00000000000..cf773d2d340
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Datafeed/ChunkingConfig.cs
@@ -0,0 +1,78 @@
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	/// 
+	/// Datafeeds might be required to search over long time periods, for several months or years.
+	/// This search is split into time chunks in order to ensure the load on Elasticsearch is managed.
+	/// Chunking configuration controls how the size of these time chunks are calculated.
+	/// 
+	[JsonObject]
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IChunkingConfig
+	{
+		/// 
+		/// The chunking mode
+		/// 
+		[JsonProperty("mode")]
+		ChunkingMode? Mode { get; set; }
+
+		/// 
+		/// The time span that each search will be querying.
+		/// This setting is only applicable when  is set to .
+		/// 
+		[JsonProperty("time_span")]
+		Time TimeSpan { get; set; }
+	}
+
+	/// 
+	public class ChunkingConfig : IChunkingConfig
+	{
+		/// 
+		public ChunkingMode? Mode { get; set; }
+
+		/// 
+		public Time TimeSpan { get; set; }
+	}
+
+	/// 
+	public class ChunkingConfigDescriptor : DescriptorBase, IChunkingConfig
+	{
+		ChunkingMode? IChunkingConfig.Mode { get; set; }
+		Time IChunkingConfig.TimeSpan { get; set; }
+
+		/// 
+		public ChunkingConfigDescriptor Mode(ChunkingMode mode) => Assign(a => a.Mode = mode);
+
+		/// 
+		public ChunkingConfigDescriptor TimeSpan(Time timeSpan) => Assign(a => a.TimeSpan = timeSpan);
+	}
+
+
+	/// 
+	/// The chunking mode
+	/// 
+	[JsonConverter(typeof(StringEnumConverter))]
+	public enum ChunkingMode
+	{
+		/// 
+		/// The chunk size will be dynamically calculated. This is the default and recommended value.
+		/// 
+		[EnumMember(Value = "auto")]
+		Auto,
+
+		/// 
+		/// Chunking will be applied according to the specified time span.
+		/// 
+		[EnumMember(Value = "manual")]
+		Manual,
+
+		/// 
+		/// No chunking will be applied.
+		/// 
+		[EnumMember(Value = "off")]
+		Off
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Datafeed/DatafeedConfig.cs b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedConfig.cs
new file mode 100644
index 00000000000..190210b6496
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedConfig.cs
@@ -0,0 +1,80 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Configuration of a Machine Learning Datafeed
+	/// 
+	[JsonObject]
+	public class DatafeedConfig
+	{
+		/// 
+		/// The datafeed id
+		/// 
+		[JsonProperty("datafeed_id")]
+		public string DatafeedId { get; internal set; }
+
+		/// 
+		/// the aggregation searches to perform for the datafeed
+		/// 
+		[JsonProperty("aggregations")]
+		public AggregationDictionary Aggregations { get; internal set; }
+
+		/// 
+		/// Specifies how data searches are split into time chunks.
+		/// 
+		[JsonProperty("chunking_config")]
+		public IChunkingConfig ChunkingConfig { get; internal set; }
+
+		/// 
+		/// The interval at which scheduled queries are made while the datafeed runs in real time.
+		/// The default value is either the bucket span for short bucket spans, or, for longer bucket spans,
+		/// a sensible fraction of the bucket span.
+		/// 
+		[JsonProperty("frequency")]
+		public Time Frequency { get; internal set; }
+
+		///A list of index names to search within. Wildcards are supported
+		[JsonProperty("indices")]
+		[JsonConverter(typeof(IndicesJsonConverter))]
+		public Indices Indices { get; internal set; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the job.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// Describe the query to perform using a query descriptor lambda
+		/// 
+		[JsonProperty("query")]
+		public QueryContainer Query { get; internal set; }
+
+		/// 
+		/// The number of seconds behind real time that data is queried.
+		/// For example, if data from 10:04 A.M. might not be searchable in Elasticsearch until 10:06 A.M.,
+		/// set this property to 120 seconds. The default value is 60s.
+		/// 
+		[JsonProperty("query_delay")]
+		public Time QueryDelay { get; internal set; }
+
+		/// 
+		/// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. T
+		/// he detector configuration in a job can contain functions that use these script fields.
+		/// 
+		[JsonProperty("script_fields")]
+		public IScriptFields ScriptFields { get; internal set; }
+
+		/// 
+		/// The size parameter that is used in Elasticsearch searches
+		/// 
+		[JsonProperty("scroll_size")]
+		public int? ScrollSize { get; internal set; }
+
+		///A list of types to search for within the specified indices
+		[JsonProperty("types")]
+		[JsonConverter(typeof(TypesJsonConverter))]
+		public Types Types { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Datafeed/DatafeedState.cs b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedState.cs
new file mode 100644
index 00000000000..d08cf6af869
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedState.cs
@@ -0,0 +1,19 @@
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	[JsonConverter(typeof(StringEnumConverter))]
+	public enum DatafeedState
+	{
+		[EnumMember(Value = "started")]
+		Started,
+		[EnumMember(Value = "stopped")]
+		Stopped,
+		[EnumMember(Value = "starting")]
+		Starting,
+		[EnumMember(Value = "stopping")]
+		Stopping
+	}
+}
\ No newline at end of file
diff --git a/src/Nest/XPack/MachineLearning/Datafeed/DatafeedStats.cs b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedStats.cs
new file mode 100644
index 00000000000..048e30e71cd
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Datafeed/DatafeedStats.cs
@@ -0,0 +1,20 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class DatafeedStats
+	{
+		[JsonProperty("datafeed_id")]
+		public string DatafeedId { get; internal set; }
+
+		[JsonProperty("state")]
+		public DatafeedState State { get; internal set; }
+
+		[JsonProperty("node")]
+		public DiscoveryNode Node { get; internal set; }
+
+		[JsonProperty("assignment_explanation")]
+		public string AssignmentExplanation { get; internal set; }
+	}
+}
\ No newline at end of file
diff --git a/src/Nest/XPack/MachineLearning/Datafeed/DiscoveryNode.cs b/src/Nest/XPack/MachineLearning/Datafeed/DiscoveryNode.cs
new file mode 100644
index 00000000000..ab981cd1b7d
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Datafeed/DiscoveryNode.cs
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class DiscoveryNode
+	{
+		/// 
+		/// The unique identifier of the node.
+		/// 
+		[JsonProperty("id")]
+		public string Id { get; internal set; }
+
+		/// 
+		/// The node name.
+		/// 
+		[JsonProperty("name")]
+		public string Name { get; internal set; }
+
+		/// 
+		/// The ephemeral id of the node.
+		/// 
+		[JsonProperty("ephemeral_id")]
+		public string EphemeralId { get; internal set; }
+
+		/// 
+		/// The host and port where transport HTTP connections are accepted.
+		/// 
+		[JsonProperty("transport_address")]
+		public string TransportAddress { get; internal set; }
+
+		/// 
+		/// The node attributes
+		/// 
+		[JsonProperty("attributes")]
+		[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
+		public IReadOnlyDictionary Attributes { get; internal set; } = EmptyReadOnly.Dictionary;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedRequest.cs
new file mode 100644
index 00000000000..e09f0eabcc9
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedRequest.cs
@@ -0,0 +1,9 @@
+namespace Nest
+{
+	public partial interface IDeleteDatafeedRequest {}
+
+	public partial class DeleteDatafeedRequest {}
+
+	[DescriptorFor("XpackMlDeleteDatafeed")]
+	public partial class DeleteDatafeedDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedResponse.cs
new file mode 100644
index 00000000000..c42c6b9d01f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteDatafeed/DeleteDatafeedResponse.cs
@@ -0,0 +1,6 @@
+namespace Nest
+{
+	public interface IDeleteDatafeedResponse : IAcknowledgedResponse {}
+
+	public class DeleteDatafeedResponse : AcknowledgedResponseBase, IDeleteDatafeedResponse {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteDatafeed/ElasticClient-DeleteDatafeed.cs b/src/Nest/XPack/MachineLearning/DeleteDatafeed/ElasticClient-DeleteDatafeed.cs
new file mode 100644
index 00000000000..429a7d072d3
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteDatafeed/ElasticClient-DeleteDatafeed.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Deletes an existing datafeed for a Machine Learning job.
+		/// 
+		IDeleteDatafeedResponse DeleteDatafeed(Id datafeedId, Func selector = null);
+
+		/// 
+		IDeleteDatafeedResponse DeleteDatafeed(IDeleteDatafeedRequest request);
+
+		/// 
+		Task DeleteDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task DeleteDatafeedAsync(IDeleteDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IDeleteDatafeedResponse DeleteDatafeed(Id datafeedId, Func selector = null) =>
+			this.DeleteDatafeed(selector.InvokeOrDefault(new DeleteDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IDeleteDatafeedResponse DeleteDatafeed(IDeleteDatafeedRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlDeleteDatafeedDispatch(p)
+			);
+
+		/// 
+		public Task DeleteDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.DeleteDatafeedAsync(selector.InvokeOrDefault(new DeleteDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task DeleteDatafeedAsync(IDeleteDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlDeleteDatafeedDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataRequest.cs b/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataRequest.cs
new file mode 100644
index 00000000000..ec0116a7c53
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataRequest.cs
@@ -0,0 +1,9 @@
+namespace Nest
+{
+	public partial interface IDeleteExpiredDataRequest {}
+
+	public partial class DeleteExpiredDataRequest {}
+
+	[DescriptorFor("XpackMlDeleteExpiredData")]
+	public partial class DeleteExpiredDataDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataResponse.cs b/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataResponse.cs
new file mode 100644
index 00000000000..4a21e18c9b0
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteExpiredData/DeleteExpiredDataResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IDeleteExpiredDataResponse : IResponse
+	{
+		[JsonProperty("deleted")]
+		bool Deleted { get; }
+	}
+
+	public class DeleteExpiredDataResponse : ResponseBase, IDeleteExpiredDataResponse
+	{
+		public bool Deleted { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteExpiredData/ElasticClient-DeleteExpiredData.cs b/src/Nest/XPack/MachineLearning/DeleteExpiredData/ElasticClient-DeleteExpiredData.cs
new file mode 100644
index 00000000000..c64af9f9539
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteExpiredData/ElasticClient-DeleteExpiredData.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Deletes expired data for Machine Learning.
+		/// 
+		IDeleteExpiredDataResponse DeleteExpiredData(Func selector = null);
+
+		/// 
+		IDeleteExpiredDataResponse DeleteExpiredData(IDeleteExpiredDataRequest request);
+
+		/// 
+		Task DeleteExpiredDataAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task DeleteExpiredDataAsync(IDeleteExpiredDataRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IDeleteExpiredDataResponse DeleteExpiredData(Func selector = null) =>
+			this.DeleteExpiredData(selector.InvokeOrDefault(new DeleteExpiredDataDescriptor()));
+
+		/// 
+		public IDeleteExpiredDataResponse DeleteExpiredData(IDeleteExpiredDataRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlDeleteExpiredDataDispatch(p)
+			);
+
+		/// 
+		public Task DeleteExpiredDataAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.DeleteExpiredDataAsync(selector.InvokeOrDefault(new DeleteExpiredDataDescriptor()), cancellationToken);
+
+		/// 
+		public Task DeleteExpiredDataAsync(IDeleteExpiredDataRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlDeleteExpiredDataDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobRequest.cs b/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobRequest.cs
new file mode 100644
index 00000000000..ff9e7edd84f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobRequest.cs
@@ -0,0 +1,11 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public partial interface IDeleteJobRequest {}
+
+	public partial class DeleteJobRequest {}
+
+	[DescriptorFor("XpackMlDeleteJob")]
+	public partial class DeleteJobDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobResponse.cs b/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobResponse.cs
new file mode 100644
index 00000000000..33caf65ef0f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteJob/DeleteJobResponse.cs
@@ -0,0 +1,6 @@
+namespace Nest
+{
+	public interface IDeleteJobResponse : IAcknowledgedResponse {}
+
+	public class DeleteJobResponse : AcknowledgedResponseBase, IDeleteJobResponse {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteJob/ElasticClient-DeleteJob.cs b/src/Nest/XPack/MachineLearning/DeleteJob/ElasticClient-DeleteJob.cs
new file mode 100644
index 00000000000..b0bea31138b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteJob/ElasticClient-DeleteJob.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Deletes a Machine Learning job.
+		/// Before you can delete a job, you must delete the datafeeds that are associated with it, see DeleteDatafeed. Unless the force parameter is used the job must be closed before it can be deleted.
+		/// It is not currently possible to delete multiple jobs using wildcards or a comma separated list.
+		/// 
+		IDeleteJobResponse DeleteJob(Id jobId, Func selector = null);
+
+		/// 
+		IDeleteJobResponse DeleteJob(IDeleteJobRequest request);
+
+		/// 
+		Task DeleteJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task DeleteJobAsync(IDeleteJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IDeleteJobResponse DeleteJob(Id jobId, Func selector = null) =>
+			this.DeleteJob(selector.InvokeOrDefault(new DeleteJobDescriptor(jobId)));
+
+		/// 
+		public IDeleteJobResponse DeleteJob(IDeleteJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlDeleteJobDispatch(p)
+			);
+
+		/// 
+		public Task DeleteJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.DeleteJobAsync(selector.InvokeOrDefault(new DeleteJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task DeleteJobAsync(IDeleteJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlDeleteJobDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotRequest.cs b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotRequest.cs
new file mode 100644
index 00000000000..66d534929af
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotRequest.cs
@@ -0,0 +1,9 @@
+namespace Nest
+{
+	public partial interface IDeleteModelSnapshotRequest {}
+
+	public partial class DeleteModelSnapshotRequest {}
+
+	[DescriptorFor("XpackMlDeleteModelSnapshot")]
+	public partial class DeleteModelSnapshotDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotResponse.cs b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotResponse.cs
new file mode 100644
index 00000000000..be4908b23cc
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/DeleteModelSnapshotResponse.cs
@@ -0,0 +1,6 @@
+namespace Nest
+{
+	public interface IDeleteModelSnapshotResponse : IAcknowledgedResponse {}
+
+	public class DeleteModelSnapshotResponse : AcknowledgedResponseBase, IDeleteModelSnapshotResponse {}
+}
diff --git a/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/ElasticClient-DeleteModelSnapshot.cs b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/ElasticClient-DeleteModelSnapshot.cs
new file mode 100644
index 00000000000..f8481b73f88
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/DeleteModelSnapshot/ElasticClient-DeleteModelSnapshot.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Deletes an existing Machine Learning model snapshot.
+		/// 
+		/// 
+		/// You cannot delete the active model snapshot.
+		/// To delete that snapshot, first revert to a different one.
+		/// 
+		IDeleteModelSnapshotResponse DeleteModelSnapshot(Id jobId, Id snapshotId, Func selector = null);
+
+		/// 
+		IDeleteModelSnapshotResponse DeleteModelSnapshot(IDeleteModelSnapshotRequest request);
+
+		/// 
+		Task DeleteModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task DeleteModelSnapshotAsync(IDeleteModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IDeleteModelSnapshotResponse DeleteModelSnapshot(Id jobId, Id snapshotId, Func selector = null) =>
+			this.DeleteModelSnapshot(selector.InvokeOrDefault(new DeleteModelSnapshotDescriptor(jobId, snapshotId)));
+
+		/// 
+		public IDeleteModelSnapshotResponse DeleteModelSnapshot(IDeleteModelSnapshotRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlDeleteModelSnapshotDispatch(p)
+			);
+
+		/// 
+		public Task DeleteModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.DeleteModelSnapshotAsync(selector.InvokeOrDefault(new DeleteModelSnapshotDescriptor(jobId, snapshotId)), cancellationToken);
+
+		/// 
+		public Task DeleteModelSnapshotAsync(IDeleteModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlDeleteModelSnapshotDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/FlushJob/ElasticClient-FlushJob.cs b/src/Nest/XPack/MachineLearning/FlushJob/ElasticClient-FlushJob.cs
new file mode 100644
index 00000000000..06b7beeec1a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/FlushJob/ElasticClient-FlushJob.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Forces any buffered data to be processed by the Machine Learning job.
+		/// 
+		IFlushJobResponse FlushJob(Id jobId, Func selector = null);
+
+		/// 
+		IFlushJobResponse FlushJob(IFlushJobRequest request);
+
+		/// 
+		Task FlushJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task FlushJobAsync(IFlushJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IFlushJobResponse FlushJob(Id jobId, Func selector = null) =>
+			this.FlushJob(selector.InvokeOrDefault(new FlushJobDescriptor(jobId)));
+
+		/// 
+		public IFlushJobResponse FlushJob(IFlushJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlFlushJobDispatch
+			);
+
+		/// 
+		public Task FlushJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.FlushJobAsync(selector.InvokeOrDefault(new FlushJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task FlushJobAsync(IFlushJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlFlushJobDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/FlushJob/FlushJobRequest.cs b/src/Nest/XPack/MachineLearning/FlushJob/FlushJobRequest.cs
new file mode 100644
index 00000000000..f6fa28eb3e3
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/FlushJob/FlushJobRequest.cs
@@ -0,0 +1,74 @@
+using System;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	public partial interface IFlushJobRequest
+	{
+		/// 
+		/// Specifies that no data prior to this date is expected.
+		/// 
+		[JsonProperty("advance_time")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? AdvanceTime { get; set; }
+
+		/// 
+		/// Calculates the interim results for the most recent bucket or all buckets within the latency period.
+		/// 
+		[JsonProperty("calc_interim")]
+		bool? CalculateInterim { get; set; }
+
+		/// 
+		///  When used in conjunction with , specifies the range of buckets on
+		/// which to calculate interim results.
+		/// 
+		[JsonProperty("end")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? End { get; set; }
+
+		/// 
+		/// When used in conjunction with , specifies the range of buckets
+		/// on which to calculate interim results.
+		/// 
+		[JsonProperty("start")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? Start { get; set; }
+	}
+
+	public partial class FlushJobRequest
+	{
+		/// 
+		public DateTimeOffset? AdvanceTime { get; set; }
+		/// 
+		public bool? CalculateInterim { get; set; }
+		/// 
+		public DateTimeOffset? End { get; set; }
+		/// 
+		public DateTimeOffset? Start { get; set; }
+	}
+
+	[DescriptorFor("XpackMlFlushJob")]
+	public partial class FlushJobDescriptor
+	{
+		DateTimeOffset? IFlushJobRequest.AdvanceTime { get; set; }
+		bool? IFlushJobRequest.CalculateInterim { get; set; }
+		DateTimeOffset? IFlushJobRequest.End { get; set; }
+		DateTimeOffset? IFlushJobRequest.Start { get; set; }
+
+		/// 
+		public FlushJobDescriptor AdvanceTime(DateTimeOffset advanceTime) => Assign(a => a.AdvanceTime = advanceTime);
+
+		/// 
+		public FlushJobDescriptor CalculateInterim(bool calculateInterim = true) => Assign(a => a.CalculateInterim = calculateInterim);
+
+		/// 
+		public FlushJobDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+
+		/// 
+		public FlushJobDescriptor Start(DateTimeOffset start) => Assign(a => a.Start = start);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/FlushJob/FlushJobResponse.cs b/src/Nest/XPack/MachineLearning/FlushJob/FlushJobResponse.cs
new file mode 100644
index 00000000000..4ae6b6e6aee
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/FlushJob/FlushJobResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IFlushJobResponse : IResponse
+	{
+		[JsonProperty("flushed")]
+		bool Flushed { get; }
+	}
+
+	public class FlushJobResponse : ResponseBase, IFlushJobResponse
+	{
+		public bool Flushed { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetAnomalyRecords/ElasticClient-GetAnomalyRecords.cs b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/ElasticClient-GetAnomalyRecords.cs
new file mode 100644
index 00000000000..aa079338452
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/ElasticClient-GetAnomalyRecords.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieve anomaly records for a Machine Learning job.
+		/// 
+		IGetAnomalyRecordsResponse GetAnomalyRecords(Id jobId, Func selector = null);
+
+		/// 
+		IGetAnomalyRecordsResponse GetAnomalyRecords(IGetAnomalyRecordsRequest request);
+
+		/// 
+		Task GetAnomalyRecordsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetAnomalyRecordsAsync(IGetAnomalyRecordsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetAnomalyRecordsResponse GetAnomalyRecords(Id jobId, Func selector = null) =>
+			this.GetAnomalyRecords(selector.InvokeOrDefault(new GetAnomalyRecordsDescriptor(jobId)));
+
+		/// 
+		public IGetAnomalyRecordsResponse GetAnomalyRecords(IGetAnomalyRecordsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlGetRecordsDispatch
+			);
+
+		/// 
+		public Task GetAnomalyRecordsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetAnomalyRecordsAsync(selector.InvokeOrDefault(new GetAnomalyRecordsDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task GetAnomalyRecordsAsync(IGetAnomalyRecordsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlGetRecordsDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsRequest.cs b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsRequest.cs
new file mode 100644
index 00000000000..7b373bcbffe
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsRequest.cs
@@ -0,0 +1,119 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve retrieve anomaly records for a Machine Learning job.
+	/// 
+	public partial interface IGetAnomalyRecordsRequest
+	{
+		/// 
+		/// If true, the results are sorted in descending order.
+		/// 
+		[JsonProperty("desc")]
+		bool? Descending { get; set; }
+
+		/// 
+		/// If true, the output excludes interim results. By default, interim results are included.
+		/// 
+		[JsonProperty("exclude_interim")]
+		bool? ExcludeInterim { get; set; }
+
+		/// 
+		/// Returns records with timestamps earlier than this time.
+		/// 
+		[JsonProperty("end")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? End { get; set; }
+
+		/// 
+		/// Specifies pagination for the records
+		/// 
+		[JsonProperty("page")]
+		IPage Page { get; set; }
+
+		/// 
+		/// Returns records with anomaly scores higher than this value.
+		/// 
+		[JsonProperty("record_score")]
+		double? RecordScore { get; set; }
+
+		/// 
+		/// Specifies the sort field for the requested records. By default, records are sorted by the record score value.
+		/// 
+		[JsonProperty("sort")]
+		Field Sort { get; set; }
+
+		/// 
+		/// Returns records with timestamps after this time.
+		/// 
+		[JsonProperty("start")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	public partial class GetAnomalyRecordsRequest
+	{
+		/// 
+		public bool? Descending { get; set; }
+
+		/// 
+		public bool? ExcludeInterim { get; set; }
+
+		/// 
+		public DateTimeOffset? End { get; set; }
+
+		/// 
+		public IPage Page { get; set; }
+
+		/// 
+		public double? RecordScore { get; set; }
+
+		/// 
+		public Field Sort { get; set; }
+
+		/// 
+		public DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlGetRecords")]
+	public partial class GetAnomalyRecordsDescriptor
+	{
+		public GetAnomalyRecordsDescriptor() : base() { }
+
+		bool? IGetAnomalyRecordsRequest.Descending { get; set; }
+		DateTimeOffset? IGetAnomalyRecordsRequest.End { get; set; }
+		IPage IGetAnomalyRecordsRequest.Page { get; set; }
+		Field IGetAnomalyRecordsRequest.Sort { get; set; }
+		DateTimeOffset? IGetAnomalyRecordsRequest.Start { get; set; }
+		bool? IGetAnomalyRecordsRequest.ExcludeInterim { get; set; }
+		double? IGetAnomalyRecordsRequest.RecordScore { get; set; }
+
+		/// 
+		public GetAnomalyRecordsDescriptor Descending(bool descending = true) => Assign(a => a.Descending = descending);
+
+		/// 
+		public GetAnomalyRecordsDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+
+		/// 
+		public GetAnomalyRecordsDescriptor Page(Func selector) =>
+			Assign(a => a.Page = selector?.Invoke(new PageDescriptor()));
+
+		/// 
+		public GetAnomalyRecordsDescriptor Sort(Field field) => Assign(a => a.Sort = field);
+
+		/// 
+		public GetAnomalyRecordsDescriptor Start(DateTimeOffset end) => Assign(a => a.Start = end);
+
+		/// 
+		public GetAnomalyRecordsDescriptor ExcludeInterim(bool excludeInterim = true) =>
+			Assign(a => a.ExcludeInterim = excludeInterim);
+
+		/// 
+		public GetAnomalyRecordsDescriptor RecordScore(double recordScore) =>
+			Assign(a => a.RecordScore = recordScore);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsResponse.cs b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsResponse.cs
new file mode 100644
index 00000000000..06f278370af
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetAnomalyRecords/GetAnomalyRecordsResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetAnomalyRecordsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("records")]
+		IReadOnlyCollection Records { get; }
+	}
+
+	public class GetAnomalyRecordsResponse : ResponseBase, IGetAnomalyRecordsResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Records { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetBuckets/ElasticClient-GetBuckets.cs b/src/Nest/XPack/MachineLearning/GetBuckets/ElasticClient-GetBuckets.cs
new file mode 100644
index 00000000000..b1d42d8098f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetBuckets/ElasticClient-GetBuckets.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves Machine Learning job results for one or more buckets.
+		/// 
+		IGetBucketsResponse GetBuckets(Id jobId, Func selector = null);
+
+		/// 
+		IGetBucketsResponse GetBuckets(IGetBucketsRequest request);
+
+		/// 
+		Task GetBucketsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetBucketsAsync(IGetBucketsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetBucketsResponse GetBuckets(Id jobId, Func selector = null) =>
+			this.GetBuckets(selector.InvokeOrDefault(new GetBucketsDescriptor(jobId)));
+
+		/// 
+		public IGetBucketsResponse GetBuckets(IGetBucketsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlGetBucketsDispatch
+			);
+
+		/// 
+		public Task GetBucketsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetBucketsAsync(selector.InvokeOrDefault(new GetBucketsDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task GetBucketsAsync(IGetBucketsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlGetBucketsDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsRequest.cs b/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsRequest.cs
new file mode 100644
index 00000000000..77397936e51
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsRequest.cs
@@ -0,0 +1,137 @@
+using System;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve job results for one or more buckets.
+	/// 
+	public partial interface IGetBucketsRequest
+	{
+		/// 
+		/// Returns buckets with anomaly scores higher than this value.
+		/// 
+		[JsonProperty("anomaly_score")]
+		double? AnomalyScore { get; set; }
+
+		/// 
+		/// If true, the buckets are sorted in descending order.
+		/// 
+		[JsonProperty("desc")]
+		bool? Descending { get; set; }
+
+		/// 
+		/// Returns buckets with timestamps earlier than this time.
+		/// 
+		[JsonProperty("end")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? End { get; set; }
+
+		/// 
+		/// If true, the output excludes interim results. By default, interim results are included.
+		/// 
+		[JsonProperty("exclude_interim")]
+		bool? ExcludeInterim { get; set; }
+
+		/// 
+		/// If true, the output includes anomaly records.
+		/// 
+		[JsonProperty("expand")]
+		bool? Expand { get; set; }
+
+		/// 
+		/// Specifies pagination for the buckets
+		/// 
+		[JsonProperty("page")]
+		IPage Page { get; set; }
+
+		/// 
+		/// Specifies the sort field for the requested buckets. By default, the buckets are sorted by the timestamp field.
+		/// 
+		[JsonProperty("sort")]
+		Field Sort { get; set; }
+
+		/// 
+		/// Returns buckets with timestamps after this time.
+		/// 
+		[JsonProperty("start")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? Start { get; set; }
+
+		/// 
+		/// Returns buckets with matching timestamps.
+		/// 
+		[JsonProperty("timestamp")]
+		// Forced to prevent override, ML API always expects ISO8601 format
+		[JsonConverter(typeof(IsoDateTimeConverter))]
+		DateTimeOffset? Timestamp { get; set; }
+	}
+
+	/// 
+	public partial class GetBucketsRequest
+	{
+		/// 
+		public double? AnomalyScore { get; set; }
+		/// 
+		public bool? Descending { get; set; }
+		/// 
+		public DateTimeOffset? End { get; set; }
+		/// 
+		public bool? ExcludeInterim { get; set; }
+		/// 
+		public bool? Expand { get; set; }
+		/// 
+		public IPage Page { get; set; }
+		/// 
+		public Field Sort { get; set; }
+		/// 
+		public DateTimeOffset? Start { get; set; }
+		/// 
+		public DateTimeOffset? Timestamp { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlGetBuckets")]
+	public partial class GetBucketsDescriptor
+	{
+		double? IGetBucketsRequest.AnomalyScore { get; set; }
+		bool? IGetBucketsRequest.Descending { get; set; }
+		DateTimeOffset? IGetBucketsRequest.End { get; set; }
+		bool? IGetBucketsRequest.ExcludeInterim { get; set; }
+		bool? IGetBucketsRequest.Expand { get; set; }
+		IPage IGetBucketsRequest.Page { get; set; }
+		Field IGetBucketsRequest.Sort { get; set; }
+		DateTimeOffset? IGetBucketsRequest.Start { get; set; }
+		DateTimeOffset? IGetBucketsRequest.Timestamp { get; set; }
+
+		/// 
+		public GetBucketsDescriptor AnomalyScore(double anomalyScore) => Assign(a => a.AnomalyScore = anomalyScore);
+
+		/// 
+		public GetBucketsDescriptor Descending(bool descending = true) => Assign(a => a.Descending = descending);
+
+		/// 
+		public GetBucketsDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+
+		/// 
+		public GetBucketsDescriptor ExcludeInterim(bool excludeInterim = true) => Assign(a => a.ExcludeInterim = excludeInterim);
+
+		/// 
+		public GetBucketsDescriptor Expand(bool expand = true) => Assign(a => a.Expand = expand);
+
+		/// 
+		public GetBucketsDescriptor Page(Func selector) => Assign(a => a.Page = selector?.Invoke(new PageDescriptor()));
+
+		/// 
+		public GetBucketsDescriptor Sort(Field field) => Assign(a => a.Sort = field);
+
+		/// 
+		public GetBucketsDescriptor Start(DateTimeOffset start) => Assign(a => a.Start = start);
+
+		/// 
+		public GetBucketsDescriptor Timestamp(DateTimeOffset timestamp) => Assign(a => a.Timestamp = timestamp);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsResponse.cs b/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsResponse.cs
new file mode 100644
index 00000000000..69b599dbfcf
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetBuckets/GetBucketsResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetBucketsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("buckets")]
+		IReadOnlyCollection Buckets { get; }
+	}
+
+	public class GetBucketsResponse : ResponseBase, IGetBucketsResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Buckets { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetCategories/ElasticClient-GetCategories.cs b/src/Nest/XPack/MachineLearning/GetCategories/ElasticClient-GetCategories.cs
new file mode 100644
index 00000000000..c75df0c66c1
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetCategories/ElasticClient-GetCategories.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves Machine Learning job results for one or more categories.
+		/// 
+		IGetCategoriesResponse GetCategories(Id jobId, Func selector = null);
+
+		/// 
+		IGetCategoriesResponse GetCategories(IGetCategoriesRequest request);
+
+		/// 
+		Task GetCategoriesAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetCategoriesAsync(IGetCategoriesRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetCategoriesResponse GetCategories(Id jobId, Func selector = null) =>
+			this.GetCategories(selector.InvokeOrDefault(new GetCategoriesDescriptor(jobId)));
+
+		/// 
+		public IGetCategoriesResponse GetCategories(IGetCategoriesRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlGetCategoriesDispatch
+			);
+
+		/// 
+		public Task GetCategoriesAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetCategoriesAsync(selector.InvokeOrDefault(new GetCategoriesDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task GetCategoriesAsync(IGetCategoriesRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlGetCategoriesDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs
new file mode 100644
index 00000000000..fc0c81694a5
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs
@@ -0,0 +1,34 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve job results for one or more categories.
+	/// 
+	public partial interface IGetCategoriesRequest
+	{
+		/// 
+		/// Specifies pagination for the categories
+		/// 
+		[JsonProperty("page")]
+		IPage Page { get; set; }
+	}
+
+	/// 
+	public partial class GetCategoriesRequest
+	{
+		/// 
+		public IPage Page { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlGetCategories")]
+	public partial class GetCategoriesDescriptor
+	{
+		IPage IGetCategoriesRequest.Page { get; set; }
+
+		/// 
+		public GetCategoriesDescriptor Page(Func selector) => Assign(a => a.Page = selector?.Invoke(new PageDescriptor()));
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesResponse.cs b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesResponse.cs
new file mode 100644
index 00000000000..652425421e9
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetCategoriesResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("categories")]
+		IReadOnlyCollection Categories { get; }
+	}
+
+	public class GetCategoriesResponse : ResponseBase, IGetCategoriesResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Categories { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeedStats/ElasticClient-GetDatafeedStats.cs b/src/Nest/XPack/MachineLearning/GetDatafeedStats/ElasticClient-GetDatafeedStats.cs
new file mode 100644
index 00000000000..4ca317d1d2b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeedStats/ElasticClient-GetDatafeedStats.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves configuration information for Machine Learning datafeeds.
+		/// 
+		IGetDatafeedStatsResponse GetDatafeedStats(Func selector = null);
+
+		/// 
+		IGetDatafeedStatsResponse GetDatafeedStats(IGetDatafeedStatsRequest request);
+
+		/// 
+		Task GetDatafeedStatsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetDatafeedStatsAsync(IGetDatafeedStatsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetDatafeedStatsResponse GetDatafeedStats(Func selector = null) =>
+			this.GetDatafeedStats(selector.InvokeOrDefault(new GetDatafeedStatsDescriptor()));
+
+		/// 
+		public IGetDatafeedStatsResponse GetDatafeedStats(IGetDatafeedStatsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlGetDatafeedStatsDispatch(p)
+			);
+
+		/// 
+		public Task GetDatafeedStatsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetDatafeedStatsAsync(selector.InvokeOrDefault(new GetDatafeedStatsDescriptor()), cancellationToken);
+
+		/// 
+		public Task GetDatafeedStatsAsync(IGetDatafeedStatsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlGetDatafeedStatsDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsRequest.cs b/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsRequest.cs
new file mode 100644
index 00000000000..8c0427eef5e
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsRequest.cs
@@ -0,0 +1,17 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve configuration information for Machine Learning datafeeds.
+	/// 
+	public partial interface IGetDatafeedStatsRequest {}
+
+	/// 
+	public partial class GetDatafeedStatsRequest {}
+
+	/// 
+	[DescriptorFor("XpackMlGetDatafeedStats")]
+	public partial class GetDatafeedStatsDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsResponse.cs b/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsResponse.cs
new file mode 100644
index 00000000000..fd091facc27
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeedStats/GetDatafeedStatsResponse.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetDatafeedStatsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("datafeeds")]
+		IReadOnlyCollection Datafeeds { get; }
+	}
+
+	public class GetDatafeedStatsResponse : ResponseBase, IGetDatafeedStatsResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Datafeeds { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeeds/ElasticClient-GetDatafeeds.cs b/src/Nest/XPack/MachineLearning/GetDatafeeds/ElasticClient-GetDatafeeds.cs
new file mode 100644
index 00000000000..89a49086c6a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeeds/ElasticClient-GetDatafeeds.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves configuration information for Machine Learning datafeeds.
+		/// 
+		IGetDatafeedsResponse GetDatafeeds(Func selector = null);
+
+		/// 
+		IGetDatafeedsResponse GetDatafeeds(IGetDatafeedsRequest request);
+
+		/// 
+		Task GetDatafeedsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetDatafeedsAsync(IGetDatafeedsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetDatafeedsResponse GetDatafeeds(Func selector = null) =>
+			this.GetDatafeeds(selector.InvokeOrDefault(new GetDatafeedsDescriptor()));
+
+		/// 
+		public IGetDatafeedsResponse GetDatafeeds(IGetDatafeedsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlGetDatafeedsDispatch(p)
+			);
+
+		/// 
+		public Task GetDatafeedsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetDatafeedsAsync(selector.InvokeOrDefault(new GetDatafeedsDescriptor()), cancellationToken);
+
+		/// 
+		public Task GetDatafeedsAsync(IGetDatafeedsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlGetDatafeedsDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsRequest.cs b/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsRequest.cs
new file mode 100644
index 00000000000..730dd0aa239
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsRequest.cs
@@ -0,0 +1,17 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve configuration information for Machine Learning datafeeds.
+	/// 
+	public partial interface IGetDatafeedsRequest {}
+
+	/// 
+	public partial class GetDatafeedsRequest {}
+
+	/// 
+	[DescriptorFor("XpackMlGetDatafeeds")]
+	public partial class GetDatafeedsDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsResponse.cs b/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsResponse.cs
new file mode 100644
index 00000000000..cdc930dfe4f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetDatafeeds/GetDatafeedsResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetDatafeedsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("datafeeds")]
+		IReadOnlyCollection Datafeeds { get; }
+	}
+
+	public class GetDatafeedsResponse : ResponseBase, IGetDatafeedsResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Datafeeds { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetInfluencers/ElasticClient-GetInfluencers.cs b/src/Nest/XPack/MachineLearning/GetInfluencers/ElasticClient-GetInfluencers.cs
new file mode 100644
index 00000000000..4a01e563b50
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetInfluencers/ElasticClient-GetInfluencers.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves results for Machine Learning job influencers.
+		/// 
+		IGetInfluencersResponse GetInfluencers(Id jobId, Func selector = null);
+
+		/// 
+		IGetInfluencersResponse GetInfluencers(IGetInfluencersRequest request);
+
+		/// 
+		Task GetInfluencersAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetInfluencersAsync(IGetInfluencersRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetInfluencersResponse GetInfluencers(Id jobId, Func selector = null) =>
+			this.GetInfluencers(selector.InvokeOrDefault(new GetInfluencersDescriptor(jobId)));
+
+		/// 
+		public IGetInfluencersResponse GetInfluencers(IGetInfluencersRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlGetInfluencersDispatch
+			);
+
+		/// 
+		public Task GetInfluencersAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetInfluencersAsync(selector.InvokeOrDefault(new GetInfluencersDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task GetInfluencersAsync(IGetInfluencersRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlGetInfluencersDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersRequest.cs b/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersRequest.cs
new file mode 100644
index 00000000000..78bfd9c9c6f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersRequest.cs
@@ -0,0 +1,115 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve results for Machine Learning job influencers.
+	/// 
+	public partial interface IGetInfluencersRequest
+	{
+		/// 
+		/// If true, the results are sorted in descending order.
+		/// 
+		bool? Descending { get; set; }
+
+		/// 
+		/// Returns influencers with timestamps earlier than this time.
+		/// 
+		[JsonProperty("end")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? End { get; set; }
+
+		/// 
+		/// If true, the output excludes interim results. By default, interim results are included.
+		/// 
+		[JsonProperty("exclude_interim")]
+		bool? ExcludeInterim { get; set; }
+
+		/// 
+		/// Returns influencers with anomaly scores higher than this value.
+		/// 
+		[JsonProperty("influencer_score")]
+		double? InfluencerScore { get; set; }
+
+		/// 
+		/// Specifies pagination for the influencers
+		/// 
+		[JsonProperty("page")]
+		IPage Page { get; set; }
+
+		/// 
+		/// Specifies the sort field for the requested influencers. By default, the influencers are sorted by the  value.
+		/// 
+		[JsonProperty("sort")]
+		Field Sort { get; set; }
+
+		/// 
+		/// Returns influencers with timestamps after this time.
+		/// 
+		[JsonProperty("start")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	public partial class GetInfluencersRequest
+	{
+		/// 
+		public bool? Descending { get; set; }
+
+		/// 
+		public DateTimeOffset? End { get; set; }
+
+		/// 
+		public bool? ExcludeInterim { get; set; }
+
+		/// 
+		public double? InfluencerScore { get; set; }
+
+		/// 
+		public IPage Page { get; set; }
+
+		/// 
+		public Field Sort { get; set; }
+
+		/// 
+		public DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlGetInfluencers")]
+	public partial class GetInfluencersDescriptor
+	{
+		public GetInfluencersDescriptor() {}
+
+		bool? IGetInfluencersRequest.Descending { get; set; }
+		DateTimeOffset? IGetInfluencersRequest.End { get; set; }
+		bool? IGetInfluencersRequest.ExcludeInterim { get; set; }
+		double? IGetInfluencersRequest.InfluencerScore { get; set; }
+		IPage IGetInfluencersRequest.Page { get; set; }
+		Field IGetInfluencersRequest.Sort { get; set; }
+		DateTimeOffset? IGetInfluencersRequest.Start { get; set; }
+
+		/// 
+		public GetInfluencersDescriptor InfluencerScore(double influencerScore) => Assign(a => a.InfluencerScore = influencerScore);
+
+		/// 
+		public GetInfluencersDescriptor Desc(bool descending = true) => Assign(a => a.Descending = descending);
+
+		/// 
+		public GetInfluencersDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+
+		/// 
+		public GetInfluencersDescriptor ExcludeInterim(bool excludeInterim = true) => Assign(a => a.ExcludeInterim = excludeInterim);
+
+		/// 
+		public GetInfluencersDescriptor Page(Func selector) => Assign(a => a.Page = selector?.Invoke(new PageDescriptor()));
+
+		/// 
+		public GetInfluencersDescriptor Sort(Field field) => Assign(a => a.Sort = field);
+
+		/// 
+		public GetInfluencersDescriptor Start(DateTimeOffset end) => Assign(a => a.Start = end);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersResponse.cs b/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersResponse.cs
new file mode 100644
index 00000000000..02bd70ef9b7
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetInfluencers/GetInfluencersResponse.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	public interface IGetInfluencersResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("influencers")]
+		IReadOnlyCollection Influencers { get; }
+	}
+
+	public class GetInfluencersResponse : ResponseBase, IGetInfluencersResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Influencers { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobStats/ElasticClient-GetJobStats.cs b/src/Nest/XPack/MachineLearning/GetJobStats/ElasticClient-GetJobStats.cs
new file mode 100644
index 00000000000..97a6c6d0ace
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobStats/ElasticClient-GetJobStats.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves results for Machine Learning job influencers.
+		/// 
+		IGetJobStatsResponse GetJobStats(Func selector = null);
+
+		/// 
+		IGetJobStatsResponse GetJobStats(IGetJobStatsRequest request);
+
+		/// 
+		Task GetJobStatsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetJobStatsAsync(IGetJobStatsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetJobStatsResponse GetJobStats(Func selector = null) =>
+			this.GetJobStats(selector.InvokeOrDefault(new GetJobStatsDescriptor()));
+
+		/// 
+		public IGetJobStatsResponse GetJobStats(IGetJobStatsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlGetJobStatsDispatch(p)
+			);
+
+		/// 
+		public Task GetJobStatsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetJobStatsAsync(selector.InvokeOrDefault(new GetJobStatsDescriptor()), cancellationToken);
+
+		/// 
+		public Task GetJobStatsAsync(IGetJobStatsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlGetJobStatsDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsRequest.cs b/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsRequest.cs
new file mode 100644
index 00000000000..70b796e9aec
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsRequest.cs
@@ -0,0 +1,17 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve usage information for Machine Learning jobs.
+	/// 
+	public partial interface IGetJobStatsRequest {}
+
+	/// 
+	public partial class GetJobStatsRequest {}
+
+	/// 
+	[DescriptorFor("XpackMlGetJobStats")]
+	public partial class GetJobStatsDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsResponse.cs b/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsResponse.cs
new file mode 100644
index 00000000000..56b16aa1e09
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobStats/GetJobStatsResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetJobStatsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("jobs")]
+		IReadOnlyCollection Jobs { get; }
+	}
+
+	public class GetJobStatsResponse : ResponseBase, IGetJobStatsResponse
+	{
+		public long Count { get; internal set; }
+
+		public IReadOnlyCollection Jobs { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs b/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs
new file mode 100644
index 00000000000..421b594e451
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves configuration for Machine Learning jobs.
+		/// 
+		IGetJobsResponse GetJobs(Func selector = null);
+
+		/// 
+		IGetJobsResponse GetJobs(IGetJobsRequest request);
+
+		/// 
+		Task GetJobsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetJobsAsync(IGetJobsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetJobsResponse GetJobs(Func selector = null) =>
+			this.GetJobs(selector.InvokeOrDefault(new GetJobsDescriptor()));
+
+		/// 
+		public IGetJobsResponse GetJobs(IGetJobsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlGetJobsDispatch(p)
+			);
+
+		/// 
+		public Task GetJobsAsync(Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetJobsAsync(selector.InvokeOrDefault(new GetJobsDescriptor()), cancellationToken);
+
+		/// 
+		public Task GetJobsAsync(IGetJobsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlGetJobsDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobs/GetJobsRequest.cs b/src/Nest/XPack/MachineLearning/GetJobs/GetJobsRequest.cs
new file mode 100644
index 00000000000..2a1b63916be
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobs/GetJobsRequest.cs
@@ -0,0 +1,17 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve usage information for Machine Learning jobs.
+	/// 
+	public partial interface IGetJobsRequest {}
+
+	/// 
+	public partial class GetJobsRequest {}
+
+	/// 
+	[DescriptorFor("XpackMlGetJobs")]
+	public partial class GetJobsDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetJobs/GetJobsResponse.cs b/src/Nest/XPack/MachineLearning/GetJobs/GetJobsResponse.cs
new file mode 100644
index 00000000000..86ceb8e52bc
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetJobs/GetJobsResponse.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A response of the configuration for Machine Learning jobs.
+	/// 
+	public interface IGetJobsResponse : IResponse
+	{
+		/// 
+		/// The count of jobs
+		/// 
+		[JsonProperty("count")]
+		long Count { get; }
+
+		/// 
+		/// The configuration of Machine Learning jobs
+		/// 
+		[JsonProperty("jobs")]
+		IReadOnlyCollection Jobs { get; }
+	}
+
+	/// 
+	public class GetJobsResponse : ResponseBase, IGetJobsResponse
+	{
+		/// 
+		public long Count { get; internal set; }
+
+		/// 
+		public IReadOnlyCollection Jobs { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetModelSnapshots/ElasticClient-GetModelSnapshots.cs b/src/Nest/XPack/MachineLearning/GetModelSnapshots/ElasticClient-GetModelSnapshots.cs
new file mode 100644
index 00000000000..007c45e7130
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetModelSnapshots/ElasticClient-GetModelSnapshots.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Retrieves information about Machine Learning model snapshots.
+		/// 
+		IGetModelSnapshotsResponse GetModelSnapshots(Id jobId, Func selector = null);
+
+		/// 
+		IGetModelSnapshotsResponse GetModelSnapshots(IGetModelSnapshotsRequest request);
+
+		/// 
+		Task GetModelSnapshotsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task GetModelSnapshotsAsync(IGetModelSnapshotsRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IGetModelSnapshotsResponse GetModelSnapshots(Id jobId, Func selector = null) =>
+			this.GetModelSnapshots(selector.InvokeOrDefault(new GetModelSnapshotsDescriptor(jobId)));
+
+		/// 
+		public IGetModelSnapshotsResponse GetModelSnapshots(IGetModelSnapshotsRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlGetModelSnapshotsDispatch
+			);
+
+		/// 
+		public Task GetModelSnapshotsAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.GetModelSnapshotsAsync(selector.InvokeOrDefault(new GetModelSnapshotsDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task GetModelSnapshotsAsync(IGetModelSnapshotsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlGetModelSnapshotsDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsRequest.cs b/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsRequest.cs
new file mode 100644
index 00000000000..905a73fda99
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsRequest.cs
@@ -0,0 +1,89 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to retrieve usage information for Machine Learning jobs.
+	/// 
+	public partial interface IGetModelSnapshotsRequest
+	{
+		/// 
+		/// If true, the results are sorted in descending order.
+		/// 
+		[JsonProperty("desc")]
+		bool? Descending { get; set; }
+
+		/// 
+		/// Returns snapshots with timestamps earlier than this time.
+		/// 
+		[JsonProperty("end")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? End { get; set; }
+
+		/// 
+		/// Specifies pagination for the snapshots
+		/// 
+		[JsonProperty("page")]
+		IPage Page { get; set; }
+
+		/// 
+		/// Specifies the sort field for the requested snapshots. By default, snapshots are sorted by their timestamp.
+		/// 
+		[JsonProperty("sort")]
+		Field Sort { get; set; }
+
+		/// 
+		/// Returns snapshots with timestamps after this time.
+		/// 
+		[JsonProperty("start")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	public partial class GetModelSnapshotsRequest
+	{
+		/// 
+		public bool? Descending { get; set; }
+
+		/// 
+		public DateTimeOffset? End { get; set; }
+
+		/// 
+		public IPage Page { get; set; }
+
+		/// 
+		public Field Sort { get; set; }
+
+		/// 
+		public DateTimeOffset? Start { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlGetModelSnapshots")]
+	public partial class GetModelSnapshotsDescriptor
+	{
+		bool? IGetModelSnapshotsRequest.Descending { get; set; }
+		DateTimeOffset? IGetModelSnapshotsRequest.End { get; set; }
+		IPage IGetModelSnapshotsRequest.Page { get; set; }
+		Field IGetModelSnapshotsRequest.Sort { get; set; }
+		DateTimeOffset? IGetModelSnapshotsRequest.Start { get; set; }
+
+		/// 
+		public GetModelSnapshotsDescriptor Descending(bool desc = true) => Assign(a => a.Descending = desc);
+
+		/// 
+		public GetModelSnapshotsDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+
+		/// 
+		public GetModelSnapshotsDescriptor Page(Func selector) =>
+			Assign(a => a.Page = selector?.Invoke(new PageDescriptor()));
+
+		/// 
+		public GetModelSnapshotsDescriptor Sort(Field field) => Assign(a => a.Sort = field);
+
+		/// 
+		public GetModelSnapshotsDescriptor Start(DateTimeOffset start) => Assign(a => a.Start = start);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsResponse.cs b/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsResponse.cs
new file mode 100644
index 00000000000..7ac1db193ca
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/GetModelSnapshots/GetModelSnapshotsResponse.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IGetModelSnapshotsResponse : IResponse
+	{
+		[JsonProperty("count")]
+		long Count { get; }
+
+		[JsonProperty("model_snapshots")]
+		IReadOnlyCollection ModelSnapshots { get; }
+	}
+
+	public class GetModelSnapshotsResponse : ResponseBase, IGetModelSnapshotsResponse
+	{
+		public long Count { get; internal set;  }
+
+		public IReadOnlyCollection ModelSnapshots { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/AnalysisConfig.cs b/src/Nest/XPack/MachineLearning/Job/Config/AnalysisConfig.cs
new file mode 100644
index 00000000000..cad48e8108d
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/AnalysisConfig.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// An analysis configuration for a Machine Learning job.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IAnalysisConfig
+	{
+		/// 
+		/// The size of the interval that the analysis is aggregated into, typically between 5m and 1h.
+		/// The default value is 5m.
+		/// 
+		[JsonProperty("bucket_span")]
+		Time BucketSpan { get; set; }
+
+		/// 
+		/// If this property is specified, the values of the specified field will be categorized.
+		/// The resulting categories must be used in a detector by setting by_field_name, over_field_name,
+		/// or partition_field_name to the keyword mlcategory
+		/// 
+		[JsonProperty("categorization_field_name")]
+		Field CategorizationFieldName { get; set; }
+
+		/// 
+		/// If categorization_field_name is specified, you can also define optional filters.
+		/// This property expects an array of regular expressions.
+		/// The expressions are used to filter out matching sequences off the categorization field values.
+		/// 
+		[JsonProperty("categorization_filters")]
+		IEnumerable CategorizationFilters { get; set; }
+
+		/// 
+		/// A collection of detectors, which describe the anomaly detectors that are used in the job.
+		/// 
+		[JsonProperty("detectors")]
+		IEnumerable Detectors { get; set; }
+
+		/// 
+		/// A collection of influencer field names. Typically these can be the by, over, or partition fields
+		/// that are used in the detector configuration. You might also want to use a field name that is not
+		/// specifically named in a detector, but is available as part of the input data.
+		/// When you use multiple detectors, the use of influencers is recommended as it aggregates results for each influencer entity.
+		/// 
+		[JsonProperty("influencers")]
+		Fields Influencers { get; set; }
+
+		/// 
+		/// The size of the window in which to expect data that is out of time order. The default value is 0 (no latency).
+		/// 
+		[JsonProperty("latency")]
+		Time Latency { get; set; }
+
+		/// 
+		/// If set to true, the analysis will automatically find correlations between metrics
+		/// for a given by field value and report anomalies when those correlations cease to hold.
+		/// 
+		[JsonProperty("multivariate_by_fields")]
+		bool? MultivariateByFields { get; set; }
+
+		/// 
+		/// The name of the field that contains the count of raw data points that have been summarized, if
+		/// data that is fed to the job is expected to be pre-summarized.
+		/// 
+		[JsonProperty("summary_count_field_name")]
+		Field SummaryCountFieldName { get; set; }
+	}
+
+	/// 
+	public class AnalysisConfig : IAnalysisConfig
+	{
+		/// 
+		public Time BucketSpan { get; set; }
+		/// 
+		public Field CategorizationFieldName { get; set; }
+		/// 
+		public IEnumerable CategorizationFilters { get; set; }
+		/// 
+		public IEnumerable Detectors { get; set; }
+		/// 
+		public Fields Influencers { get; set; }
+		/// 
+		public Time Latency { get; set; }
+		/// 
+		public bool? MultivariateByFields { get; set; }
+		/// 
+		public Field SummaryCountFieldName { get; set; }
+	}
+
+	/// 
+	public class AnalysisConfigDescriptor : DescriptorBase, IAnalysisConfig>, IAnalysisConfig where T : class
+	{
+		Time IAnalysisConfig.BucketSpan { get; set; }
+		Field IAnalysisConfig.CategorizationFieldName { get; set; }
+		IEnumerable IAnalysisConfig.CategorizationFilters { get; set; }
+		IEnumerable IAnalysisConfig.Detectors { get; set; }
+		Fields IAnalysisConfig.Influencers { get; set; }
+		Time IAnalysisConfig.Latency { get; set; }
+		bool? IAnalysisConfig.MultivariateByFields { get; set; }
+		Field IAnalysisConfig.SummaryCountFieldName { get; set; }
+
+		/// 
+		public AnalysisConfigDescriptor BucketSpan(Time bucketSpan) => Assign(a => a.BucketSpan = bucketSpan);
+
+		/// 
+		public AnalysisConfigDescriptor CategorizationFieldName(Field field) => Assign(a => a.CategorizationFieldName = field);
+
+		/// 
+		public AnalysisConfigDescriptor CategorizationFieldName(Expression> objectPath) =>
+			Assign(a => a.CategorizationFieldName = objectPath);
+
+		/// 
+		public AnalysisConfigDescriptor CategorizationFilters(IEnumerable filters) => Assign(a => a.CategorizationFilters = filters);
+
+		/// 
+		public AnalysisConfigDescriptor CategorizationFilters(params string[] filters) => Assign(a => a.CategorizationFilters = filters);
+
+		/// 
+		public AnalysisConfigDescriptor Detectors(Func, IPromise>> selector) =>
+			Assign(a => a.Detectors = selector.InvokeOrDefault(new DetectorsDescriptor()).Value);
+
+		/// 
+		public AnalysisConfigDescriptor Influencers(Func, IPromise> fields) =>
+			Assign(a => a.Influencers = fields?.Invoke(new FieldsDescriptor())?.Value);
+
+		/// 
+		public AnalysisConfigDescriptor Influencers(Fields fields) => Assign(a => a.Influencers = fields);
+
+		/// 
+		public AnalysisConfigDescriptor Latency(Time latency) => Assign(a => a.Latency = latency);
+
+		/// 
+		public AnalysisConfigDescriptor MultivariateByFields(bool multivariateByFields = true) => Assign(a => a.MultivariateByFields = multivariateByFields);
+
+		/// 
+		public AnalysisConfigDescriptor SummaryCountFieldName(Field summaryCountFieldName) => Assign(a => a.SummaryCountFieldName = summaryCountFieldName);
+
+		/// 
+		public AnalysisConfigDescriptor SummaryCountFieldName(Expression> objectPath) => Assign(a => a.SummaryCountFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/AnalysisLimits.cs b/src/Nest/XPack/MachineLearning/Job/Config/AnalysisLimits.cs
new file mode 100644
index 00000000000..a1900eacc2f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/AnalysisLimits.cs
@@ -0,0 +1,87 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Limits applied for the resources required to hold the mathematical models in memory.
+	/// These limits are approximate and can be set per job. They do not control the memory used by other processes,
+	/// for example the Elasticsearch Java processes.
+	/// If necessary, you can increase the limits after the job is created.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IAnalysisLimits
+	{
+		/// 
+		/// The maximum number of examples stored per category in memory and in the results data store.
+		/// The default value is 4. If you increase this value, more examples are available,
+		/// however it requires that you have more storage available.
+		/// If you set this value to 0, no examples are stored.
+		/// 
+		[JsonProperty("categorization_examples_limit")]
+		long? CategorizationExamplesLimit { get; set; }
+
+		/// 
+		///  The approximate maximum amount of memory resources that are required for analytical processing,
+		/// in MiB. Once this limit is approached, data pruning becomes more aggressive.
+		/// Upon exceeding this limit, new entities are not modeled. The default value is 4096.
+		/// 
+		[JsonProperty("model_memory_limit")]
+		long? ModelMemoryLimit { get; set; }
+	}
+
+	/// 
+	public class AnalysisLimits : IAnalysisLimits
+	{
+		/// 
+		public long? CategorizationExamplesLimit { get; set; }
+		/// 
+		public long? ModelMemoryLimit { get; set; }
+	}
+
+	/// 
+	public class AnalysisLimitsDescriptor : DescriptorBase, IAnalysisLimits
+	{
+		long? IAnalysisLimits.CategorizationExamplesLimit { get; set; }
+		long? IAnalysisLimits.ModelMemoryLimit { get; set; }
+
+		/// 
+		public AnalysisLimitsDescriptor CategorizationExamplesLimit(long categorizationExamplesLimit) =>
+			Assign(a => a.CategorizationExamplesLimit = categorizationExamplesLimit);
+
+		/// 
+		public AnalysisLimitsDescriptor ModelMemoryLimit(long modelMemoryLimit) =>
+			Assign(a => a.ModelMemoryLimit = modelMemoryLimit);
+	}
+
+	/// 
+	/// Limits applied for the resources required to hold the mathematical models in memory.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IAnalysisMemoryLimit
+	{
+		/// 
+		///  The approximate maximum amount of memory resources that are required for analytical processing,
+		/// in MiB. Once this limit is approached, data pruning becomes more aggressive.
+		/// Upon exceeding this limit, new entities are not modeled. The default value is 4096.
+		/// 
+		[JsonProperty("model_memory_limit")]
+		long? ModelMemoryLimit { get; set; }
+	}
+
+	/// 
+	public class AnalysisMemoryLimit : IAnalysisMemoryLimit
+	{
+		/// 
+		public long? ModelMemoryLimit { get; set; }
+	}
+
+	/// 
+	public class AnalysisMemoryLimitDescriptor : DescriptorBase, IAnalysisMemoryLimit
+	{
+		long? IAnalysisMemoryLimit.ModelMemoryLimit { get; set; }
+
+		/// 
+		public AnalysisMemoryLimitDescriptor ModelMemoryLimit(long modelMemoryLimit) =>
+			Assign(a => a.ModelMemoryLimit = modelMemoryLimit);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/DataDescription.cs b/src/Nest/XPack/MachineLearning/Job/Config/DataDescription.cs
new file mode 100644
index 00000000000..aa389ac529c
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/DataDescription.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Linq.Expressions;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Defines the format of the input data when you send data to the Machine Learning job.
+	/// Note that when configure a datafeed, these properties are automatically set.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IDataDescription
+	{
+		/// 
+		/// Only JSON format is supported at this time.
+		/// 
+		[JsonProperty("format")]
+		string Format { get; set; }
+
+		/// 
+		/// The name of the field that contains the timestamp. The default value is time.
+		/// 
+		[JsonProperty("time_field")]
+		Field TimeField { get; set; }
+
+		/// 
+		/// The time format, which can be epoch, epoch_ms, or a custom pattern.
+		/// 
+		[JsonProperty("time_format")]
+		string TimeFormat { get; set; }
+	}
+
+	/// 
+	public class DataDescription : IDataDescription
+	{
+		/// 
+		public string Format { get; set; }
+		/// 
+		public Field TimeField { get; set; }
+		/// 
+		public string TimeFormat { get; set; }
+	}
+
+	/// 
+	public class DataDescriptionDescriptor : DescriptorBase, IDataDescription>, IDataDescription
+	{
+		string IDataDescription.Format { get; set; }
+		Field IDataDescription.TimeField { get; set; }
+		string IDataDescription.TimeFormat { get; set; }
+
+		/// 
+		public DataDescriptionDescriptor Format(string format) => Assign(a => a.Format = format);
+
+		/// 
+		public DataDescriptionDescriptor TimeField(Field timeField) => Assign(a => a.TimeField = timeField);
+
+		/// 
+		public DataDescriptionDescriptor TimeField(Expression> objectPath) => Assign(a => a.TimeField = objectPath);
+
+		/// 
+		public DataDescriptionDescriptor TimeFormat(string timeTormat) => Assign(a => a.TimeFormat = timeTormat);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/Job.cs b/src/Nest/XPack/MachineLearning/Job/Config/Job.cs
new file mode 100644
index 00000000000..a21eb5fae75
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/Job.cs
@@ -0,0 +1,116 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class Job
+	{
+		/// 
+		/// The unique identifier for the job
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; set; }
+
+		/// 
+		/// The job type
+		/// 
+		/// 
+		/// Reserved for future use
+		/// 
+		[JsonProperty("job_type")]
+		public string JobType { get; set; }
+
+		/// 
+		/// An optional description of the job
+		/// 
+		[JsonProperty("description")]
+		public string Description { get; set; }
+
+		/// 
+		/// The time the job was created.
+		/// 
+		[JsonProperty("create_time")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset CreateTime { get; set; }
+
+		/// 
+		/// If the job closed or failed, this is the time the job finished, otherwise it is null.
+		/// 
+		[JsonProperty("finished_time")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset? FinishedTime { get; set; }
+
+		/// 
+		/// The analysis configuration, which specifies how to analyze the data.
+		/// 
+		[JsonProperty("analysis_config")]
+		public IAnalysisConfig AnalysisConfig { get; set; }
+
+		/// 
+		/// Optionally specifies runtime limits for the job.
+		/// 
+		[JsonProperty("analysis_limits")]
+		public IAnalysisLimits AnalysisLimits { get; set; }
+
+		/// 
+		/// Advanced configuration option. The time between each periodic persistence of the model.
+		/// The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting
+		/// at exactly the same time. The smallest allowed value is 1 hour.
+		/// 
+		/// 
+		/// For very large models (several GB), persistence could take 10-20 minutes,
+		/// so do not set the background_persist_interval value too low.
+		/// 
+		[JsonProperty("background_persist_interval")]
+		public Time BackgroundPersistInterval { get; set; }
+
+		/// 
+		/// Describes the format of the input data. This object is required, but it can be empty
+		/// 
+		[JsonProperty("data_description")]
+		public IDataDescription DataDescription { get; set; }
+
+		/// 
+		/// The time in days that model snapshots are retained for the job.
+		/// Older snapshots are deleted. The default value is 1 day.
+		/// 
+		[JsonProperty("model_snapshot_retention_days")]
+		public long? ModelSnapshotRetentionDays { get; set; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the model snapshot.
+		/// 
+		[JsonProperty("model_snapshot_id")]
+		public string ModelSnapshotId { get; set; }
+
+		/// 
+		/// The name of the index in which to store the machine learning results.
+		/// The default value is shared, which corresponds to the index name .ml-anomalies-shared.
+		/// 
+		[JsonProperty("results_index_name")]
+		public string ResultsIndexName { get; set; }
+
+		/// 
+		/// This advanced configuration option stores model information along with the results.
+		/// This adds overhead to the performance of the system and is not feasible for jobs with many entities
+		/// 
+		[JsonProperty("model_plot")]
+		public IModelPlotConfig ModelPlotConfig { get; set; }
+
+		/// 
+		/// Advanced configuration option. The period over which adjustments to the score are applied, as new data
+		/// is seen. The default value is the longer of 30 days or 100 bucket_spans.
+		/// 
+		[JsonProperty("renormalization_window_days")]
+		public long? RenormalizationWindowDays { get; set; }
+
+		/// 
+		/// Advanced configuration option. The number of days for which job results are retained.
+		/// Once per day at 00:30 (server time), results older than this period are deleted from Elasticsearch.
+		/// The default value is null, which means results are retained.
+		/// 
+		[JsonProperty("results_retention_days")]
+		public long? ResultsRetentionDays { get; set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/JobState.cs b/src/Nest/XPack/MachineLearning/Job/Config/JobState.cs
new file mode 100644
index 00000000000..ab91be0d569
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/JobState.cs
@@ -0,0 +1,42 @@
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	/// 
+	/// The state of a Machine Learning job
+	/// 
+	[JsonConverter(typeof(StringEnumConverter))]
+	public enum JobState
+	{
+		/// 
+		/// The job close action is in progress and has not yet completed. A closing job cannot accept further data.
+		/// 
+		[EnumMember(Value = "closing")]
+		Closing,
+		/// 
+		/// The job finished successfully with its model state persisted.
+		/// The job must be opened before it can accept further data.
+		/// 
+		[EnumMember(Value = "closed")]
+		Closed,
+		/// 
+		/// The job is available to receive and process data.
+		/// 
+		[EnumMember(Value = "opened")]
+		Opened,
+		/// 
+		/// The job did not finish successfully due to an error. This situation can occur due to invalid input data.
+		/// If the job had irrevocably failed, it must be force closed and then deleted.
+		/// If the datafeed can be corrected, the job can be closed and then re-opened.
+		/// 
+		[EnumMember(Value = "failed")]
+		Failed,
+		/// 
+		/// The job open action is in progress and has not yet completed.
+		/// 
+		[EnumMember(Value = "opening")]
+		Opening
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs b/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs
new file mode 100644
index 00000000000..dd9d99a3dc6
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs
@@ -0,0 +1,53 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Provides statistics about the operation progress of a Machine Learning job.
+	/// 
+	[JsonObject]
+	public class JobStats
+	{
+		/// 
+		/// For open jobs only, contains messages relating to the selection of a node to run the job.
+		/// 
+		[JsonProperty("assignment_explanation")]
+		public string AssignmentExplanation { get; internal set; }
+
+		/// 
+		/// A unique identifier for the job.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// Describes the number of records processed and any related error counts.
+		/// 
+		[JsonProperty("data_counts")]
+		public DataCounts DataCounts { get; internal set; }
+
+		/// 
+		/// Provides information about the size and contents of the model.
+		/// 
+		[JsonProperty("model_size_stats")]
+		public ModelSizeStats ModelSizeStats { get; internal set; }
+
+		/// 
+		/// The status of the job
+		/// 
+		[JsonProperty("state")]
+		public JobState State { get; internal set; }
+
+		/// 
+		/// For open jobs only, contains information about the node where the job runs.
+		/// 
+		[JsonProperty("node")]
+		public DiscoveryNode Node { get; internal set; }
+
+		/// 
+		/// For open jobs only, the elapsed time for which the job has been open.
+		/// 
+		[JsonProperty("open_time")]
+		public Time OpenTime { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/MemoryStatus.cs b/src/Nest/XPack/MachineLearning/Job/Config/MemoryStatus.cs
new file mode 100644
index 00000000000..1aee8171f3a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/MemoryStatus.cs
@@ -0,0 +1,33 @@
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	/// 
+	/// The status of the mathematical models.
+	/// 
+	[JsonConverter(typeof(StringEnumConverter))]
+	public enum MemoryStatus
+	{
+		/// 
+		/// The models stayed below the configured value.
+		/// 
+		[EnumMember(Value = "ok")]
+		Ok,
+
+		/// 
+		/// The models used more than 60% of the configured memory limit and older
+		/// unused models will be pruned to free up space.
+		/// 
+		[EnumMember(Value = "soft_limit")]
+		SoftLimit,
+
+		/// 
+		/// The models used more space than the configured memory limit.
+		/// As a result, not all incoming data was processed.
+		/// 
+		[EnumMember(Value = "hard_limit")]
+		HardLimit
+	}
+}
\ No newline at end of file
diff --git a/src/Nest/XPack/MachineLearning/Job/Config/ModelPlotConfig.cs b/src/Nest/XPack/MachineLearning/Job/Config/ModelPlotConfig.cs
new file mode 100644
index 00000000000..e344b046e6a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Config/ModelPlotConfig.cs
@@ -0,0 +1,80 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Stores model information along with the results.
+	/// It provides a more detailed view into anomaly detection.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IModelPlotConfig : IModelPlotConfigEnabled
+	{
+		/// 
+		/// Limits data collection to this list of partition or by field values.
+		/// If terms are not specified, no filtering is applied.
+		/// 
+		/// 
+		/// This is experimental. Only the specified terms can be viewed when using the Single Metric Viewer.
+		/// 
+		[JsonProperty("terms")]
+		Fields Terms { get; set; }
+	}
+
+	/// 
+	public class ModelPlotConfig : IModelPlotConfig
+	{
+		/// 
+		public bool? Enabled { get; set; }
+		/// 
+		public Fields Terms { get; set; }
+	}
+
+	/// 
+	public class ModelPlotConfigDescriptor : DescriptorBase, IModelPlotConfig>, IModelPlotConfig where T : class
+	{
+		bool? IModelPlotConfigEnabled.Enabled { get; set; }
+		Fields IModelPlotConfig.Terms { get; set; }
+
+		/// 
+		public ModelPlotConfigDescriptor Enabled(bool enabled = true) => Assign(a => a.Enabled = enabled);
+
+		/// 
+		public ModelPlotConfigDescriptor Terms(Func, IPromise> fields) =>
+			Assign(a => a.Terms = fields?.Invoke(new FieldsDescriptor())?.Value);
+
+		/// 
+		public ModelPlotConfigDescriptor Terms(Fields fields) => Assign(a => a.Terms = fields);
+	}
+
+	/// 
+	/// Stores model information along with the results.
+	/// It provides a more detailed view into anomaly detection.
+	/// 
+	[JsonConverter(typeof(ReadAsTypeJsonConverter))]
+	public interface IModelPlotConfigEnabled
+	{
+		/// 
+		/// Enables calculation and storage of the model bounds for each entity that is being analyzed.
+		/// By default, this is not enabled.
+		/// 
+		[JsonProperty("enabled")]
+		bool? Enabled { get; set; }
+	}
+
+	/// 
+	public class ModelPlotConfigEnabled : IModelPlotConfigEnabled
+	{
+		/// 
+		public bool? Enabled { get; set; }
+	}
+
+	/// 
+	public class ModelPlotConfigEnabledDescriptor : DescriptorBase, IModelPlotConfigEnabled>, IModelPlotConfigEnabled where T : class
+	{
+		bool? IModelPlotConfigEnabled.Enabled { get; set; }
+
+		/// 
+		public ModelPlotConfigEnabledDescriptor Enabled(bool enabled = true) => Assign(a => a.Enabled = enabled);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/CountDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/CountDetector.cs
new file mode 100644
index 00000000000..0f0e1943a63
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/CountDetector.cs
@@ -0,0 +1,241 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public enum CountFunction
+	{
+		Count,
+		HighCount,
+		LowCount
+	}
+
+	public enum NonZeroCountFunction
+	{
+		NonZeroCount,
+		LowNonZeroCount,
+		HighNonZeroCount
+	}
+
+	public enum DistinctCountFunction
+	{
+		DistinctCount,
+		LowDistinctCount,
+		HighDistinctCount
+	}
+
+	public static class CountFunctionExtensions
+	{
+		public static string GetStringValue(this CountFunction countFunction)
+		{
+			switch (countFunction)
+			{
+				case CountFunction.Count:
+					return "count";
+				case CountFunction.HighCount:
+					return "high_count";
+				case CountFunction.LowCount:
+					return "low_count";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(countFunction), countFunction, null);
+			}
+		}
+
+		public static string GetStringValue(this NonZeroCountFunction nonZeroCountFunction)
+		{
+			switch (nonZeroCountFunction)
+			{
+				case NonZeroCountFunction.NonZeroCount:
+					return "non_zero_count";
+				case NonZeroCountFunction.LowNonZeroCount:
+					return "low_non_zero_count";
+				case NonZeroCountFunction.HighNonZeroCount:
+					return "high_non_zero_count";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(nonZeroCountFunction), nonZeroCountFunction, null);
+			}
+		}
+
+		public static string GetStringValue(this DistinctCountFunction distinctCountFunction)
+		{
+			switch (distinctCountFunction)
+			{
+				case DistinctCountFunction.DistinctCount:
+					return "distinct_count";
+				case DistinctCountFunction.LowDistinctCount:
+					return "low_distinct_count";
+				case DistinctCountFunction.HighDistinctCount:
+					return "high_distinct_count";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(distinctCountFunction), distinctCountFunction, null);
+			}
+		}
+	}
+
+	public interface ICountDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector
+	{
+	}
+
+	public interface INonZeroCountDetector : IDetector, IByFieldNameDetector, IPartitionFieldNameDetector
+	{
+	}
+
+	public interface IDistinctCountDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector, IFieldNameDetector
+	{
+	}
+
+	public abstract class CountDetectorBase : DetectorBase, ICountDetector
+	{
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+
+		protected CountDetectorBase(CountFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public abstract class NonZeroCountDetectorBase : DetectorBase, INonZeroCountDetector
+	{
+		public Field ByFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+
+		protected NonZeroCountDetectorBase(NonZeroCountFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public abstract class DistinctCountDetectorBase : DetectorBase, IDistinctCountDetector
+	{
+		public Field ByFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field FieldName { get; set; }
+
+		protected DistinctCountDetectorBase(DistinctCountFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public class CountDetectorDescriptor : DetectorDescriptorBase, ICountDetector>, ICountDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+
+		public CountDetectorDescriptor(CountFunction function) : base(function.GetStringValue()) {}
+
+		public CountDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public CountDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public CountDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public CountDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public CountDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public CountDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+
+	public class NonZeroCountDetectorDescriptor : DetectorDescriptorBase, INonZeroCountDetector>, INonZeroCountDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+
+		public NonZeroCountDetectorDescriptor(NonZeroCountFunction function) : base(function.GetStringValue()) {}
+
+		public NonZeroCountDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public NonZeroCountDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public NonZeroCountDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public NonZeroCountDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+
+	public class DistinctCountDetectorDescriptor : DetectorDescriptorBase, IDistinctCountDetector>, IDistinctCountDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public DistinctCountDetectorDescriptor(DistinctCountFunction function) : base(function.GetStringValue()) {}
+
+		public DistinctCountDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public DistinctCountDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public DistinctCountDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public DistinctCountDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public DistinctCountDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public DistinctCountDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public DistinctCountDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public DistinctCountDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+
+	public class CountDetector : CountDetectorBase
+	{
+		public CountDetector() : base(CountFunction.Count) {}
+	}
+
+	public class HighCountDetector : CountDetectorBase
+	{
+		public HighCountDetector() : base(CountFunction.HighCount) {}
+	}
+
+	public class LowCountDetector : CountDetectorBase
+	{
+		public LowCountDetector() : base(CountFunction.LowCount) {}
+	}
+
+	/// 
+	/// Detects anomalies when the number of events in a bucket is anomalous, but it ignores cases where the bucket count is zero.
+	/// Use this function if you know your data is sparse or has gaps and the gaps are not important.
+	/// 
+	public class NonZeroCountDetector : NonZeroCountDetectorBase
+	{
+		public NonZeroCountDetector() : base(NonZeroCountFunction.NonZeroCount) {}
+	}
+
+	/// 
+	/// Detects anomalies when the number of events in a bucket is unusually high and it ignores cases where the bucket count is zero.
+	/// 
+	public class HighNonZeroCountDetector : NonZeroCountDetectorBase
+	{
+		public HighNonZeroCountDetector() : base(NonZeroCountFunction.HighNonZeroCount) {}
+	}
+
+	public class DistinctCountDetector : DistinctCountDetectorBase
+	{
+		public DistinctCountDetector() : base(DistinctCountFunction.DistinctCount) {}
+	}
+
+	public class HighDistinctCountDetector : DistinctCountDetectorBase
+	{
+		public HighDistinctCountDetector() : base(DistinctCountFunction.HighDistinctCount) {}
+	}
+
+	public class LowDistinctCountDetector : DistinctCountDetectorBase
+	{
+		public LowDistinctCountDetector() : base(DistinctCountFunction.LowDistinctCount) {}
+	}
+
+	/// 
+	/// Detects anomalies when the number of events in a bucket is unusually low and it ignores cases where the bucket count is zero.
+	/// 
+	public class LowNonZeroCountDetector : NonZeroCountDetectorBase
+	{
+		public LowNonZeroCountDetector() : base(NonZeroCountFunction.LowNonZeroCount) {}
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs
new file mode 100644
index 00000000000..9f96e84e2a8
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/Detector.cs
@@ -0,0 +1,289 @@
+using System;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace Nest
+{
+	[ContractJsonConverter(typeof(DetectorConverter))]
+	public interface IDetector
+	{
+		[JsonProperty("detector_description")]
+		string DetectorDescription { get; set; }
+
+		[JsonProperty("exclude_frequent")]
+		ExcludeFrequent? ExcludeFrequent { get; set; }
+
+		[JsonProperty("function")]
+		string Function { get; }
+
+		[JsonProperty("use_null")]
+		bool? UseNull { get; set; }
+
+		[JsonProperty("detector_index")]
+		int? DetectorIndex { get; set; }
+	}
+
+	internal class DetectorConverter : JsonConverter
+	{
+		public override bool CanWrite => false;
+
+		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) =>
+			throw new NotSupportedException();
+
+		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+		{
+			if (reader.TokenType == JsonToken.Null)
+				return null;
+
+			var jObject = JObject.Load(reader);
+			var function = jObject["function"].Value();
+
+			switch (function)
+			{
+				case "count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "non_zero_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_non_zero_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_non_zero_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "distinct_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_distinct_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_distinct_count":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "lat_long":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "info_content":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_info_content":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_info_content":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "min":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "max":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "median":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_median":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_median":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "mean":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_mean":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_mean":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "metric":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "varp":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_varp":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_varp":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "rare":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "freq_rare":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "sum":
+					 return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_sum":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_sum":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "non_null_sum":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "high_non_null_sum":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "low_non_null_sum":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "time_of_day":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				case "time_of_week":
+					return jObject.ToObject(ElasticContractResolver.Empty);
+				default:
+					throw new JsonSerializationException($"Cannot deserialize detector for unknown function '{function}'");
+			}
+		}
+
+		public override bool CanConvert(Type objectType) => true;
+	}
+
+	public interface IFieldNameDetector : IDetector
+	{
+		[JsonProperty("field_name")]
+		Field FieldName { get; set; }
+	}
+
+	public interface IByFieldNameDetector : IDetector
+	{
+		[JsonProperty("by_field_name")]
+		Field ByFieldName { get; set; }
+	}
+
+	public interface IOverFieldNameDetector : IDetector
+	{
+		[JsonProperty("over_field_name")]
+		Field OverFieldName { get; set; }
+	}
+
+	public interface IPartitionFieldNameDetector : IDetector
+	{
+		[JsonProperty("partition_field_name")]
+		Field PartitionFieldName { get; set; }
+	}
+
+	public abstract class DetectorBase : IDetector
+	{
+		protected DetectorBase(string function)
+		{
+			Function = function;
+		}
+
+		public string DetectorDescription { get; set; }
+		public ExcludeFrequent? ExcludeFrequent { get; set; }
+		public string Function { get; }
+		public bool? UseNull { get; set; }
+		public int? DetectorIndex { get; set; }
+	}
+
+	public abstract class DetectorDescriptorBase : DescriptorBase, IDetector
+		where TDetectorDescriptor : DetectorDescriptorBase, TDetectorInterface
+		where TDetectorInterface : class, IDetector
+	{
+		private readonly string _function;
+
+		string IDetector.DetectorDescription { get; set; }
+		ExcludeFrequent? IDetector.ExcludeFrequent { get; set; }
+		string IDetector.Function => _function;
+		bool? IDetector.UseNull { get; set; }
+		int? IDetector.DetectorIndex { get; set; }
+
+		protected DetectorDescriptorBase(string function) => _function = function;
+
+		public TDetectorDescriptor DetectorDescription(string description) => Assign(a => a.DetectorDescription = description);
+
+		public TDetectorDescriptor ExcludeFrequent(ExcludeFrequent excludeFrequent) => Assign(a => a.ExcludeFrequent = excludeFrequent);
+
+		public TDetectorDescriptor UseNull(bool useNull = true) => Assign(a => a.UseNull = useNull);
+
+		public TDetectorDescriptor DetectorIndex(int detectorIndex) => Assign(a => a.DetectorIndex = detectorIndex);
+	}
+
+	public class DetectorsDescriptor : DescriptorPromiseBase, IList> where T : class
+	{
+		public DetectorsDescriptor() : base(new List()) {}
+
+		public DetectorsDescriptor Count(Func, ICountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.Count))));
+
+		public DetectorsDescriptor HighCount(Func, ICountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.HighCount))));
+
+		public DetectorsDescriptor LowCount(Func, ICountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.LowCount))));
+
+		public DetectorsDescriptor NonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.NonZeroCount))));
+
+		public DetectorsDescriptor HighNonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.HighNonZeroCount))));
+
+		public DetectorsDescriptor LowNonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.LowNonZeroCount))));
+
+		public DetectorsDescriptor DistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.DistinctCount))));
+
+		public DetectorsDescriptor HighDistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.HighDistinctCount))));
+
+		public DetectorsDescriptor LowDistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.LowDistinctCount))));
+
+		public DetectorsDescriptor InfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.InfoContent))));
+
+		public DetectorsDescriptor HighInfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.HighInfoContent))));
+
+		public DetectorsDescriptor LowInfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.LowInfoContent))));
+
+		public DetectorsDescriptor Min(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Min))));
+
+		public DetectorsDescriptor Max(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Max))));
+
+		public DetectorsDescriptor Median(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Median))));
+
+		public DetectorsDescriptor HighMedian(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighMedian))));
+
+		public DetectorsDescriptor LowMedian(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowMedian))));
+
+		public DetectorsDescriptor Mean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Mean))));
+
+		public DetectorsDescriptor HighMean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighMean))));
+
+		public DetectorsDescriptor LowMean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowMean))));
+
+		public DetectorsDescriptor Metric(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Metric))));
+
+		public DetectorsDescriptor Varp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Varp))));
+
+		public DetectorsDescriptor HighVarp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighVarp))));
+
+		public DetectorsDescriptor LowVarp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowVarp))));
+
+		public DetectorsDescriptor Rare(Func, IRareDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new RareDetectorDescriptor(RareFunction.Rare))));
+
+		public DetectorsDescriptor FreqRare(Func, IRareDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new RareDetectorDescriptor(RareFunction.FreqRare))));
+
+		public DetectorsDescriptor Sum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.Sum))));
+
+		public DetectorsDescriptor HighSum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.HighSum))));
+
+		public DetectorsDescriptor LowSum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.LowSum))));
+
+		public DetectorsDescriptor NonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.NonNullSum))));
+
+		public DetectorsDescriptor HighNonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.HighNonNullSum))));
+
+		public DetectorsDescriptor LowNonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.LowNonNullSum))));
+
+		public DetectorsDescriptor TimeOfDay(Func, ITimeDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new TimeDetectorDescriptor(TimeFunction.TimeOfDay))));
+
+		public DetectorsDescriptor TimeOfWeek(Func, ITimeDetector> selector = null) =>
+			Assign(a => a.AddIfNotNull(selector.InvokeOrDefault(new TimeDetectorDescriptor(TimeFunction.TimeOfWeek))));
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/GeographicDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/GeographicDetector.cs
new file mode 100644
index 00000000000..99e4ea80f99
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/GeographicDetector.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Linq.Expressions;
+
+namespace Nest
+{
+	public enum GeographicFunction
+	{
+		LatLong
+	}
+
+	public static class GeographicFunctionsExtensions
+	{
+		public static string GetStringValue(this GeographicFunction geographicFunction)
+		{
+			switch (geographicFunction)
+			{
+				case GeographicFunction.LatLong:
+					return "lat_long";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(geographicFunction), geographicFunction, null);
+			}
+		}
+	}
+
+	public interface IGeographicDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector, IFieldNameDetector
+	{
+	}
+
+	public class LatLongDetector : DetectorBase, IGeographicDetector
+	{
+		public LatLongDetector() : base(GeographicFunction.LatLong.GetStringValue()) {}
+
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+		public Field FieldName { get; set; }
+	}
+
+	public class LatLongDetectorDescriptor : DetectorDescriptorBase, IGeographicDetector>, IGeographicDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public LatLongDetectorDescriptor(string function) : base(function) {}
+
+		public LatLongDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public LatLongDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public LatLongDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public LatLongDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public LatLongDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public LatLongDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public LatLongDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public LatLongDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/InfoContentDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/InfoContentDetector.cs
new file mode 100644
index 00000000000..475c86f9a97
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/InfoContentDetector.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Linq.Expressions;
+
+namespace Nest
+{
+	public enum InfoContentFunction
+	{
+		InfoContent,
+		HighInfoContent,
+		LowInfoContent
+	}
+
+	public static class InfoContentFunctions
+	{
+		public static string GetStringValue(this InfoContentFunction infoContentFunction)
+		{
+			switch (infoContentFunction)
+			{
+				case InfoContentFunction.InfoContent:
+					return "info_content";
+				case InfoContentFunction.HighInfoContent:
+					return "high_info_content";
+				case InfoContentFunction.LowInfoContent:
+					return "low_info_content";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(infoContentFunction), infoContentFunction, null);
+			}
+		}
+	}
+
+	public interface IInfoContentDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector, IFieldNameDetector
+	{
+	}
+
+	public abstract class InfoContentDetectorBase : DetectorBase, IInfoContentDetector
+	{
+		protected InfoContentDetectorBase(InfoContentFunction function) : base(function.GetStringValue()) {}
+
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+		public Field FieldName { get; set; }
+	}
+
+	public class InfoContentDetector : InfoContentDetectorBase
+	{
+		public InfoContentDetector() : base(InfoContentFunction.InfoContent) {}
+	}
+
+	public class HighInfoContentDetector : InfoContentDetectorBase
+	{
+		public HighInfoContentDetector() : base(InfoContentFunction.HighInfoContent) {}
+	}
+
+	public class LowInfoContentDetector : InfoContentDetectorBase
+	{
+		public LowInfoContentDetector() : base(InfoContentFunction.LowInfoContent) {}
+	}
+
+	public class InfoContentDetectorDescriptor : DetectorDescriptorBase, IInfoContentDetector>, IInfoContentDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public InfoContentDetectorDescriptor(InfoContentFunction function) : base(function.GetStringValue()) {}
+
+		public InfoContentDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public InfoContentDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public InfoContentDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public InfoContentDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public InfoContentDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public InfoContentDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public InfoContentDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public InfoContentDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/MetricDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/MetricDetector.cs
new file mode 100644
index 00000000000..3c702eac713
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/MetricDetector.cs
@@ -0,0 +1,163 @@
+using System;
+using System.Linq.Expressions;
+
+namespace Nest
+{
+	public enum MetricFunction
+	{
+		Min,
+
+		Max,
+
+		Median,
+		HighMedian,
+		LowMedian,
+
+		Mean,
+		HighMean,
+		LowMean,
+
+		Metric,
+
+		Varp,
+		HighVarp,
+		LowVarp
+	}
+
+	public static class MetricFunctionsExtensions
+	{
+		public static string GetStringValue(this MetricFunction metricFunction)
+		{
+			switch (metricFunction)
+			{
+				case MetricFunction.Min:
+					return "min";
+				case MetricFunction.Max:
+					return "max";
+				case MetricFunction.Median:
+					return "median";
+				case MetricFunction.HighMedian:
+					return "high_median";
+				case MetricFunction.LowMedian:
+					return "low_median";
+				case MetricFunction.Mean:
+					return "mean";
+				case MetricFunction.HighMean:
+					return "high_mean";
+				case MetricFunction.LowMean:
+					return "low_mean";
+				case MetricFunction.Metric:
+					return "metric";
+				case MetricFunction.Varp:
+					return "varp";
+				case MetricFunction.HighVarp:
+					return "high_varp";
+				case MetricFunction.LowVarp:
+					return "low_varp";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(metricFunction), metricFunction, null);
+			}
+		}
+	}
+
+	public interface IMetricDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector, IFieldNameDetector
+	{
+	}
+
+	public abstract class MetricDetectorBase : DetectorBase, IGeographicDetector
+	{
+		protected MetricDetectorBase(MetricFunction function) : base(function.GetStringValue()) {}
+
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+		public Field FieldName { get; set; }
+	}
+
+	public class MinDetector : MetricDetectorBase
+	{
+		public MinDetector() : base(MetricFunction.Min) {}
+	}
+
+	public class MaxDetector : MetricDetectorBase
+	{
+		public MaxDetector() : base(MetricFunction.Max) {}
+	}
+
+	public class MedianDetector : MetricDetectorBase
+	{
+		public MedianDetector() : base(MetricFunction.Median) {}
+	}
+
+	public class HighMedianDetector : MetricDetectorBase
+	{
+		public HighMedianDetector() : base(MetricFunction.HighMedian) {}
+	}
+
+	public class LowMedianDetector : MetricDetectorBase
+	{
+		public LowMedianDetector() : base(MetricFunction.LowMedian) {}
+	}
+
+	public class MeanDetector : MetricDetectorBase
+	{
+		public MeanDetector() : base(MetricFunction.Mean) {}
+	}
+
+	public class HighMeanDetector : MetricDetectorBase
+	{
+		public HighMeanDetector() : base(MetricFunction.HighMean) {}
+	}
+
+	public class LowMeanDetector : MetricDetectorBase
+	{
+		public LowMeanDetector() : base(MetricFunction.LowMean) {}
+	}
+
+	public class MetricDetector : MetricDetectorBase
+	{
+		public MetricDetector() : base(MetricFunction.Metric) {}
+	}
+
+	public class VarpDetector : MetricDetectorBase
+	{
+		public VarpDetector() : base(MetricFunction.Varp) {}
+	}
+
+	public class HighVarpDetector : MetricDetectorBase
+	{
+		public HighVarpDetector() : base(MetricFunction.HighVarp) {}
+	}
+
+	public class LowVarpDetector : MetricDetectorBase
+	{
+		public LowVarpDetector() : base(MetricFunction.LowVarp) {}
+	}
+
+	public class MetricDetectorDescriptor : DetectorDescriptorBase, IMetricDetector>, IMetricDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public MetricDetectorDescriptor(MetricFunction function) : base(function.GetStringValue()) {}
+
+		public MetricDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public MetricDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public MetricDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public MetricDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public MetricDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public MetricDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public MetricDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public MetricDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/RareDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/RareDetector.cs
new file mode 100644
index 00000000000..a089a714361
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/RareDetector.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public enum RareFunction
+	{
+		Rare,
+		FreqRare
+	}
+
+	public static class RareFunctionsExtensions
+	{
+		public static string GetStringValue(this RareFunction rareFunction)
+		{
+			switch (rareFunction)
+			{
+				case RareFunction.Rare:
+					return "rare";
+				case RareFunction.FreqRare:
+					return "freq_rare";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(rareFunction), rareFunction, null);
+			}
+		}
+	}
+
+	public interface IRareDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector
+	{
+	}
+
+	public abstract class RareDetectorBase : DetectorBase, IRareDetector
+	{
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+
+		protected RareDetectorBase(RareFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public class RareDetectorDescriptor : DetectorDescriptorBase, IRareDetector>, IRareDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+
+		public RareDetectorDescriptor(RareFunction function) : base(function.GetStringValue()) {}
+
+		public RareDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public RareDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public RareDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public RareDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public RareDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public RareDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+
+	public class RareDetector : RareDetectorBase
+	{
+		public RareDetector() : base(RareFunction.Rare) {}
+	}
+
+	public class FreqRareDetector : RareDetectorBase
+	{
+		public FreqRareDetector() : base(RareFunction.FreqRare) {}
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/SumDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/SumDetector.cs
new file mode 100644
index 00000000000..4496e347e48
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/SumDetector.cs
@@ -0,0 +1,163 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public enum SumFunction
+	{
+		Sum,
+		HighSum,
+		LowSum
+	}
+
+	public enum NonNullSumFunction
+	{
+		NonNullSum,
+		HighNonNullSum,
+		LowNonNullSum
+	}
+
+	public static class SumFunctionsExtensions
+	{
+		public static string GetStringValue(this SumFunction sumFunction)
+		{
+			switch (sumFunction)
+			{
+				case SumFunction.Sum:
+					return "sum";
+				case SumFunction.HighSum:
+					return "high_sum";
+				case SumFunction.LowSum:
+					return "low_sum";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(sumFunction), sumFunction, null);
+			}
+		}
+
+		public static string GetStringValue(this NonNullSumFunction nonNullSumFunction)
+		{
+			switch (nonNullSumFunction)
+			{
+				case NonNullSumFunction.NonNullSum:
+					return "non_null_sum";
+				case NonNullSumFunction.HighNonNullSum:
+					return "high_non_null_sum";
+				case NonNullSumFunction.LowNonNullSum:
+					return "low_non_null_sum";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(nonNullSumFunction), nonNullSumFunction, null);
+			}
+		}
+	}
+
+	public interface ISumDetector : IDetector, IFieldNameDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector
+	{
+	}
+
+	public interface INonNullSumDetector : IDetector, IFieldNameDetector, IByFieldNameDetector, IPartitionFieldNameDetector
+	{
+	}
+
+	public abstract class SumDetectorBase : DetectorBase, ISumDetector
+	{
+		public Field FieldName { get; set; }
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+
+		protected SumDetectorBase(SumFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public abstract class NonNullSumDetectorBase : DetectorBase, INonNullSumDetector
+	{
+		public Field FieldName { get; set; }
+		public Field ByFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+
+		protected NonNullSumDetectorBase(NonNullSumFunction function) : base(function.GetStringValue())
+		{
+		}
+	}
+
+	public class SumDetector : SumDetectorBase
+	{
+		public SumDetector() : base(SumFunction.Sum) {}
+	}
+
+	public class HighSumDetector : SumDetectorBase
+	{
+		public HighSumDetector() : base(SumFunction.HighSum) {}
+	}
+
+	public class LowSumDetector : SumDetectorBase
+	{
+		public LowSumDetector() : base(SumFunction.LowSum) {}
+	}
+
+	public class NonNullSumDetector : NonNullSumDetectorBase
+	{
+		public NonNullSumDetector() : base(NonNullSumFunction.NonNullSum) {}
+	}
+
+	public class HighNonNullSumDetector : NonNullSumDetectorBase
+	{
+		public HighNonNullSumDetector() : base(NonNullSumFunction.HighNonNullSum) {}
+	}
+
+	public class LowNonNullSumDetector : NonNullSumDetectorBase
+	{
+		public LowNonNullSumDetector() : base(NonNullSumFunction.LowNonNullSum) {}
+	}
+
+	public class SumDetectorDescriptor : DetectorDescriptorBase, ISumDetector>, ISumDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public SumDetectorDescriptor(SumFunction function) : base(function.GetStringValue()) {}
+
+		public SumDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public SumDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public SumDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public SumDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public SumDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public SumDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public SumDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public SumDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+
+	public class NonNullSumDetectorDescriptor : DetectorDescriptorBase, INonNullSumDetector>, INonNullSumDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+		Field IFieldNameDetector.FieldName { get; set; }
+
+		public NonNullSumDetectorDescriptor(NonNullSumFunction function) : base(function.GetStringValue()) {}
+
+		public NonNullSumDetectorDescriptor FieldName(Field fieldName) => Assign(a => a.FieldName = fieldName);
+
+		public NonNullSumDetectorDescriptor FieldName(Expression> objectPath) => Assign(a => a.FieldName = objectPath);
+
+		public NonNullSumDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public NonNullSumDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public NonNullSumDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public NonNullSumDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Detectors/TimeDetector.cs b/src/Nest/XPack/MachineLearning/Job/Detectors/TimeDetector.cs
new file mode 100644
index 00000000000..99b3512432d
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Detectors/TimeDetector.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Linq.Expressions;
+
+namespace Nest
+{
+	public enum TimeFunction
+	{
+		TimeOfDay,
+		TimeOfWeek
+	}
+
+	public static class TimeFunctionsExtensions
+	{
+		public static string GetStringValue(this TimeFunction timeFunction)
+		{
+			switch(timeFunction)
+			{
+				case TimeFunction.TimeOfDay:
+					return "time_of_day";
+				case TimeFunction.TimeOfWeek:
+					return "time_of_week";
+				default:
+					throw new ArgumentOutOfRangeException(nameof(timeFunction), timeFunction, null);
+			}
+		}
+	}
+
+	public interface ITimeDetector : IDetector, IByFieldNameDetector, IOverFieldNameDetector,
+		IPartitionFieldNameDetector
+	{
+	}
+
+	public abstract class TimeDetectorBase : DetectorBase, ITimeDetector
+	{
+		protected TimeDetectorBase(TimeFunction function) : base(function.GetStringValue()) {}
+
+		public Field ByFieldName { get; set; }
+		public Field OverFieldName { get; set; }
+		public Field PartitionFieldName { get; set; }
+	}
+
+	public class TimeOfDayDetector : TimeDetectorBase
+	{
+		public TimeOfDayDetector() : base(TimeFunction.TimeOfDay) {}
+	}
+
+	public class TimeOfWeekDetector : TimeDetectorBase
+	{
+		public TimeOfWeekDetector() : base(TimeFunction.TimeOfWeek) {}
+	}
+
+	public class TimeDetectorDescriptor : DetectorDescriptorBase, ITimeDetector>, ITimeDetector where T : class
+	{
+		Field IByFieldNameDetector.ByFieldName { get; set; }
+		Field IOverFieldNameDetector.OverFieldName { get; set; }
+		Field IPartitionFieldNameDetector.PartitionFieldName { get; set; }
+
+		public TimeDetectorDescriptor(TimeFunction function) : base(function.GetStringValue()) {}
+
+		public TimeDetectorDescriptor ByFieldName(Field byFieldName) => Assign(a => a.ByFieldName = byFieldName);
+
+		public TimeDetectorDescriptor ByFieldName(Expression> objectPath) => Assign(a => a.ByFieldName = objectPath);
+
+		public TimeDetectorDescriptor OverFieldName(Field overFieldName) => Assign(a => a.OverFieldName = overFieldName);
+
+		public TimeDetectorDescriptor OverFieldName(Expression> objectPath) => Assign(a => a.OverFieldName = objectPath);
+
+		public TimeDetectorDescriptor PartitionFieldName(Field partitionFieldName) => Assign(a => a.PartitionFieldName = partitionFieldName);
+
+		public TimeDetectorDescriptor PartitionFieldName(Expression> objectPath) => Assign(a => a.PartitionFieldName = objectPath);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Page.cs b/src/Nest/XPack/MachineLearning/Job/Page.cs
new file mode 100644
index 00000000000..90ab53c8bce
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Page.cs
@@ -0,0 +1,40 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IPage
+	{
+		/// 
+		/// Skips the specified number of buckets.
+		/// 
+		[JsonProperty("from")]
+		int? From { get; set; }
+
+		/// 
+		/// Specifies the maximum number of buckets to obtain.
+		/// 
+		[JsonProperty("size")]
+		int? Size { get; set; }
+	}
+
+	public class Page : IPage
+	{
+		/// 
+		public int? From { get; set; }
+
+		/// 
+		public int? Size { get; set; }
+	}
+
+	public class PageDescriptor : DescriptorBase, IPage
+	{
+		int? IPage.From { get; set; }
+		int? IPage.Size { get; set; }
+
+		/// 
+		public PageDescriptor From(int from) => Assign(a => a.From = from);
+
+		/// 
+		public PageDescriptor Size(int size) => Assign(a => a.Size = size);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Process/DataCounts.cs b/src/Nest/XPack/MachineLearning/Job/Process/DataCounts.cs
new file mode 100644
index 00000000000..4cbb7e5ab75
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Process/DataCounts.cs
@@ -0,0 +1,126 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class DataCounts
+	{
+		/// 
+		///  A unique identifier for the job.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// The number of records that have been processed by the job. This value includes records with missing fields,
+		/// since they are nonetheless analyzed.
+		///
+		/// If you use datafeeds and have aggregations in your search query, the 
+		/// will be the number of aggregated records processed, not the number of Elasticsearch documents.
+		/// 
+		[JsonProperty("processed_record_count")]
+		public long ProcessedRecordCount { get; internal set; }
+
+		/// 
+		/// The total number of fields in all the records that have been processed by the job.
+		/// Only fields that are specified in the detector configuration contribute to this count.
+		/// The time stamp is not included in this count.
+		/// 
+		[JsonProperty("processed_field_count")]
+		public long ProcessedFieldCount { get; internal set; }
+
+		/// 
+		/// The number of raw bytes read by the job.
+		/// 
+		[JsonProperty("input_bytes")]
+		public long InputBytes { get; internal set; }
+
+		/// 
+		/// The total number of record fields read by the job.
+		/// This count includes fields that are not used in the analysis.
+		/// 
+		[JsonProperty("input_field_count")]
+		public long InputFieldCount { get; internal set; }
+
+		/// 
+		/// The number of records with either a missing date field or a date that could not be parsed.
+		/// 
+		[JsonProperty("invalid_date_count")]
+		public long InvalidDateCount { get; internal set; }
+
+		/// 
+		/// The number of records that are missing a field that the job is configured to analyze.
+		/// Records with missing fields are still processed because it is possible that not all fields are missing.
+		/// The value of  includes this count.
+		/// 
+		[JsonProperty("missing_field_count")]
+		public long MissingFieldCount { get; internal set; }
+
+		/// 
+		/// The number of records that are out of time sequence and outside of the latency window.
+		/// These out of order records are discarded, since jobs require time series data to be in
+		/// ascending chronological order.
+		/// 
+		[JsonProperty("out_of_order_timestamp_count")]
+		public long OutOfOrderTimestampCount { get; internal set; }
+
+		/// 
+		/// The number of buckets which did not contain any data. If your data contains many empty buckets,
+		/// consider increasing your bucket_span or using functions that are tolerant to gaps in
+		/// data such as mean, non_null_sum or non_zero_count.
+		/// 
+		[JsonProperty("empty_bucket_count")]
+		public long EmptyBucketCount { get; internal set; }
+
+		[JsonProperty("sparse_bucket_count")]
+		public long SparseBucketCount { get; internal set; }
+
+		/// 
+		/// The number of bucket results produced by the job.
+		/// 
+		[JsonProperty("bucket_count")]
+		public long BucketCount { get; internal set; }
+
+		/// 
+		/// The timestamp of the earliest chronologically ordered record.
+		/// 
+		[JsonProperty("earliest_record_timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset? EarliestRecordTimestamp { get; internal set; }
+
+		/// 
+		/// The timestamp of the last processed record.
+		/// 
+		[JsonProperty("latest_record_timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset LatestRecordTimestamp { get; internal set; }
+
+		/// 
+		/// The timestamp of the last bucket that did not contain any data.
+		/// 
+		[JsonProperty("latest_empty_bucket_timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset LatestEmptyBucketTimestamp { get; internal set; }
+
+		/// 
+		/// The timestamp at which data was last analyzed, according to server time.
+		/// 
+		[JsonProperty("last_data_time")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset LastDataTime { get; internal set; }
+
+		/// 
+		/// The timestamp of the last bucket that was considered sparse.
+		/// 
+		[JsonProperty("latest_sparse_bucket_timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset LatestSparseBucketTimestamp { get; internal set; }
+
+		/// 
+		/// The number of data records read by the job.
+		/// 
+		[JsonProperty("input_record_count")]
+		public long InputRecordCount { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Process/ModelSizeStats.cs b/src/Nest/XPack/MachineLearning/Job/Process/ModelSizeStats.cs
new file mode 100644
index 00000000000..1c0b377fd46
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Process/ModelSizeStats.cs
@@ -0,0 +1,76 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Provides information about the size and contents of the model.
+	/// 
+	[JsonObject]
+	public class ModelSizeStats
+	{
+		/// 
+		///  A unique identifier for the job.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// For internal use. The type of result.
+		/// 
+		[JsonProperty("result_type")]
+		public string ResultType { get; internal set; }
+
+		/// 
+		/// The number of bytes of memory used by the models. This is the maximum value since the last time the
+		/// model was persisted. If the job is closed, this value indicates the latest size.
+		/// 
+		[JsonProperty("model_bytes")]
+		public long ModelBytes { get; internal set; }
+
+		/// 
+		/// The number of by field values that were analyzed by the models.
+		/// 
+		[JsonProperty("total_by_field_count")]
+		public long TotalByFieldCount { get; internal set; }
+
+		/// 
+		/// The number of over field values that were analyzed by the models.
+		/// 
+		[JsonProperty("total_over_field_count")]
+		public long TotalOverFieldCount { get; internal set; }
+
+		/// 
+		/// The number of partition field values that were analyzed by the models.
+		/// 
+		[JsonProperty("total_partition_field_count")]
+		public long TotalPartitionFieldCount { get; internal set; }
+
+		/// 
+		/// The number of buckets for which new entities in incoming data were not processed due to
+		/// insufficient model memory.
+		/// 
+		[JsonProperty("bucket_allocation_failures_count")]
+		public long BucketAllocationFailuresCount { get; internal set; }
+
+		/// 
+		/// The status of the mathematical models.
+		/// 
+		[JsonProperty("memory_status")]
+		public MemoryStatus MemoryStatus { get; internal set; }
+
+		/// 
+		/// The timestamp according to server time.
+		/// 
+		[JsonProperty("log_time")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset LogTime { get; internal set; }
+
+		/// 
+		/// The timestamp according to the timestamp of the data.
+		/// 
+		[JsonProperty("timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset? Timestamp { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Process/ModelSnapshot.cs b/src/Nest/XPack/MachineLearning/Job/Process/ModelSnapshot.cs
new file mode 100644
index 00000000000..c97e299b8a9
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Process/ModelSnapshot.cs
@@ -0,0 +1,68 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class ModelSnapshot
+	{
+		/// 
+		/// The unique identifier for the job
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// The creation timestamp for the snapshot.
+		/// 
+		[JsonProperty("timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset Timestamp { get; internal set; }
+
+		/// 
+		/// An optional description of the job.
+		/// 
+		[JsonProperty("description")]
+		public string Description { get; internal set; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the model snapshot.
+		/// 
+		[JsonProperty("snapshot_id")]
+		public string SnapshotId { get; internal set; }
+
+		/// 
+		/// For internal use only.
+		/// 
+		[JsonProperty("snapshot_doc_count")]
+		public long SnapshotDocCount { get; internal set; }
+
+		/// 
+		/// Summary information describing the model.
+		/// 
+		[JsonProperty("model_size_stats")]
+		public ModelSizeStats ModelSizeStats { get; internal set; }
+
+		/// 
+		/// The timestamp of the latest processed record.
+		/// 
+		[JsonProperty("latest_record_time_stamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset? LatestRecordTimeStamp{ get; internal set; }
+
+		/// 
+		/// The timestamp of the latest bucket result.
+		/// 
+		[JsonProperty("latest_result_time_stamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset? LatestResultTimeStamp{ get; internal set; }
+
+		/// 
+		/// If true, this snapshot will not be deleted during automatic cleanup of snapshots older than
+		/// the model snapshot retention days. However, this snapshot will be deleted when the
+		/// job is deleted. The default value is false.
+		/// 
+		[JsonProperty("retain")]
+		public bool Retain{ get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/AnomalyCause.cs b/src/Nest/XPack/MachineLearning/Job/Results/AnomalyCause.cs
new file mode 100644
index 00000000000..7b84bdb1227
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/AnomalyCause.cs
@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Cause for the anomaly that has been identified for the over field.
+	/// 
+	[JsonObject]
+	public class AnomalyCause
+	{
+		[JsonProperty("probability")]
+		public double Probability { get; internal set; }
+
+		[JsonProperty("over_field_name")]
+		public string OverFieldName  { get; internal set; }
+
+		[JsonProperty("over_field_value")]
+		public string OverFieldValue  { get; internal set; }
+
+		[JsonProperty("by_field_name")]
+		public string ByFieldName  { get; internal set; }
+
+		[JsonProperty("by_field_value")]
+		public string ByFieldValue  { get; internal set; }
+
+		[JsonProperty("correlated_by_field_value")]
+		public string CorrelatedByFieldValue  { get; internal set; }
+
+		[JsonProperty("partition_field_name")]
+		public string PartitionFieldName  { get; internal set; }
+
+		[JsonProperty("partition_field_value")]
+		public string PartitionFieldValue  { get; internal set; }
+
+		[JsonProperty("function")]
+		public string Function  { get; internal set; }
+
+		[JsonProperty("function_description")]
+		public string FunctionDescription { get; internal set; }
+
+		[JsonProperty("typical")]
+		public IReadOnlyCollection Typical { get; internal set; } = EmptyReadOnly.Collection;
+
+		[JsonProperty("actual")]
+		public IReadOnlyCollection Actual { get; internal set; } = EmptyReadOnly.Collection;
+
+		[JsonProperty("influencers")]
+		public IReadOnlyCollection Influencers { get; internal set; } = EmptyReadOnly.Collection;
+
+		[JsonProperty("field_name")]
+		public string FieldName  { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/AnomalyRecord.cs b/src/Nest/XPack/MachineLearning/Job/Results/AnomalyRecord.cs
new file mode 100644
index 00000000000..e809550ec6b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/AnomalyRecord.cs
@@ -0,0 +1,168 @@
+using System;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Detailed analyticial results of anomalous activity that has been identified in
+	/// the input data based on the detector configuration.
+	/// 
+	[JsonObject]
+	public class AnomalyRecord
+	{
+		/// 
+		/// The unique identifier for the job that these results belong to.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// Internal. This is always set to record.
+		/// 
+		[JsonProperty("result_type")]
+		public string ResultType { get; internal set; }
+
+		/// 
+		/// The probability of the individual anomaly occurring, in the range 0 to 1. For example, 0.0000772031.
+		/// This value can be held to a high precision of over 300 decimal places, so the 
+		/// is provided as a human-readable and friendly interpretation of this.
+		/// 
+		[JsonProperty("probability")]
+		public double Probability { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the anomalousness of this record.
+		/// Unlike , this value will be updated by a re-normalization process
+		/// as new data is analyzed.
+		/// 
+		[JsonProperty("record_score")]
+		public double RecordScore { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the anomalousness of this record.
+		/// This is the initial value that was calculated at the time the bucket was processed.
+		/// 
+		[JsonProperty("initial_record_score")]
+		public double InitialRecordScore { get; internal set; }
+
+		/// 
+		/// The length of the bucket. This value matches the bucket_span that is specified in the job.
+		/// 
+		[JsonProperty("bucket_span")]
+		public Time BucketSpan { get; internal set; }
+
+		/// 
+		/// A unique identifier for the detector.
+		/// 
+		[JsonProperty("detector_index")]
+		public int DetectorIndex { get; internal set; }
+
+		/// 
+		/// If true, this is an interim result. In other words, the anomaly record is calculated
+		/// based on partial input data.
+		/// 
+		[JsonProperty("is_interim")]
+		public bool IsInterim { get; internal set; }
+
+		/// 
+		/// The start time of the bucket for which these results were calculated.
+		/// 
+		[JsonProperty("timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset Timestamp { get; internal set; }
+
+		/// 
+		/// The function in which the anomaly occurs, as specified in the detector configuration.
+		/// 
+		[JsonProperty("function")]
+		public string Function { get; internal set; }
+
+		/// 
+		/// The description of the function in which the anomaly occurs, as specified in the detector configuration.
+		/// 
+		[JsonProperty("function_description")]
+		public string FunctionDescription { get; internal set; }
+
+		/// 
+		/// The typical value for the bucket, according to analytical modeling.
+		/// 
+		/// 
+		/// Additional record properties are added, depending on the fields being analyzed.
+		/// For example, if it’s analyzing hostname as a by field, then a field hostname is added to the result document.
+		/// This information enables you to filter the anomaly results more easily.
+		/// 
+		[JsonProperty("typical")]
+		public IReadOnlyCollection Typical { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		/// The actual value for the bucket.
+		/// 
+		[JsonProperty("actual")]
+		public IReadOnlyCollection Actual { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		/// Certain functions require a field to operate on, for example, sum().
+		/// For those functions, this value is the name of the field to be analyzed.
+		/// 
+		[JsonProperty("field_name")]
+		public string FieldName { get; internal set; }
+
+		/// 
+		/// The name of the analyzed field. This value is present only if it is specified in the detector.
+		/// 
+		[JsonProperty("by_field_name")]
+		public string ByFieldName { get; internal set; }
+
+		/// 
+		/// The value of . This value is present only if it is specified in the detector.
+		/// 
+		[JsonProperty("by_field_value")]
+		public string ByFieldValue { get; internal set; }
+
+		/// 
+		/// For population analysis, an over field must be specified in the detector.
+		/// This property contains an array of anomaly records that are the causes for the anomaly that has been
+		/// identified for the over field. If no over fields exist, this field is not present.
+		/// Contains the most anomalous records for the over_field_name. For scalability reasons,
+		/// a maximum of the 10 most significant causes of the anomaly are returned.
+		/// As part of the core analytical modeling, these low-level anomaly records are aggregated for their
+		/// parent over field record.
+		/// 
+		[JsonProperty("causes")]
+		public IReadOnlyCollection Causes { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		///  If influencers was specified in the detector configuration, then this
+		/// contains influencers that contributed to or were to blame for an anomaly.
+		/// 
+		[JsonProperty("influencers")]
+		public IReadOnlyCollection Influencers { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		/// The name of the over field that was used in the analysis. This value is present only if it was
+		/// specified in the detector. Over fields are used in population analysis.
+		/// 
+		[JsonProperty("over_field_name")]
+		public string OverFieldName { get; internal set; }
+
+		/// 
+		/// The value of . This value is present only if it is specified in the detector.
+		/// 
+		[JsonProperty("over_field_value")]
+		public string OverFieldValue { get; internal set; }
+
+		/// 
+		/// The name of the partition field that was used in the analysis.
+		/// This value is present only if it was specified in the detector.
+		/// 
+		[JsonProperty("partition_field_name")]
+		public string PartitionFieldName { get; internal set; }
+
+		/// 
+		/// The value of . This value is present only if it is specified in the detector.
+		/// 
+		[JsonProperty("partition_field_value")]
+		public string PartitionFieldValue { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/Bucket.cs b/src/Nest/XPack/MachineLearning/Job/Results/Bucket.cs
new file mode 100644
index 00000000000..cb92981d03b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/Bucket.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public class Bucket
+	{
+		/// 
+		/// The unique identifier for the job that these results belong to.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// The start time of the bucket. This timestamp uniquely identifies the bucket.
+		/// 
+		[JsonProperty("timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset Timestamp { get; internal set; }
+
+		/// 
+		/// The maximum anomaly score, between 0-100, for any of the bucket influencers. This is an overall, rate-limited score for the job. All the anomaly records in the bucket contribute to this score. This value might be updated as new data is analyzed.
+		/// 
+		[JsonProperty("anomaly_score")]
+		public double AnomalyScore { get; internal set; }
+
+		/// 
+		/// The length of the bucket. This value matches the bucket_span that is specified in the job.
+		/// 
+		[JsonProperty("bucket_span")]
+		public Time BucketSpan { get; internal set; }
+
+		/// 
+		/// The maximum anomaly_score for any of the bucket influencers. This is the initial value that was calculated at the time the bucket was processed.
+		/// 
+		[JsonProperty("initial_anomaly_score")]
+		public double InitialAnomalyScore { get; internal set; }
+
+		/// 
+		/// The number of input data records processed in this bucket.
+		/// 
+		[JsonProperty("event_count")]
+		public long EventCount { get; internal set; }
+
+		/// 
+		/// If true, this is an interim result. In other words, the bucket results are calculated based on partial input data.
+		/// 
+		[JsonProperty("is_interim")]
+		public bool IsInterim { get; internal set; }
+
+		/// 
+		/// An array of bucket influencer objects.
+		/// 
+		[JsonProperty("bucket_influencers")]
+		public IReadOnlyCollection BucketInfluencers { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		/// The amount of time, in milliseconds, that it took to analyze the bucket contents and calculate results.
+		/// 
+		[JsonProperty("processing_time_ms")]
+		public double ProcessingTimeMilliseconds { get; internal set; }
+
+		/// 
+		/// An array of partition score objects.
+		/// 
+		[JsonProperty("partition_scores")]
+		public IReadOnlyCollection PartitionScores { get; internal set; } = EmptyReadOnly.Collection;
+
+		/// 
+		/// Internal. This value is always set to bucket.
+		/// 
+		[JsonProperty("result_type")]
+		public string ResultType { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/BucketInfluencer.cs b/src/Nest/XPack/MachineLearning/Job/Results/BucketInfluencer.cs
new file mode 100644
index 00000000000..7c21c032e1f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/BucketInfluencer.cs
@@ -0,0 +1,70 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class BucketInfluencer
+	{
+		// 
+		/// The unique identifier for the job that these results belong to.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// Internal. This value is always set to influencer.
+		/// 
+		[JsonProperty("result_type")]
+		public string ResultType { get; internal set; }
+
+		/// 
+		/// The field name of the influencer.
+		/// 
+		[JsonProperty("influencer_field_name")]
+		public string InfluencerFieldName { get; internal set; }
+
+		/// 
+		/// The entity that influenced, contributed to, or was to blame for the anomaly.
+		/// 
+		[JsonProperty("influencer_field_value")]
+		public string InfluencerFieldValue { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the influencer in this bucket aggregated across detectors.
+		/// 
+		[JsonProperty("initial_influencer_score")]
+		public double InitialInfluencerScore { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the influencer in this bucket aggregated across detectors. Updated by a re-normalization process as new data is analyzed.
+		/// 
+		[JsonProperty("influencer_score")]
+		public double InfluencerScore { get; internal set; }
+
+		/// 
+		/// The probability that the influencer has this behavior, in the range 0 to 1. This value can be held to a high precision of over 300 decimal places.
+		/// 
+		[JsonProperty("probability")]
+		public double Probability { get; internal set; }
+
+		/// 
+		/// The length of the bucket. This value matches the bucket_span that is specified in the job.
+		/// 
+		[JsonProperty("bucket_span")]
+		public long BucketSpan { get; internal set; }
+
+		/// 
+		/// If true, this is an interim result. In other words, the influencer results are calculated based on partial input data.
+		/// 
+		[JsonProperty("is_interim")]
+		public bool IsInterim { get; internal set; }
+
+		/// 
+		/// The start time of the bucket for which these results were calculated.
+		/// 
+		[JsonProperty("timestamp")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		public DateTimeOffset Timestamp { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/CategoryDefinition.cs b/src/Nest/XPack/MachineLearning/Job/Results/CategoryDefinition.cs
new file mode 100644
index 00000000000..97c531fb58e
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/CategoryDefinition.cs
@@ -0,0 +1,45 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class CategoryDefinition
+	{
+		/// 
+		/// The unique identifier for the job that these results belong to.
+		/// 
+		[JsonProperty("job_id")]
+		public string JobId { get; internal set; }
+
+		/// 
+		/// A unique identifier for the category.
+		/// 
+		[JsonProperty("category_id")]
+		public long CategoryId { get; internal set; }
+
+		/// 
+		/// A space separated list of the common tokens that are matched in values of the category.
+		/// 
+		[JsonProperty("terms")]
+		public string Terms { get; internal set; }
+
+		/// 
+		/// A regular expression that is used to search for values that match the category.
+		/// 
+		[JsonProperty("regex")]
+		public string Regex { get; internal set; }
+
+		/// 
+		/// The maximum length of the fields that matched the category. The value is increased by 10% to enable matching for similar fields that have not been analyzed.
+		/// 
+		[JsonProperty("max_matching_length")]
+		public long MaxMatchingLength { get; internal set; }
+
+		/// 
+		/// A list of examples of actual values that matched the category.
+		/// 
+		[JsonProperty("examples")]
+		public IReadOnlyCollection Examples { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/Influence.cs b/src/Nest/XPack/MachineLearning/Job/Results/Influence.cs
new file mode 100644
index 00000000000..fe84673c74c
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/Influence.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class Influence
+	{
+		/// 
+		/// The field name of the influencer.
+		/// 
+		[JsonProperty("influencer_field_name")]
+		public string InfluencerFieldName { get; internal set; }
+
+		/// 
+		/// The entities that influenced, contributed to, or was to blame for the influence.
+		/// 
+		[JsonProperty("influencer_field_values")]
+		public IReadOnlyCollection InfluencerFieldValues { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/Job/Results/PartitionScore.cs b/src/Nest/XPack/MachineLearning/Job/Results/PartitionScore.cs
new file mode 100644
index 00000000000..3366ee80c8d
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/Job/Results/PartitionScore.cs
@@ -0,0 +1,38 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonObject]
+	public class PartitionScore
+	{
+		/// 
+		/// The name of the partition field that was used in the analysis. This value is present only if it was specified in the detector.
+		/// 
+		[JsonProperty("partition_field_name")]
+		public string PartitionFieldName { get; internal set; }
+
+		/// 
+		/// The value of partition_field_name. This value is present only if it was specified in the detector.
+		/// 
+		[JsonProperty("partition_field_value")]
+		public string PartitionFieldValue { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the anomalousness of this record. This is the initial value that was calculated at the time the bucket was processed.
+		/// 
+		[JsonProperty("initial_record_score")]
+		public double InitialRecordScore { get; internal set; }
+
+		/// 
+		/// A normalized score between 0-100, which is based on the probability of the anomalousness of this record. Unlike initial_record_score, this value will be updated by a re-normalization process as new data is analyzed.
+		/// 
+		[JsonProperty("record_score")]
+		public double RecordScore { get; internal set; }
+
+		/// 
+		/// The probability of the individual anomaly occurring, in the range 0 to 1. This value can be held to a high precision of over 300 decimal places.
+		/// 
+		[JsonProperty("probability")]
+		public double Probability { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/OpenJob/ElasticClient-OpenJob.cs b/src/Nest/XPack/MachineLearning/OpenJob/ElasticClient-OpenJob.cs
new file mode 100644
index 00000000000..0486ba61b01
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/OpenJob/ElasticClient-OpenJob.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Opens a Machine Learning job.
+		/// A job must be opened in order for it to be ready to receive and analyze data.
+		/// A job can be opened and closed multiple times throughout its lifecycle.
+		/// 
+		IOpenJobResponse OpenJob(Id jobId, Func selector = null);
+
+		/// 
+		IOpenJobResponse OpenJob(IOpenJobRequest request);
+
+		/// 
+		Task OpenJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task OpenJobAsync(IOpenJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IOpenJobResponse OpenJob(Id jobId, Func selector = null) =>
+			this.OpenJob(selector.InvokeOrDefault(new OpenJobDescriptor(jobId)));
+
+		/// 
+		public IOpenJobResponse OpenJob(IOpenJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlOpenJobDispatch(p)
+			);
+
+		/// 
+		public Task OpenJobAsync(Id jobId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.OpenJobAsync(selector.InvokeOrDefault(new OpenJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task OpenJobAsync(IOpenJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlOpenJobDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/OpenJob/OpenJobRequest.cs b/src/Nest/XPack/MachineLearning/OpenJob/OpenJobRequest.cs
new file mode 100644
index 00000000000..ea27c49736f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/OpenJob/OpenJobRequest.cs
@@ -0,0 +1,33 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to open a Machine Learning job.
+	/// 
+	public partial interface IOpenJobRequest
+	{
+		/// 
+		/// Controls the time to wait until a job has opened. The default value is 30 minutes.
+		/// 
+		[JsonProperty("timeout")]
+		Time Timeout { get; set; }
+	}
+
+	/// 
+	public partial class OpenJobRequest
+	{
+		/// 
+		public Time Timeout { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlOpenJob")]
+	public partial class OpenJobDescriptor
+	{
+		Time IOpenJobRequest.Timeout { get; set; }
+
+		/// 
+		public OpenJobDescriptor Timeout(Time timeout) => Assign(a => a.Timeout = timeout);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs b/src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs
new file mode 100644
index 00000000000..e0abe404d7a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IOpenJobResponse : IResponse
+	{
+		[JsonProperty("opened")]
+		bool Opened { get; }
+	}
+
+	public class OpenJobResponse : ResponseBase, IOpenJobResponse
+	{
+		public bool Opened { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PostJobData/ElasticClient-PostJobData.cs b/src/Nest/XPack/MachineLearning/PostJobData/ElasticClient-PostJobData.cs
new file mode 100644
index 00000000000..2bf8f133162
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PostJobData/ElasticClient-PostJobData.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Sends data to a Machine Learning job for analysis.
+		/// 
+		IPostJobDataResponse PostJobData(Id jobId, Func selector);
+
+		/// 
+		IPostJobDataResponse PostJobData(IPostJobDataRequest request);
+
+		/// 
+		Task PostJobDataAsync(Id jobId, Func selector, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task PostJobDataAsync(IPostJobDataRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IPostJobDataResponse PostJobData(Id jobId, Func selector) =>
+			this.PostJobData(selector.InvokeOrDefault(new PostJobDataDescriptor(jobId)));
+
+		/// 
+		public IPostJobDataResponse PostJobData(IPostJobDataRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlPostDataDispatch
+			);
+
+		/// 
+		public Task PostJobDataAsync(Id jobId, Func selector, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.PostJobDataAsync(selector.InvokeOrDefault(new PostJobDataDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task PostJobDataAsync(IPostJobDataRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlPostDataDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataRequest.cs b/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataRequest.cs
new file mode 100644
index 00000000000..1d861572a66
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataRequest.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Elasticsearch.Net;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonConverter(typeof(PostJobDataConverter))]
+	public partial interface IPostJobDataRequest
+	{
+		/// 
+		/// The job data.
+		/// 
+		/// 
+		/// The job must have a state of open to receive and process the data.
+		/// 
+		[JsonIgnore]
+		IEnumerable Data { get; set; }
+	}
+
+	/// 
+	public partial class PostJobDataRequest
+	{
+		/// 
+		public IEnumerable Data { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlPostData")]
+	public partial class PostJobDataDescriptor
+	{
+		/// 
+		IEnumerable IPostJobDataRequest.Data { get; set; }
+
+		/// 
+		public PostJobDataDescriptor Data(IEnumerable data) => Assign(a => a.Data = data);
+
+		/// 
+		public PostJobDataDescriptor Data(params object[] data) => Assign(a =>
+		{
+			if(data != null && data.Length == 1 && data[0] is IEnumerable)
+			{
+				a.Data = ((IEnumerable)data[0]).Cast();
+			}
+			else a.Data = data;
+		});
+	}
+
+	internal class PostJobDataConverter : JsonConverter
+	{
+		public override bool CanRead => false;
+
+		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+		{
+			var request = (IPostJobDataRequest) value;
+			if (request?.Data == null)
+			{
+				writer.WriteNull();
+				return;
+			}
+
+			var settings = serializer.GetConnectionSettings();
+			var elasticsearchSerializer = settings.Serializer;
+			foreach (var data in request.Data)
+			{
+				var bodyJson = elasticsearchSerializer.SerializeToString(data, SerializationFormatting.None);
+				writer.WriteRaw(bodyJson + "\n");
+			}
+		}
+
+		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) =>
+			throw new NotSupportedException();
+
+		public override bool CanConvert(Type objectType) => true;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataResponse.cs b/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataResponse.cs
new file mode 100644
index 00000000000..3babc4c81bf
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PostJobData/PostJobDataResponse.cs
@@ -0,0 +1,130 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IPostJobDataResponse : IResponse
+	{
+		/// 
+		/// The unique identifier for the job
+		/// 
+		[JsonProperty("job_id")]
+		string JobId { get; }
+
+		/// 
+		/// The count of processed records.
+		/// 
+		[JsonProperty("processed_record_count")]
+		long ProcessedRecordCount { get; }
+
+		/// 
+		/// The count of processed fields.
+		/// 
+		[JsonProperty("processed_field_count")]
+		long ProcessedFieldCount { get; }
+
+		/// 
+		/// Total input bytes.
+		/// 
+		[JsonProperty("input_bytes")]
+		long InputBytes { get; }
+
+		/// 
+		/// The count of input fields.
+		/// 
+		[JsonProperty("input_field_count")]
+		long InputFieldCount { get; }
+
+		/// 
+		/// The count of invalid dates.
+		/// 
+		[JsonProperty("invalid_date_count")]
+		long InvalidDateCount { get; }
+
+		/// 
+		/// The count of missing fields.
+		/// 
+		[JsonProperty("missing_field_count")]
+		long MissingFieldCount { get; }
+
+		/// 
+		/// The count of out of order timestamps.
+		/// 
+		[JsonProperty("out_of_order_timestamp_count")]
+		long OutOfOrderTimestampCount { get; }
+
+		/// 
+		/// The count of empty buckets.
+		/// 
+		[JsonProperty("empty_bucket_count")]
+		long EmptyBucketCount { get; }
+
+		/// 
+		/// The count of sparse buckets.
+		/// 
+		[JsonProperty("sparse_bucket_count")]
+		long SparseBucketCount { get; }
+
+		/// 
+		/// The count of buckets.
+		/// 
+		[JsonProperty("bucket_count")]
+		long BucketCount { get; }
+
+		/// 
+		/// The time of the last data item.
+		/// 
+		[JsonProperty("last_data_time")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset LastDataTime { get; }
+
+		/// 
+		/// The count of input records.
+		/// 
+		[JsonProperty("input_record_count")]
+		long InputRecordCount { get; }
+	}
+
+	/// 
+	public class PostJobDataResponse : ResponseBase, IPostJobDataResponse
+	{
+		/// 
+		public string JobId { get; internal set; }
+
+		/// 
+		public long ProcessedRecordCount { get; internal set; }
+
+		/// 
+		public long ProcessedFieldCount { get; internal set; }
+
+		/// 
+		public long InputBytes { get; internal set; }
+
+		/// 
+		public long InputFieldCount { get; internal set; }
+
+		/// 
+		public long InvalidDateCount { get; internal set; }
+
+		/// 
+		public long MissingFieldCount { get; internal set; }
+
+		/// 
+		public long OutOfOrderTimestampCount { get; internal set; }
+
+		/// 
+		public long EmptyBucketCount { get; internal set; }
+
+		/// 
+		public long SparseBucketCount { get; internal set; }
+
+		/// 
+		public long BucketCount { get; internal set; }
+
+		/// 
+		public DateTimeOffset LastDataTime { get; internal set; }
+
+		/// 
+		public long InputRecordCount { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PreviewDatafeed/ElasticClient-PreviewDatafeed.cs b/src/Nest/XPack/MachineLearning/PreviewDatafeed/ElasticClient-PreviewDatafeed.cs
new file mode 100644
index 00000000000..97d68839e95
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PreviewDatafeed/ElasticClient-PreviewDatafeed.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Preview a Machine Learning datafeed.
+		/// This preview shows the structure of the data that will be passed to the anomaly detection engine.
+		/// 
+		IPreviewDatafeedResponse PreviewDatafeed(Id datafeedId, Func selector = null);
+
+		/// 
+		IPreviewDatafeedResponse PreviewDatafeed(IPreviewDatafeedRequest request);
+
+		/// 
+		Task> PreviewDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task> PreviewDatafeedAsync(IPreviewDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IPreviewDatafeedResponse PreviewDatafeed(Id datafeedId, Func selector = null) =>
+			this.PreviewDatafeed(selector.InvokeOrDefault(new PreviewDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IPreviewDatafeedResponse PreviewDatafeed(IPreviewDatafeedRequest request) =>
+			this.Dispatcher.Dispatch>(
+				request,
+				this.PreviewDatafeedResponse,
+				(p, d) => this.LowLevelDispatch.XpackMlPreviewDatafeedDispatch>(p)
+			);
+
+		/// 
+		public Task> PreviewDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.PreviewDatafeedAsync(selector.InvokeOrDefault(new PreviewDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task> PreviewDatafeedAsync(IPreviewDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync, IPreviewDatafeedResponse>(
+				request,
+				cancellationToken,
+				this.PreviewDatafeedResponse,
+				(p, d, c) => this.LowLevelDispatch.XpackMlPreviewDatafeedDispatchAsync>(p, c)
+			);
+
+		private PreviewDatafeedResponse PreviewDatafeedResponse(IApiCallDetails response, Stream stream) => response.Success
+			? new PreviewDatafeedResponse { Data = this.ConnectionSettings.Serializer.Deserialize>(stream) }
+			: new PreviewDatafeedResponse();
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedRequest.cs
new file mode 100644
index 00000000000..1ec2e8c44f7
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedRequest.cs
@@ -0,0 +1,13 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public partial interface IPreviewDatafeedRequest {}
+
+	/// 
+	public partial class PreviewDatafeedRequest {}
+
+	/// 
+	[DescriptorFor("XpackMlPreviewDatafeed")]
+	public partial class PreviewDatafeedDescriptor {}
+}
diff --git a/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedResponse.cs
new file mode 100644
index 00000000000..9cce373bd6a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PreviewDatafeed/PreviewDatafeedResponse.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+
+namespace Nest
+{
+	public interface IPreviewDatafeedResponse : IResponse
+	{
+		IReadOnlyCollection Data { get; }
+	}
+
+	public class PreviewDatafeedResponse : ResponseBase, IPreviewDatafeedResponse
+	{
+		public IReadOnlyCollection Data { get; internal set; } = EmptyReadOnly.Collection;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutDatafeed/ElasticClient-PutDatafeed.cs b/src/Nest/XPack/MachineLearning/PutDatafeed/ElasticClient-PutDatafeed.cs
new file mode 100644
index 00000000000..718bb7dc068
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutDatafeed/ElasticClient-PutDatafeed.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Creates a Machine Learning datafeed.
+		/// You must create a job before you create a datafeed. You can associate only one datafeed to each job.
+		/// 
+		IPutDatafeedResponse PutDatafeed(Id datafeedId, Func, IPutDatafeedRequest> selector = null) where T : class;
+
+		/// 
+		IPutDatafeedResponse PutDatafeed(IPutDatafeedRequest request);
+
+		/// 
+		Task PutDatafeedAsync(Id datafeedId, Func, IPutDatafeedRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task PutDatafeedAsync(IPutDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IPutDatafeedResponse PutDatafeed(Id datafeedId, Func, IPutDatafeedRequest> selector = null) where T : class =>
+			this.PutDatafeed(selector.InvokeOrDefault(new PutDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IPutDatafeedResponse PutDatafeed(IPutDatafeedRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlPutDatafeedDispatch
+			);
+
+		/// 
+		public Task PutDatafeedAsync(Id datafeedId, Func, IPutDatafeedRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class =>
+			this.PutDatafeedAsync(selector.InvokeOrDefault(new PutDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task PutDatafeedAsync(IPutDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlPutDatafeedDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedRequest.cs
new file mode 100644
index 00000000000..8fd17ae0c49
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedRequest.cs
@@ -0,0 +1,168 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Creates a datafeed for a Machine Learning job
+	/// 
+	public partial interface IPutDatafeedRequest
+	{
+		/// 
+		/// If set, the datafeed performs aggregation searches
+		/// 
+		[JsonProperty("aggregations")]
+		AggregationDictionary Aggregations { get; set; }
+
+		/// 
+		/// Specifies how data searches are split into time chunks.
+		/// 
+		[JsonProperty("chunking_config")]
+		IChunkingConfig ChunkingConfig { get; set; }
+
+		/// 
+		/// The interval at which scheduled queries are made while the datafeed runs in real time.
+		/// The default value is either the bucket span for short bucket spans, or, for longer bucket spans,
+		/// a sensible fraction of the bucket span.
+		/// 
+		[JsonProperty("frequency")]
+		Time Frequency { get; set; }
+
+		///A list of index names to search within. Wildcards are supported
+		[JsonProperty("indices")]
+		[JsonConverter(typeof(IndicesJsonConverter))]
+		Indices Indices { get; set; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the job.
+		/// 
+		[JsonProperty("job_id")]
+		Id JobId { get; set; }
+
+		/// 
+		/// Describe the query to perform using a query descriptor lambda
+		/// 
+		[JsonProperty("query")]
+		QueryContainer Query { get; set; }
+
+		/// 
+		/// The number of seconds behind real time that data is queried.
+		/// For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m.,
+		/// set this property to 120 seconds. The default value is 60s.
+		/// 
+		[JsonProperty("query_delay")]
+		Time QueryDelay { get; set; }
+
+		/// 
+		/// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. T
+		/// he detector configuration in a job can contain functions that use these script fields.
+		/// 
+		[JsonProperty("script_fields")]
+		IScriptFields ScriptFields { get; set; }
+
+		/// 
+		/// The size parameter that is used in Elasticsearch searches
+		/// 
+		[JsonProperty("scroll_size")]
+		int? ScrollSize { get; set; }
+
+		///A list of types to search for within the specified indices
+		[JsonProperty("types")]
+		[JsonConverter(typeof(TypesJsonConverter))]
+		Types Types { get; set; }
+	}
+
+	/// 
+	public partial class PutDatafeedRequest
+	{
+		/// 
+		public AggregationDictionary Aggregations { get; set; }
+
+		/// 
+		public IChunkingConfig ChunkingConfig { get; set; }
+
+		/// 
+		public Time Frequency { get; set; }
+
+		/// 
+		public Indices Indices { get; set; }
+
+		/// 
+		public Id JobId { get; set; }
+
+		/// 
+		public QueryContainer Query { get; set; }
+
+		/// 
+		public Time QueryDelay { get; set; }
+
+		/// 
+		public IScriptFields ScriptFields { get; set; }
+
+		/// 
+		public int? ScrollSize { get; set; }
+
+		/// 
+		public Types Types { get; set; }
+	}
+
+	[DescriptorFor("XpackMlPutDatafeed")]
+	public partial class PutDatafeedDescriptor where T : class
+	{
+		AggregationDictionary IPutDatafeedRequest.Aggregations { get; set; }
+		IChunkingConfig IPutDatafeedRequest.ChunkingConfig { get; set; }
+		Time IPutDatafeedRequest.Frequency { get; set; }
+		Indices IPutDatafeedRequest.Indices { get; set; }
+		Id IPutDatafeedRequest.JobId { get; set; }
+		QueryContainer IPutDatafeedRequest.Query { get; set; }
+		Time IPutDatafeedRequest.QueryDelay { get; set; }
+		IScriptFields IPutDatafeedRequest.ScriptFields { get; set; }
+		int? IPutDatafeedRequest.ScrollSize { get; set; }
+		Types IPutDatafeedRequest.Types { get; set; }
+
+		/// 
+		public PutDatafeedDescriptor Aggregations(Func, IAggregationContainer> aggregationsSelector) =>
+			Assign(a => a.Aggregations = aggregationsSelector(new AggregationContainerDescriptor())?.Aggregations);
+
+		/// 
+		public PutDatafeedDescriptor ChunkingConfig(Func selector) =>
+			Assign(a => a.ChunkingConfig = selector?.Invoke(new ChunkingConfigDescriptor()));
+
+		/// 
+		public PutDatafeedDescriptor Frequency(Time frequency) => Assign(a => a.Frequency = frequency);
+
+		/// 
+		public PutDatafeedDescriptor Indices(Indices indices) => Assign(a => a.Indices = indices);
+
+		///a shortcut into calling Indices(typeof(TOther))
+		public PutDatafeedDescriptor Indices() => Assign(a => a.Indices = typeof(TOther));
+
+		///A shortcut into calling Indices(Indices.All)
+		public PutDatafeedDescriptor AllIndices() => this.Indices(Nest.Indices.All);
+
+		/// 
+		public PutDatafeedDescriptor JobId(Id jobId) => Assign(a => a.JobId = jobId);
+
+		/// 
+		public PutDatafeedDescriptor Query(Func, QueryContainer> query) => Assign(a => a.Query = query?.Invoke(new QueryContainerDescriptor()));
+
+		/// 
+		public PutDatafeedDescriptor QueryDelay(Time queryDelay) => Assign(a => a.QueryDelay = queryDelay);
+
+		/// 
+		public PutDatafeedDescriptor ScriptFields(Func> selector) =>
+			Assign(a => a.ScriptFields = selector?.Invoke(new ScriptFieldsDescriptor())?.Value);
+
+		/// 
+		public PutDatafeedDescriptor ScrollSize(int scrollSize) => Assign(a => a.ScrollSize = scrollSize);
+
+		/// 
+		public PutDatafeedDescriptor Types(Types types) => Assign(a => a.Types = types);
+
+		///a shortcut into calling Types(typeof(TOther))
+		public PutDatafeedDescriptor Types() => Assign(a => a.Types = typeof(TOther));
+
+		///a shortcut into calling Types(Types.All)
+		public PutDatafeedDescriptor AllTypes() => this.Types(Nest.Types.All);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedResponse.cs
new file mode 100644
index 00000000000..d285a398030
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedResponse.cs
@@ -0,0 +1,106 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// The response from creating a datafeed
+	/// 
+	public partial interface IPutDatafeedResponse : IResponse
+	{
+		/// 
+		/// The datafeed id
+		/// 
+		[JsonProperty("datafeed_id")]
+		string DatafeedId { get; }
+
+		/// 
+		/// The aggregation searches to perform for the datafeed
+		/// 
+		[JsonProperty("aggregations")]
+		AggregationDictionary Aggregations { get; }
+
+		/// 
+		/// Specifies how data searches are split into time chunks.
+		/// 
+		[JsonProperty("chunking_config")]
+		IChunkingConfig ChunkingConfig { get; }
+
+		/// 
+		/// The interval at which scheduled queries are made while the datafeed runs in real time.
+		/// The default value is either the bucket span for short bucket spans, or, for longer bucket spans,
+		/// a sensible fraction of the bucket span.
+		/// 
+		[JsonProperty("frequency")]
+		Time Frequency { get; }
+
+		///A list of index names to search within. Wildcards are supported
+		[JsonProperty("indices")]
+		[JsonConverter(typeof(IndicesJsonConverter))]
+		Indices Indices { get; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the job.
+		/// 
+		[JsonProperty("job_id")]
+		string JobId { get;  }
+
+		/// 
+		/// Describe the query to perform using a query descriptor lambda
+		/// 
+		[JsonProperty("query")]
+		QueryContainer Query { get; }
+
+		/// 
+		/// The number of seconds behind real time that data is queried.
+		/// For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m.,
+		/// set this property to 120 seconds. The default value is 60s.
+		/// 
+		[JsonProperty("query_delay")]
+		Time QueryDelay { get; }
+
+		/// 
+		/// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. T
+		/// The detector configuration in a job can contain functions that use these script fields.
+		/// 
+		[JsonProperty("script_fields")]
+		IScriptFields ScriptFields { get; }
+
+		/// 
+		/// The size parameter that is used in Elasticsearch searches
+		/// 
+		[JsonProperty("scroll_size")]
+		int? ScrollSize { get; }
+
+		///A list of types to search for within the specified indices
+		[JsonProperty("types")]
+		[JsonConverter(typeof(TypesJsonConverter))]
+		Types Types { get;  }
+	}
+
+	/// 
+	public class PutDatafeedResponse : ResponseBase, IPutDatafeedResponse
+	{
+		/// 
+		public string DatafeedId { get; internal set; }
+		/// 
+		public AggregationDictionary Aggregations { get; internal set; }
+		/// 
+		public IChunkingConfig ChunkingConfig { get; internal set; }
+		/// 
+		public Time Frequency { get; internal set; }
+		/// 
+		public Indices Indices { get; internal set; }
+		/// 
+		public string JobId { get; internal set; }
+		/// 
+		public QueryContainer Query { get; internal set; }
+		/// 
+		public Time QueryDelay { get; internal set; }
+		/// 
+		public IScriptFields ScriptFields { get; internal set; }
+		/// 
+		public int? ScrollSize { get; internal set; }
+		/// 
+		public Types Types { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutJob/ElasticClient-PutJob.cs b/src/Nest/XPack/MachineLearning/PutJob/ElasticClient-PutJob.cs
new file mode 100644
index 00000000000..a90dd590431
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutJob/ElasticClient-PutJob.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Creates a Machine Learning job.
+		/// 
+		IPutJobResponse PutJob(Id jobId, Func, IPutJobRequest> selector) where T : class;
+
+		/// 
+		IPutJobResponse PutJob(IPutJobRequest request);
+
+		/// 
+		Task PutJobAsync(Id jobId, Func, IPutJobRequest> selector, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task PutJobAsync(IPutJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IPutJobResponse PutJob(Id jobId, Func, IPutJobRequest> selector) where T : class =>
+			this.PutJob(selector.InvokeOrDefault(new PutJobDescriptor(jobId)));
+
+		/// 
+		public IPutJobResponse PutJob(IPutJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlPutJobDispatch
+			);
+
+		/// 
+		public Task PutJobAsync(Id jobId, Func, IPutJobRequest> selector, CancellationToken cancellationToken = default(CancellationToken)) where T : class =>
+			this.PutJobAsync(selector.InvokeOrDefault(new PutJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task PutJobAsync(IPutJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlPutJobDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs b/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs
new file mode 100644
index 00000000000..5109fa12846
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs
@@ -0,0 +1,136 @@
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+using Elasticsearch.Net;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace Nest
+{
+	/// 
+	/// Creates a Machine Learning Job
+	/// 
+	public partial interface IPutJobRequest
+	{
+		/// 
+		/// The analysis configuration, which specifies how to analyze the data.
+		/// 
+		[JsonProperty("analysis_config")]
+		IAnalysisConfig AnalysisConfig { get; set; }
+
+		/// 
+		/// Defines approximate limits on the memory resource requirements for the job.
+		/// 
+		[JsonProperty("analysis_limits")]
+		IAnalysisLimits AnalysisLimits { get; set; }
+
+		/// 
+		/// Describes the format of the input data. This object is required, but it can be empty
+		/// 
+		[JsonProperty("data_description")]
+		IDataDescription DataDescription { get; set; }
+
+		/// 
+		/// An optional description of the job
+		/// 
+		[JsonProperty("description")]
+		string Description { get; set; }
+
+		/// 
+		/// This advanced configuration option stores model information along with the results. T
+		/// his adds overhead to the performance of the system and is not feasible for jobs with many entities
+		/// 
+		[JsonProperty("model_plot")]
+		IModelPlotConfig ModelPlotConfig { get; set; }
+
+		/// 
+		/// The time in days that model snapshots are retained for the job.
+		/// Older snapshots are deleted. The default value is 1 day.
+		/// 
+		[JsonProperty("model_snapshot_retention_days")]
+		long? ModelSnapshotRetentionDays { get; set; }
+
+		/// 
+		/// The name of the index in which to store the machine learning results.
+		/// The default value is shared, which corresponds to the index name .ml-anomalies-shared.
+		/// 
+		[JsonProperty("results_index_name")]
+		IndexName ResultsIndexName { get; set; }
+	}
+
+	/// 
+	public partial class PutJobRequest
+	{
+		/// 
+		public IAnalysisConfig AnalysisConfig { get; set; }
+		/// 
+		public IAnalysisLimits AnalysisLimits { get; set; }
+		/// 
+		public IDataDescription DataDescription { get; set; }
+		/// 
+		public string Description { get; set; }
+		/// 
+		public IModelPlotConfig ModelPlotConfig { get; set; }
+		/// 
+		public long? ModelSnapshotRetentionDays { get; set; }
+		/// 
+		public IndexName ResultsIndexName { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlPutJob")]
+	public partial class PutJobDescriptor where T : class
+	{
+		IAnalysisConfig IPutJobRequest.AnalysisConfig { get; set; }
+		IAnalysisLimits IPutJobRequest.AnalysisLimits { get; set; }
+		IDataDescription IPutJobRequest.DataDescription { get; set; }
+		string IPutJobRequest.Description { get; set; }
+		IModelPlotConfig IPutJobRequest.ModelPlotConfig { get; set; }
+		long? IPutJobRequest.ModelSnapshotRetentionDays { get; set; }
+		IndexName IPutJobRequest.ResultsIndexName { get; set; }
+
+		/// 
+		public PutJobDescriptor AnalysisConfig(Func, IAnalysisConfig> selector) =>
+			Assign(a => a.AnalysisConfig = selector?.Invoke(new AnalysisConfigDescriptor()));
+
+		/// 
+		public PutJobDescriptor AnalysisLimits(Func selector) =>
+			Assign(a => a.AnalysisLimits = selector?.Invoke(new AnalysisLimitsDescriptor()));
+
+		/// 
+		public PutJobDescriptor DataDescription(Func, IDataDescription> selector) =>
+			Assign(a => a.DataDescription = selector.InvokeOrDefault(new DataDescriptionDescriptor()));
+
+		/// 
+		public PutJobDescriptor Description(string description) => Assign(a => a.Description = description);
+
+		/// 
+		public PutJobDescriptor ModelPlot(Func, IModelPlotConfig> selector) =>
+			Assign(a => a.ModelPlotConfig = selector?.Invoke(new ModelPlotConfigDescriptor()));
+
+		/// 
+		public PutJobDescriptor ModelSnapshotRetentionDays(long modelSnapshotRetentionDays) =>
+			Assign(a => a.ModelSnapshotRetentionDays = modelSnapshotRetentionDays);
+
+		/// 
+		public PutJobDescriptor ResultsIndexName(IndexName indexName) =>
+			Assign(a => a.ResultsIndexName = indexName);
+
+		/// 
+		public PutJobDescriptor ResultsIndexName() =>
+			Assign(a => a.ResultsIndexName = typeof(TIndex));
+	}
+
+	[JsonConverter(typeof(StringEnumConverter))]
+	public enum ExcludeFrequent
+	{
+		[EnumMember(Value = "all")]
+		All,
+		[EnumMember(Value = "none")]
+		None,
+		[EnumMember(Value = "by")]
+		By,
+		[EnumMember(Value = "over")]
+		Over
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/PutJob/PutJobResponse.cs b/src/Nest/XPack/MachineLearning/PutJob/PutJobResponse.cs
new file mode 100644
index 00000000000..95a50e21be6
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/PutJob/PutJobResponse.cs
@@ -0,0 +1,154 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IPutJobResponse : IResponse
+	{
+		/// 
+		/// The unique identifier for the job
+		/// 
+		[JsonProperty("job_id")]
+		string JobId { get; }
+
+		/// 
+		/// The job type
+		/// 
+		/// 
+		/// Reserved for future use
+		/// 
+		[JsonProperty("job_type")]
+		string JobType { get; }
+
+		/// 
+		/// An optional description of the job
+		/// 
+		[JsonProperty("description")]
+		string Description { get; }
+
+		/// 
+		/// The time the job was created.
+		/// 
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		[JsonProperty("create_time")]
+		DateTimeOffset CreateTime { get; }
+
+		/// 
+		/// The analysis configuration, which specifies how to analyze the data.
+		/// 
+		[JsonProperty("analysis_config")]
+		IAnalysisConfig AnalysisConfig { get; }
+
+		/// 
+		/// Optionally specifies runtime limits for the job.
+		/// 
+		[JsonProperty("analysis_limits")]
+		IAnalysisLimits AnalysisLimits { get; }
+
+		/// 
+		/// Advanced configuration option. The time between each periodic persistence of the model.
+		/// The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting
+		/// at exactly the same time. The smallest allowed value is 1 hour.
+		/// 
+		/// 
+		/// For very large models (several GB), persistence could take 10-20 minutes,
+		/// so do not set the background_persist_interval value too low.
+		/// 
+		[JsonProperty("background_persist_interval")]
+		Time BackgroundPersistInterval { get; }
+
+		/// 
+		/// Describes the format of the input data. This object is required, but it can be empty
+		/// 
+		[JsonProperty("data_description")]
+		IDataDescription DataDescription { get; }
+
+		/// 
+		/// The time in days that model snapshots are retained for the job.
+		/// Older snapshots are deleted. The default value is 1 day.
+		/// 
+		[JsonProperty("model_snapshot_retention_days")]
+		long? ModelSnapshotRetentionDays { get; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the model snapshot.
+		/// 
+		[JsonProperty("model_snapshot_id")]
+		string ModelSnapshotId { get; }
+
+		/// 
+		/// The name of the index in which to store the machine learning results.
+		/// The default value is shared, which corresponds to the index name .ml-anomalies-shared.
+		/// 
+		[JsonProperty("results_index_name")]
+		string ResultsIndexName { get; }
+
+		/// 
+		/// This advanced configuration option stores model information along with the results.
+		/// This adds overhead to the performance of the system and is not feasible for jobs with many entities
+		/// 
+		[JsonProperty("model_plot")]
+		IModelPlotConfig ModelPlotConfig { get; }
+
+		/// 
+		/// Advanced configuration option. The period over which adjustments to the score are applied, as new data
+		/// is seen. The default value is the longer of 30 days or 100 bucket_spans.
+		/// 
+		[JsonProperty("renormalization_window_days")]
+		long? RenormalizationWindowDays { get;}
+
+		/// 
+		/// Advanced configuration option. The number of days for which job results are retained.
+		/// Once per day at 00:30 (server time), results older than this period are deleted from Elasticsearch.
+		/// The default value is null, which means results are retained.
+		/// 
+		[JsonProperty("results_retention_days")]
+		long? ResultsRetentionDays { get; }
+	}
+
+	/// 
+	public class PutJobResponse : ResponseBase, IPutJobResponse
+	{
+		/// 
+		public string JobId { get; internal set; }
+
+		/// 
+		public string JobType { get; internal set; }
+
+		/// 
+		public string Description { get; internal set; }
+
+		/// 
+		public DateTimeOffset CreateTime { get; internal set; }
+
+		/// 
+		public IAnalysisConfig AnalysisConfig { get; internal set; }
+
+		/// 
+		public IAnalysisLimits AnalysisLimits { get; internal set; }
+
+		/// 
+		public Time BackgroundPersistInterval { get; internal set; }
+
+		/// 
+		public IDataDescription DataDescription { get; internal set; }
+
+		/// 
+		public long? ModelSnapshotRetentionDays { get; internal set; }
+
+		/// 
+		public string ModelSnapshotId { get; internal set; }
+
+		/// 
+		public string ResultsIndexName { get; internal set; }
+
+		/// 
+		public IModelPlotConfig ModelPlotConfig { get; internal set; }
+
+		/// 
+		public long? RenormalizationWindowDays { get; internal set; }
+
+		/// 
+		public long? ResultsRetentionDays { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/RevertModelSnapshot/ElasticClient-RevertModelSnapshot.cs b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/ElasticClient-RevertModelSnapshot.cs
new file mode 100644
index 00000000000..36d3b2d8d2c
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/ElasticClient-RevertModelSnapshot.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Reverts a specific snapshot for a Machine Learning job
+		/// 
+		IRevertModelSnapshotResponse RevertModelSnapshot(Id jobId, Id snapshotId, Func selector = null);
+
+		/// 
+		IRevertModelSnapshotResponse RevertModelSnapshot(IRevertModelSnapshotRequest request);
+
+		/// 
+		Task RevertModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task RevertModelSnapshotAsync(IRevertModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IRevertModelSnapshotResponse RevertModelSnapshot(Id jobId, Id snapshotId, Func selector = null) =>
+			this.RevertModelSnapshot(selector.InvokeOrDefault(new RevertModelSnapshotDescriptor(jobId, snapshotId)));
+
+		/// 
+		public IRevertModelSnapshotResponse RevertModelSnapshot(IRevertModelSnapshotRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlRevertModelSnapshotDispatch
+			);
+
+		/// 
+		public Task RevertModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.RevertModelSnapshotAsync(selector.InvokeOrDefault(new RevertModelSnapshotDescriptor(jobId, snapshotId)), cancellationToken);
+
+		/// 
+		public Task RevertModelSnapshotAsync(IRevertModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlRevertModelSnapshotDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotRequest.cs b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotRequest.cs
new file mode 100644
index 00000000000..43e0fa8f95c
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotRequest.cs
@@ -0,0 +1,36 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to revert a specific snapshot for a Machine Learning job
+	/// 
+	public partial interface IRevertModelSnapshotRequest
+	{
+		/// 
+		/// If true, deletes the results in the time period between the latest results and the time of
+		/// the reverted snapshot.
+		/// It also resets the model to accept records for this time period. The default value is false.
+		/// 
+		[JsonProperty("delete_intervening_results")]
+		bool? DeleteInterveningResults { get; set; }
+	}
+
+	/// 
+	public partial class RevertModelSnapshotRequest
+	{
+		/// 
+		public bool? DeleteInterveningResults { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlRevertModelSnapshot")]
+	public partial class RevertModelSnapshotDescriptor
+	{
+		bool? IRevertModelSnapshotRequest.DeleteInterveningResults { get; set; }
+
+		/// 
+		public RevertModelSnapshotDescriptor DeleteInterveningResults(bool deleteInterveningResults = true) =>
+			Assign(a => a.DeleteInterveningResults = deleteInterveningResults);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotResponse.cs b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotResponse.cs
new file mode 100644
index 00000000000..71d8ccb23ae
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/RevertModelSnapshot/RevertModelSnapshotResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IRevertModelSnapshotResponse : IAcknowledgedResponse
+	{
+		[JsonProperty("model")]
+		ModelSnapshot Model { get; }
+	}
+
+	public class RevertModelSnapshotResponse : AcknowledgedResponseBase, IRevertModelSnapshotResponse
+	{
+		public ModelSnapshot Model { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StartDatafeed/ElasticClient-StartDatafeed.cs b/src/Nest/XPack/MachineLearning/StartDatafeed/ElasticClient-StartDatafeed.cs
new file mode 100644
index 00000000000..f03ce9e8ebe
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StartDatafeed/ElasticClient-StartDatafeed.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Start a Machine Learning datafeed.
+		/// A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped multiple times throughout its lifecycle.
+		/// 
+		IStartDatafeedResponse StartDatafeed(Id datafeedId, Func selector = null);
+
+		/// 
+		IStartDatafeedResponse StartDatafeed(IStartDatafeedRequest request);
+
+		/// 
+		Task StartDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task StartDatafeedAsync(IStartDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IStartDatafeedResponse StartDatafeed(Id datafeedId, Func selector = null) =>
+			this.StartDatafeed(selector.InvokeOrDefault(new StartDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IStartDatafeedResponse StartDatafeed(IStartDatafeedRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlStartDatafeedDispatch
+			);
+
+		/// 
+		public Task StartDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.StartDatafeedAsync(selector.InvokeOrDefault(new StartDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task StartDatafeedAsync(IStartDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlStartDatafeedDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedRequest.cs
new file mode 100644
index 00000000000..35f5d608cc7
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedRequest.cs
@@ -0,0 +1,59 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public partial interface IStartDatafeedRequest
+	{
+		/// 
+		/// Controls the amount of time to wait until a datafeed starts.
+		/// 
+		[JsonProperty("timeout")]
+		Time Timeout { get; set; }
+
+		/// 
+		/// The time that the datafeed should begin. This value is inclusive.
+		/// 
+		[JsonProperty("start")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? Start { get; set; }
+
+		/// 
+		/// The time that the datafeed should end. This value is exclusive.
+		/// 
+		[JsonProperty("end")]
+		[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))]
+		DateTimeOffset? End { get; set; }
+	}
+
+	/// 
+	public partial class StartDatafeedRequest
+	{
+		/// 
+		public Time Timeout { get; set; }
+
+		/// 
+		public DateTimeOffset? Start { get; set; }
+
+		/// 
+		public DateTimeOffset? End { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlStartDatafeed")]
+	public partial class StartDatafeedDescriptor
+	{
+		Time IStartDatafeedRequest.Timeout { get; set; }
+		DateTimeOffset? IStartDatafeedRequest.Start { get; set; }
+		DateTimeOffset? IStartDatafeedRequest.End { get; set; }
+
+		/// 
+		public StartDatafeedDescriptor Timeout(Time timeout) => Assign(a => a.Timeout = timeout);
+
+		/// 
+		public StartDatafeedDescriptor Start(DateTimeOffset start) => Assign(a => a.Start = start);
+
+		/// 
+		public StartDatafeedDescriptor End(DateTimeOffset end) => Assign(a => a.End = end);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedResponse.cs
new file mode 100644
index 00000000000..d7d9cb4c160
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IStartDatafeedResponse : IResponse
+	{
+		bool Started { get; }
+	}
+
+	public class StartDatafeedResponse : ResponseBase, IStartDatafeedResponse
+	{
+		[JsonProperty("started")]
+		public bool Started { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StopDatafeed/ElasticClient-StopDatafeed.cs b/src/Nest/XPack/MachineLearning/StopDatafeed/ElasticClient-StopDatafeed.cs
new file mode 100644
index 00000000000..b94a58af433
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StopDatafeed/ElasticClient-StopDatafeed.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Stop a Machine Learning data feed.
+		/// A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped multiple times throughout its lifecycle.
+		/// 
+		IStopDatafeedResponse StopDatafeed(Id datafeedId, Func selector = null);
+
+		/// 
+		IStopDatafeedResponse StopDatafeed(IStopDatafeedRequest request);
+
+		/// 
+		Task StopDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task StopDatafeedAsync(IStopDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IStopDatafeedResponse StopDatafeed(Id datafeedId, Func selector = null) =>
+			this.StopDatafeed(selector.InvokeOrDefault(new StopDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IStopDatafeedResponse StopDatafeed(IStopDatafeedRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				(p, d) => this.LowLevelDispatch.XpackMlStopDatafeedDispatch(p)
+			);
+
+		/// 
+		public Task StopDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.StopDatafeedAsync(selector.InvokeOrDefault(new StopDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task StopDatafeedAsync(IStopDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				(p, d, c) => this.LowLevelDispatch.XpackMlStopDatafeedDispatchAsync(p, c)
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedRequest.cs
new file mode 100644
index 00000000000..502af6a2f1f
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedRequest.cs
@@ -0,0 +1,44 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public partial interface IStopDatafeedRequest
+	{
+		/// 
+		/// Controls the amount of time to wait until a datafeed stops. 
+		/// 
+		[JsonProperty("timeout")]
+		Time Timeout { get; set; }
+
+		/// 
+		/// If true, the datafeed is stopped forcefully.
+		/// 
+		[JsonProperty("force")]
+		bool Force { get; set; }
+	}
+
+	/// 
+	public partial class StopDatafeedRequest
+	{
+		/// 
+		public Time Timeout { get; set; }
+
+		/// 
+		public bool Force { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlStopDatafeed")]
+	public partial class StopDatafeedDescriptor
+	{
+		Time IStopDatafeedRequest.Timeout { get; set; }
+		bool IStopDatafeedRequest.Force { get; set; }
+
+		/// 
+		public StopDatafeedDescriptor Timeout(Time timeout) => Assign(a => a.Timeout = timeout);
+
+		/// 
+		public StopDatafeedDescriptor Force(bool force) => Assign(a => a.Force = force);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedResponse.cs
new file mode 100644
index 00000000000..6e30cdc8b33
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/StopDatafeed/StopDatafeedResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IStopDatafeedResponse : IResponse
+	{
+		bool Stopped { get; }
+	}
+
+	public class StopDatafeedResponse : ResponseBase, IStopDatafeedResponse
+	{
+		[JsonProperty("stopped")]
+		public bool Stopped { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateDataFeed/ElasticClient-UpdateDatafeed.cs b/src/Nest/XPack/MachineLearning/UpdateDataFeed/ElasticClient-UpdateDatafeed.cs
new file mode 100644
index 00000000000..e296d1e260a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateDataFeed/ElasticClient-UpdateDatafeed.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Update a Machine Learning datafeed.
+		/// 
+		IUpdateDatafeedResponse UpdateDatafeed(Id datafeedId, Func, IUpdateDatafeedRequest> selector = null) where T : class;
+
+		/// 
+		IUpdateDatafeedResponse UpdateDatafeed(IUpdateDatafeedRequest request);
+
+		/// 
+		Task UpdateDatafeedAsync(Id datafeedId, Func, IUpdateDatafeedRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task UpdateDatafeedAsync(IUpdateDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IUpdateDatafeedResponse UpdateDatafeed(Id datafeedId, Func, IUpdateDatafeedRequest> selector = null) where T : class =>
+			this.UpdateDatafeed(selector.InvokeOrDefault(new UpdateDatafeedDescriptor(datafeedId)));
+
+		/// 
+		public IUpdateDatafeedResponse UpdateDatafeed(IUpdateDatafeedRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlUpdateDatafeedDispatch
+			);
+
+		/// 
+		public Task UpdateDatafeedAsync(Id datafeedId, Func, IUpdateDatafeedRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class =>
+			this.UpdateDatafeedAsync(selector.InvokeOrDefault(new UpdateDatafeedDescriptor(datafeedId)), cancellationToken);
+
+		/// 
+		public Task UpdateDatafeedAsync(IUpdateDatafeedRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlUpdateDatafeedDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedRequest.cs b/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedRequest.cs
new file mode 100644
index 00000000000..2f3edc68c9b
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedRequest.cs
@@ -0,0 +1,169 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Updates a datafeed for a Machine Learning job
+	/// 
+	public partial interface IUpdateDatafeedRequest
+	{
+		/// 
+		/// If set, the datafeed performs aggregation searches
+		/// 
+		[JsonProperty("aggregations")]
+		AggregationDictionary Aggregations { get; set; }
+
+		/// 
+		/// Specifies how data searches are split into time chunks.
+		/// 
+		[JsonProperty("chunking_config")]
+		IChunkingConfig ChunkingConfig { get; set; }
+
+		/// 
+		/// The interval at which scheduled queries are made while the datafeed runs in real time.
+		/// The default value is either the bucket span for short bucket spans, or, for longer bucket spans,
+		/// a sensible fraction of the bucket span.
+		/// 
+		[JsonProperty("frequency")]
+		Time Frequency { get; set; }
+
+		///A list of index names to search within. Wildcards are supported
+		[JsonProperty("indices")]
+		[JsonConverter(typeof(IndicesJsonConverter))]
+		Indices Indices { get; set; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the job.
+		/// 
+		[JsonProperty("job_id")]
+		Id JobId { get; set; }
+
+		/// 
+		/// Describe the query to perform using a query descriptor lambda
+		/// 
+		[JsonProperty("query")]
+		QueryContainer Query { get; set; }
+
+		/// 
+		/// The number of seconds behind real time that data is queried.
+		/// For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m.,
+		/// set this property to 120 seconds. The default value is 60s.
+		/// 
+		[JsonProperty("query_delay")]
+		Time QueryDelay { get; set; }
+
+		/// 
+		/// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. T
+		/// The detector configuration in a job can contain functions that use these script fields.
+		/// 
+		[JsonProperty("script_fields")]
+		IScriptFields ScriptFields { get; set; }
+
+		/// 
+		/// The size parameter that is used in Elasticsearch searches
+		/// 
+		[JsonProperty("scroll_size")]
+		int? ScrollSize { get; set; }
+
+		///A list of types to search for within the specified indices
+		[JsonProperty("types")]
+		[JsonConverter(typeof(TypesJsonConverter))]
+		Types Types { get; set; }
+	}
+
+	/// 
+	public partial class UpdateDatafeedRequest
+	{
+		/// 
+		public AggregationDictionary Aggregations { get; set; }
+
+		/// 
+		public IChunkingConfig ChunkingConfig { get; set; }
+
+		/// 
+		public Time Frequency { get; set; }
+
+		/// 
+		public Indices Indices { get; set; }
+
+		/// 
+		public Id JobId { get; set; }
+
+		/// 
+		public QueryContainer Query { get; set; }
+
+		/// 
+		public Time QueryDelay { get; set; }
+
+		/// 
+		public IScriptFields ScriptFields { get; set; }
+
+		/// 
+		public int? ScrollSize { get; set; }
+
+		/// 
+		public Types Types { get; set; }
+	}
+
+	[DescriptorFor("XpackMlUpdateDatafeed")]
+	public partial class UpdateDatafeedDescriptor where T : class
+	{
+		AggregationDictionary IUpdateDatafeedRequest.Aggregations { get; set; }
+		IChunkingConfig IUpdateDatafeedRequest.ChunkingConfig { get; set; }
+		Time IUpdateDatafeedRequest.Frequency { get; set; }
+		Indices IUpdateDatafeedRequest.Indices { get; set; }
+		Id IUpdateDatafeedRequest.JobId { get; set; }
+		QueryContainer IUpdateDatafeedRequest.Query { get; set; }
+		Time IUpdateDatafeedRequest.QueryDelay { get; set; }
+		IScriptFields IUpdateDatafeedRequest.ScriptFields { get; set; }
+		int? IUpdateDatafeedRequest.ScrollSize { get; set; }
+		Types IUpdateDatafeedRequest.Types { get; set; }
+
+		/// 
+		public UpdateDatafeedDescriptor Aggregations(Func, IAggregationContainer> aggregationsSelector) =>
+			Assign(a => a.Aggregations = aggregationsSelector(new AggregationContainerDescriptor())?.Aggregations);
+
+		/// 
+		public UpdateDatafeedDescriptor ChunkingConfig(Func selector) =>
+			Assign(a => a.ChunkingConfig = selector.InvokeOrDefault(new ChunkingConfigDescriptor()));
+
+		/// 
+		public UpdateDatafeedDescriptor Frequency(Time frequency) => Assign(a => a.Frequency = frequency);
+
+		/// 
+		public UpdateDatafeedDescriptor Indices(Indices indices) => Assign(a => a.Indices = indices);
+
+		///a shortcut into calling Indices(typeof(TOther))
+		public UpdateDatafeedDescriptor Indices() => Assign(a => a.Indices = typeof(TOther));
+
+		///A shortcut into calling Indices(Indices.All)
+		public UpdateDatafeedDescriptor AllIndices() => this.Indices(Nest.Indices.All);
+
+		/// 
+		public UpdateDatafeedDescriptor JobId(Id jobId) => Assign(a => a.JobId = jobId);
+
+		/// 
+		public UpdateDatafeedDescriptor Query(Func, QueryContainer> query) =>
+			Assign(a => a.Query = query?.Invoke(new QueryContainerDescriptor()));
+
+		/// 
+		public UpdateDatafeedDescriptor QueryDelay(Time queryDelay) => Assign(a => a.QueryDelay = queryDelay);
+
+		/// 
+		public UpdateDatafeedDescriptor ScriptFields(Func> selector) =>
+			Assign(a => a.ScriptFields = selector?.Invoke(new ScriptFieldsDescriptor())?.Value);
+
+		/// 
+		public UpdateDatafeedDescriptor ScrollSize(int scrollSize) => Assign(a => a.ScrollSize = scrollSize);
+
+		/// 
+		public UpdateDatafeedDescriptor Types(Types types) => Assign(a => a.Types = types);
+
+		///a shortcut into calling Types(typeof(TOther))
+		public UpdateDatafeedDescriptor Types() => Assign(a => a.Types = typeof(TOther));
+
+		///a shortcut into calling Types(Types.All)
+		public UpdateDatafeedDescriptor AllTypes() => this.Types(Nest.Types.All);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedResponse.cs b/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedResponse.cs
new file mode 100644
index 00000000000..bfe679d1483
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateDataFeed/UpdateDatafeedResponse.cs
@@ -0,0 +1,94 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// The response from updating a datafeed
+	/// 
+	public partial interface IUpdateDatafeedResponse : IResponse
+	{
+		/// 
+		/// The datafeed id
+		/// 
+		[JsonProperty("datafeed_id")]
+		string DatafeedId { get; }
+
+		/// 
+		/// The aggregation searches to perform for the datafeed
+		/// 
+		[JsonProperty("aggregations")]
+		AggregationDictionary Aggregations { get; }
+
+		/// 
+		/// Specifies how data searches are split into time chunks.
+		/// 
+		[JsonProperty("chunking_config")]
+		IChunkingConfig ChunkingConfig { get; }
+
+		/// 
+		/// The interval at which scheduled queries are made while the datafeed runs in real time.
+		/// The default value is either the bucket span for short bucket spans, or, for longer bucket spans,
+		/// a sensible fraction of the bucket span.
+		/// 
+		[JsonProperty("frequency")]
+		Time Frequency { get; }
+
+		///A list of index names to search within. Wildcards are supported
+		[JsonProperty("indices")]
+		[JsonConverter(typeof(IndicesJsonConverter))]
+		Indices Indices { get; }
+
+		/// 
+		/// A numerical character string that uniquely identifies the job.
+		/// 
+		[JsonProperty("job_id")]
+		string JobId { get;  }
+
+		/// 
+		/// Describe the query to perform using a query descriptor lambda
+		/// 
+		[JsonProperty("query")]
+		QueryContainer Query { get; }
+
+		/// 
+		/// The number of seconds behind real time that data is queried.
+		/// For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m.,
+		/// set this property to 120 seconds. The default value is 60s.
+		/// 
+		[JsonProperty("query_delay")]
+		Time QueryDelay { get; }
+
+		/// 
+		/// Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. T
+		/// the detector configuration in a job can contain functions that use these script fields.
+		/// 
+		[JsonProperty("script_fields")]
+		IScriptFields ScriptFields { get; }
+
+		/// 
+		/// The size parameter that is used in Elasticsearch searches
+		/// 
+		[JsonProperty("scroll_size")]
+		int? ScrollSize { get; }
+
+		///A list of types to search for within the specified indices
+		[JsonProperty("types")]
+		[JsonConverter(typeof(TypesJsonConverter))]
+		Types Types { get;  }
+	}
+
+	public class UpdateDatafeedResponse : ResponseBase, IUpdateDatafeedResponse
+	{
+		public string DatafeedId { get; internal set; }
+		public AggregationDictionary Aggregations { get; internal set; }
+		public IChunkingConfig ChunkingConfig { get; internal set; }
+		public Time Frequency { get; internal set; }
+		public Indices Indices { get; internal set; }
+		public string JobId { get; internal set; }
+		public QueryContainer Query { get; internal set; }
+		public Time QueryDelay { get; internal set; }
+		public IScriptFields ScriptFields { get; internal set; }
+		public int? ScrollSize { get; internal set; }
+		public Types Types { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateJob/ElasticClient-UpdateJob.cs b/src/Nest/XPack/MachineLearning/UpdateJob/ElasticClient-UpdateJob.cs
new file mode 100644
index 00000000000..3a264fc49ea
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateJob/ElasticClient-UpdateJob.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Updates a Machine Learning job.
+		/// 
+		IUpdateJobResponse UpdateJob(Id jobId, Func, IUpdateJobRequest> selector = null) where T : class;
+
+		/// 
+		IUpdateJobResponse UpdateJob(IUpdateJobRequest request);
+
+		/// 
+		Task UpdateJobAsync(Id jobId, Func, IUpdateJobRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task UpdateJobAsync(IUpdateJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IUpdateJobResponse UpdateJob(Id jobId, Func, IUpdateJobRequest> selector = null) where T : class =>
+			this.UpdateJob(selector.InvokeOrDefault(new UpdateJobDescriptor(jobId)));
+
+		/// 
+		public IUpdateJobResponse UpdateJob(IUpdateJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlUpdateJobDispatch
+			);
+
+		/// 
+		public Task UpdateJobAsync(Id jobId, Func, IUpdateJobRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class =>
+			this.UpdateJobAsync(selector.InvokeOrDefault(new UpdateJobDescriptor(jobId)), cancellationToken);
+
+		/// 
+		public Task UpdateJobAsync(IUpdateJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlUpdateJobDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs
new file mode 100644
index 00000000000..f0be271a5a1
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs
@@ -0,0 +1,122 @@
+using System;
+using Newtonsoft.Json;
+using System.Collections.Generic;
+
+namespace Nest
+{
+	/// 
+	/// Update a Machine Learning Job
+	/// 
+	public partial interface IUpdateJobRequest
+	{
+		/// 
+		/// Optionally specifies runtime limits for the job.
+		/// Requires a restart.
+		/// 
+		[JsonProperty("analysis_limits")]
+		IAnalysisMemoryLimit AnalysisLimits { get; set; }
+
+		/// 
+		/// The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours,
+		/// which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour.
+		/// Requires a restart.
+		/// 
+		[JsonProperty("background_persist_interval")]
+		Time BackgroundPersistInterval { get; set; }
+
+		/// 
+		/// Contains custom meta data about the job.
+		/// 
+		[JsonProperty("custom_settings")]
+		[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
+		Dictionary CustomSettings { get; set; }
+
+		/// 
+		/// An optional description of the job
+		/// 
+		[JsonProperty("description")]
+		string Description { get; set; }
+
+		/// 
+		/// This advanced configuration option stores model information along with the results.
+		/// This adds overhead to the performance of the system and is not feasible for jobs with many entities
+		/// 
+		[JsonProperty("model_plot_config")]
+		IModelPlotConfigEnabled ModelPlotConfig { get; set; }
+
+		/// 
+		/// The time in days that model snapshots are retained for the job.
+		/// Older snapshots are deleted. The default value is 1 day.
+		/// 
+		[JsonProperty("model_snapshot_retention_days")]
+		long? ModelSnapshotRetentionDays { get; set; }
+
+		/// 
+		/// The period over which adjustments to the score are applied, as new data is seen.
+		/// 
+		[JsonProperty("renormalization_window_days")]
+		long? RenormalizationWindowDays { get; set; }
+
+		/// 
+		/// The number of days for which job results are retained. Once per day at 00:30 (server time),
+		/// results older than this period are deleted from Elasticsearch. The default value is null,
+		/// which means results are retained.
+		/// 
+		[JsonProperty("results_retention_days")]
+		long? ResultsRetentionDays { get; set; }
+	}
+
+	/// 
+	public partial class UpdateJobRequest
+	{
+		public IAnalysisMemoryLimit AnalysisLimits { get; set; }
+		public Time BackgroundPersistInterval { get; set; }
+		public Dictionary CustomSettings { get; set; }
+		public string Description { get; set; }
+		public IModelPlotConfigEnabled ModelPlotConfig { get; set; }
+		public long? ModelSnapshotRetentionDays { get; set; }
+		public long? RenormalizationWindowDays { get; set; }
+		public long? ResultsRetentionDays { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlUpdateJob")]
+	public partial class UpdateJobDescriptor where T : class
+	{
+		IAnalysisMemoryLimit IUpdateJobRequest.AnalysisLimits { get; set; }
+		Time IUpdateJobRequest.BackgroundPersistInterval { get; set; }
+		Dictionary IUpdateJobRequest.CustomSettings { get; set; }
+		string IUpdateJobRequest.Description { get; set; }
+		IModelPlotConfigEnabled IUpdateJobRequest.ModelPlotConfig { get; set; }
+		long? IUpdateJobRequest.ModelSnapshotRetentionDays { get; set; }
+		long? IUpdateJobRequest.RenormalizationWindowDays { get; set; }
+		long? IUpdateJobRequest.ResultsRetentionDays { get; set; }
+
+		/// 
+		public UpdateJobDescriptor AnalysisLimits(Func selector) =>
+			Assign(a => a.AnalysisLimits = selector?.Invoke(new AnalysisMemoryLimitDescriptor()));
+
+		/// 
+		public UpdateJobDescriptor BackgroundPersistInterval(Time backgroundPersistInterval) => Assign(a => a.BackgroundPersistInterval = backgroundPersistInterval);
+
+		/// 
+		public UpdateJobDescriptor CustomSettings(Func, FluentDictionary> customSettingsDictionary) =>
+			Assign(a => a.CustomSettings = customSettingsDictionary(new FluentDictionary()));
+
+		/// 
+		public UpdateJobDescriptor Description(string description) => Assign(a => a.Description = description);
+
+		/// 
+		public UpdateJobDescriptor ModelPlot(Func, IModelPlotConfigEnabled> selector) =>
+			Assign(a => a.ModelPlotConfig = selector?.Invoke(new ModelPlotConfigEnabledDescriptor()));
+
+		/// 
+		public UpdateJobDescriptor ModelSnapshotRetentionDays(long modelSnapshotRetentionDays) => Assign(a => a.ModelSnapshotRetentionDays = modelSnapshotRetentionDays);
+
+		/// 
+		public UpdateJobDescriptor RenormalizationWindowDays(long renormalizationWindowDays) => Assign(a => a.RenormalizationWindowDays = renormalizationWindowDays);
+
+		/// 
+		public UpdateJobDescriptor ResultsRetentionDays(long resultsRetentionDays) => Assign(a => a.ResultsRetentionDays = resultsRetentionDays);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobResponse.cs b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobResponse.cs
new file mode 100644
index 00000000000..3df45bf28cf
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobResponse.cs
@@ -0,0 +1,10 @@
+namespace Nest
+{
+	public interface IUpdateJobResponse : IResponse
+	{
+	}
+
+	public class UpdateJobResponse : ResponseBase, IUpdateJobResponse
+	{
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/ElasticClient-UpdateModelSnapshot.cs b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/ElasticClient-UpdateModelSnapshot.cs
new file mode 100644
index 00000000000..5ce7a4a83bb
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/ElasticClient-UpdateModelSnapshot.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Updates a Machine Learning model snapshot.
+		/// 
+		IUpdateModelSnapshotResponse UpdateModelSnapshot(Id jobId, Id snapshotId, Func selector = null);
+
+		/// 
+		IUpdateModelSnapshotResponse UpdateModelSnapshot(IUpdateModelSnapshotRequest request);
+
+		/// 
+		Task UpdateModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken));
+
+		/// 
+		Task UpdateModelSnapshotAsync(IUpdateModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IUpdateModelSnapshotResponse UpdateModelSnapshot(Id jobId, Id snapshotId, Func selector = null) =>
+			this.UpdateModelSnapshot(selector.InvokeOrDefault(new UpdateModelSnapshotDescriptor(jobId, snapshotId)));
+
+		/// 
+		public IUpdateModelSnapshotResponse UpdateModelSnapshot(IUpdateModelSnapshotRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlUpdateModelSnapshotDispatch
+			);
+
+		/// 
+		public Task UpdateModelSnapshotAsync(Id jobId, Id snapshotId, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.UpdateModelSnapshotAsync(selector.InvokeOrDefault(new UpdateModelSnapshotDescriptor(jobId, snapshotId)), cancellationToken);
+
+		/// 
+		public Task UpdateModelSnapshotAsync(IUpdateModelSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlUpdateModelSnapshotDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotRequest.cs b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotRequest.cs
new file mode 100644
index 00000000000..53e476cb3ab
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotRequest.cs
@@ -0,0 +1,47 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// A request to update a Machine Learning model snapshot.
+	/// 
+	public partial interface IUpdateModelSnapshotRequest
+	{
+		/// 
+		/// An optional description of the model snapshot. For example, "Before black friday".
+		/// 
+		[JsonProperty("description")]
+		string Description { get; set; }
+
+		/// 
+		/// If true, this snapshot will not be deleted during automatic cleanup of snapshots older than model_snapshot_retention_days.
+		/// Note that this snapshot will still be deleted when the job is deleted.
+		/// 
+		[JsonProperty("retain")]
+		bool? Retain { get; set; }
+	}
+
+	/// 
+	public partial class UpdateModelSnapshotRequest
+	{
+		/// 
+		public string Description { get; set; }
+
+		/// 
+		public bool? Retain { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlUpdateModelSnapshot")]
+	public partial class UpdateModelSnapshotDescriptor
+	{
+		string IUpdateModelSnapshotRequest.Description { get; set; }
+		bool? IUpdateModelSnapshotRequest.Retain { get; set; }
+
+		/// 
+		public UpdateModelSnapshotDescriptor Description(string description) => Assign(a => a.Description = description);
+
+		/// 
+		public UpdateModelSnapshotDescriptor Retain(bool retain = true) => Assign(a => a.Retain = retain);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotResponse.cs b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotResponse.cs
new file mode 100644
index 00000000000..87bf4c538e4
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/UpdateModelSnapshot/UpdateModelSnapshotResponse.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IUpdateModelSnapshotResponse : IAcknowledgedResponse
+	{
+		[JsonProperty("model")]
+		ModelSnapshot Model { get; }
+	}
+
+	public class UpdateModelSnapshotResponse : AcknowledgedResponseBase, IUpdateModelSnapshotResponse
+	{
+		public ModelSnapshot Model { get; internal set; }
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateDetector/ElasticClient-ValidateDetector.cs b/src/Nest/XPack/MachineLearning/ValidateDetector/ElasticClient-ValidateDetector.cs
new file mode 100644
index 00000000000..c98fa873fe6
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateDetector/ElasticClient-ValidateDetector.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Validates a detector for a Machine Learning job
+		/// 
+		IValidateDetectorResponse ValidateDetector(Func, IValidateDetectorRequest> selector) where T : class;
+
+		/// 
+		IValidateDetectorResponse ValidateDetector(IValidateDetectorRequest request);
+
+		/// 
+		Task ValidateDetectorAsync(Func, IValidateDetectorRequest> selector, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task ValidateDetectorAsync(IValidateDetectorRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IValidateDetectorResponse ValidateDetector(Func, IValidateDetectorRequest> selector) where T : class =>
+			this.ValidateDetector(selector.InvokeOrDefault(new ValidateDetectorDescriptor()));
+
+		/// 
+		public IValidateDetectorResponse ValidateDetector(IValidateDetectorRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlValidateDetectorDispatch
+			);
+
+		/// 
+		public Task ValidateDetectorAsync(Func, IValidateDetectorRequest> selector, CancellationToken cancellationToken = default(CancellationToken)) where T : class =>
+			this.ValidateDetectorAsync(selector.InvokeOrDefault(new ValidateDetectorDescriptor()), cancellationToken);
+
+		/// 
+		public Task ValidateDetectorAsync(IValidateDetectorRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlValidateDetectorDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorRequest.cs b/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorRequest.cs
new file mode 100644
index 00000000000..5b8fdb9fe5a
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorRequest.cs
@@ -0,0 +1,150 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	[JsonConverter(typeof(ValidateDetectorRequestConverter))]
+	public partial interface IValidateDetectorRequest
+	{
+		[JsonIgnore]
+		IDetector Detector { get; set; }
+	}
+
+	/// 
+	public partial class ValidateDetectorRequest
+	{
+		/// 
+		public IDetector Detector { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlValidateDetector")]
+	public partial class ValidateDetectorDescriptor where T : class
+	{
+		IDetector IValidateDetectorRequest.Detector { get; set; }
+
+		public ValidateDetectorDescriptor Count(Func, ICountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.Count)));
+
+		public ValidateDetectorDescriptor HighCount(Func, ICountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.HighCount)));
+
+		public ValidateDetectorDescriptor LowCount(Func, ICountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new CountDetectorDescriptor(CountFunction.LowCount)));
+
+		public ValidateDetectorDescriptor NonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.NonZeroCount)));
+
+		public ValidateDetectorDescriptor HighNonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.HighNonZeroCount)));
+
+		public ValidateDetectorDescriptor LowNonZeroCount(Func, INonZeroCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonZeroCountDetectorDescriptor(NonZeroCountFunction.LowNonZeroCount)));
+
+		public ValidateDetectorDescriptor DistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.DistinctCount)));
+
+		public ValidateDetectorDescriptor HighDistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.HighDistinctCount)));
+
+		public ValidateDetectorDescriptor LowDistinctCount(Func, IDistinctCountDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new DistinctCountDetectorDescriptor(DistinctCountFunction.LowDistinctCount)));
+
+		public ValidateDetectorDescriptor InfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.InfoContent)));
+
+		public ValidateDetectorDescriptor HighInfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.HighInfoContent)));
+
+		public ValidateDetectorDescriptor LowInfoContent(Func, IInfoContentDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new InfoContentDetectorDescriptor(InfoContentFunction.LowInfoContent)));
+
+		public ValidateDetectorDescriptor Min(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Min)));
+
+		public ValidateDetectorDescriptor Max(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Max)));
+
+		public ValidateDetectorDescriptor Median(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Median)));
+
+		public ValidateDetectorDescriptor HighMedian(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighMedian)));
+
+		public ValidateDetectorDescriptor LowMedian(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowMedian)));
+
+		public ValidateDetectorDescriptor Mean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Mean)));
+
+		public ValidateDetectorDescriptor HighMean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighMean)));
+
+		public ValidateDetectorDescriptor LowMean(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowMean)));
+
+		public ValidateDetectorDescriptor Metric(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Metric)));
+
+		public ValidateDetectorDescriptor Varp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.Varp)));
+
+		public ValidateDetectorDescriptor HighVarp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.HighVarp)));
+
+		public ValidateDetectorDescriptor LowVarp(Func, IMetricDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new MetricDetectorDescriptor(MetricFunction.LowVarp)));
+
+		public ValidateDetectorDescriptor Rare(Func, IRareDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new RareDetectorDescriptor(RareFunction.Rare)));
+
+		public ValidateDetectorDescriptor FreqRare(Func, IRareDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new RareDetectorDescriptor(RareFunction.FreqRare)));
+
+		public ValidateDetectorDescriptor Sum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.Sum)));
+
+		public ValidateDetectorDescriptor HighSum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.HighSum)));
+
+		public ValidateDetectorDescriptor LowSum(Func, ISumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new SumDetectorDescriptor(SumFunction.LowSum)));
+
+		public ValidateDetectorDescriptor NonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.NonNullSum)));
+
+		public ValidateDetectorDescriptor HighNonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.HighNonNullSum)));
+
+		public ValidateDetectorDescriptor LowNonNullSum(Func, INonNullSumDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new NonNullSumDetectorDescriptor(NonNullSumFunction.LowNonNullSum)));
+
+		public ValidateDetectorDescriptor TimeOfDay(Func, ITimeDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new TimeDetectorDescriptor(TimeFunction.TimeOfDay)));
+
+		public ValidateDetectorDescriptor TimeOfWeek(Func, ITimeDetector> selector = null) =>
+			Assign(a => a.Detector = selector.InvokeOrDefault(new TimeDetectorDescriptor(TimeFunction.TimeOfWeek)));
+	}
+
+	internal class ValidateDetectorRequestConverter : JsonConverter
+	{
+		public override bool CanRead => false;
+
+		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+		{
+			var request = (IValidateDetectorRequest)value;
+			if (request == null)
+			{
+				writer.WriteNull();
+				return;
+			}
+
+			serializer.Serialize(writer, request.Detector);
+		}
+
+		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) =>
+			throw new NotSupportedException();
+
+		public override bool CanConvert(Type objectType) => true;
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorResponse.cs b/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorResponse.cs
new file mode 100644
index 00000000000..a81264f1253
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateDetector/ValidateDetectorResponse.cs
@@ -0,0 +1,8 @@
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	public interface IValidateDetectorResponse : IAcknowledgedResponse {}
+
+	public class ValidateDetectorResponse : AcknowledgedResponseBase, IValidateDetectorResponse {}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateJob/ElasticClient-ValidateJob.cs b/src/Nest/XPack/MachineLearning/ValidateJob/ElasticClient-ValidateJob.cs
new file mode 100644
index 00000000000..7709a18dd6c
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateJob/ElasticClient-ValidateJob.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Elasticsearch.Net;
+
+namespace Nest
+{
+	public partial interface IElasticClient
+	{
+		/// 
+		/// Validates a Machine Learning job
+		/// 
+		IValidateJobResponse ValidateJob(Func, IValidateJobRequest> selector) where T : class;
+
+		/// 
+		IValidateJobResponse ValidateJob(IValidateJobRequest request);
+
+		/// 
+		Task ValidateJobAsync(Func, IValidateJobRequest> selector, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
+
+		/// 
+		Task ValidateJobAsync(IValidateJobRequest request, CancellationToken cancellationToken = default(CancellationToken));
+	}
+
+	public partial class ElasticClient
+	{
+		/// 
+		public IValidateJobResponse ValidateJob(Func, IValidateJobRequest> selector) where T : class =>
+			this.ValidateJob(selector.InvokeOrDefault(new ValidateJobDescriptor()));
+
+		/// 
+		public IValidateJobResponse ValidateJob(IValidateJobRequest request) =>
+			this.Dispatcher.Dispatch(
+				request,
+				this.LowLevelDispatch.XpackMlValidateDispatch
+			);
+
+		/// 
+		public Task ValidateJobAsync(Func, IValidateJobRequest> selector, CancellationToken cancellationToken = default(CancellationToken))  where T : class =>
+			this.ValidateJobAsync(selector.InvokeOrDefault(new ValidateJobDescriptor()), cancellationToken);
+
+		/// 
+		public Task ValidateJobAsync(IValidateJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
+			this.Dispatcher.DispatchAsync(
+				request,
+				cancellationToken,
+				this.LowLevelDispatch.XpackMlValidateDispatchAsync
+			);
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobRequest.cs b/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobRequest.cs
new file mode 100644
index 00000000000..71fa95d56f0
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobRequest.cs
@@ -0,0 +1,114 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Nest
+{
+	/// 
+	/// Validates a Machine Learning Job
+	/// 
+	public partial interface IValidateJobRequest
+	{
+		/// 
+		/// The analysis configuration, which specifies how to analyze the data.
+		/// 
+		[JsonProperty("analysis_config")]
+		IAnalysisConfig AnalysisConfig { get; set; }
+
+		/// 
+		/// Optionally specifies runtime limits for the job.
+		/// 
+		[JsonProperty("analysis_limits")]
+		IAnalysisLimits AnalysisLimits { get; set; }
+
+		/// 
+		/// Describes the format of the input data. This object is required, but it can be empty
+		/// 
+		[JsonProperty("data_description")]
+		IDataDescription DataDescription { get; set; }
+
+		/// 
+		/// An optional description of the job
+		/// 
+		[JsonProperty("description")]
+		string Description { get; set; }
+
+		/// 
+		/// This advanced configuration option stores model information along with the results. T
+		/// his adds overhead to the performance of the system and is not feasible for jobs with many entities
+		/// 
+		[JsonProperty("model_plot")]
+		IModelPlotConfig ModelPlotConfig { get; set; }
+
+		/// 
+		/// The time in days that model snapshots are retained for the job.
+		/// Older snapshots are deleted. The default value is 1 day.
+		/// 
+		[JsonProperty("model_snapshot_retention_days")]
+		long? ModelSnapshotRetentionDays { get; set; }
+
+		/// 
+		/// The name of the index in which to store the machine learning results.
+		/// The default value is shared, which corresponds to the index name .ml-anomalies-shared.
+		/// 
+		[JsonProperty("results_index_name")]
+		IndexName ResultsIndexName { get; set; }
+	}
+
+	/// 
+	public partial class ValidateJobRequest
+	{
+		/// 
+		public IAnalysisConfig AnalysisConfig { get; set; }
+		/// 
+		public IAnalysisLimits AnalysisLimits { get; set; }
+		/// 
+		public IDataDescription DataDescription { get; set; }
+		/// 
+		public string Description { get; set; }
+		/// 
+		public IModelPlotConfig ModelPlotConfig { get; set; }
+		/// 
+		public long? ModelSnapshotRetentionDays { get; set; }
+		/// 
+		public IndexName ResultsIndexName { get; set; }
+	}
+
+	/// 
+	[DescriptorFor("XpackMlValidate")]
+	public partial class ValidateJobDescriptor where T : class
+	{
+		IAnalysisConfig IValidateJobRequest.AnalysisConfig { get; set; }
+		IAnalysisLimits IValidateJobRequest.AnalysisLimits { get; set; }
+		IDataDescription IValidateJobRequest.DataDescription { get; set; }
+		string IValidateJobRequest.Description { get; set; }
+		IModelPlotConfig IValidateJobRequest.ModelPlotConfig { get; set; }
+		long? IValidateJobRequest.ModelSnapshotRetentionDays { get; set; }
+		IndexName IValidateJobRequest.ResultsIndexName { get; set; }
+
+		/// 
+		public ValidateJobDescriptor AnalysisConfig(Func, IAnalysisConfig> selector) =>
+			Assign(a => a.AnalysisConfig = selector?.Invoke(new AnalysisConfigDescriptor()));
+
+		/// 
+		public ValidateJobDescriptor AnalysisLimits(Func selector) => Assign(a => a.AnalysisLimits = selector?.Invoke(new AnalysisLimitsDescriptor()));
+
+		/// 
+		public ValidateJobDescriptor DataDescription(Func, IDataDescription> selector) =>
+			Assign(a => a.DataDescription = selector.InvokeOrDefault(new DataDescriptionDescriptor()));
+
+		/// 
+		public ValidateJobDescriptor Description(string description) => Assign(a => a.Description = description);
+
+		/// 
+		public ValidateJobDescriptor ModelPlot(Func, IModelPlotConfig> selector) => Assign(a => a.ModelPlotConfig = selector?.Invoke(new ModelPlotConfigDescriptor()));
+
+		/// 
+		public ValidateJobDescriptor ModelSnapshotRetentionDays(long modelSnapshotRetentionDays) => Assign(a => a.ModelSnapshotRetentionDays = modelSnapshotRetentionDays);
+
+		/// 
+		public ValidateJobDescriptor ResultsIndexName(IndexName indexName) => Assign(a => a.ResultsIndexName = indexName);
+
+		/// 
+		public ValidateJobDescriptor ResultsIndexName() => Assign(a => a.ResultsIndexName = typeof(TIndex));
+	}
+}
diff --git a/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobResponse.cs b/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobResponse.cs
new file mode 100644
index 00000000000..760995d97fa
--- /dev/null
+++ b/src/Nest/XPack/MachineLearning/ValidateJob/ValidateJobResponse.cs
@@ -0,0 +1,6 @@
+namespace Nest
+{
+	public interface IValidateJobResponse : IAcknowledgedResponse {}
+
+	public class ValidateJobResponse : AcknowledgedResponseBase, IValidateJobResponse {}
+}
diff --git a/src/Nest/_Generated/_Descriptors.generated.cs b/src/Nest/_Generated/_Descriptors.generated.cs
index 7251f97abad..a2f410b6715 100644
--- a/src/Nest/_Generated/_Descriptors.generated.cs
+++ b/src/Nest/_Generated/_Descriptors.generated.cs
@@ -6680,6 +6680,784 @@ public partial class PostLicenseDescriptor  : RequestDescriptorBasedescriptor for XpackMlCloseJob 
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html
+ public partial class CloseJobDescriptor : RequestDescriptorBase, ICloseJobRequest + { + Id ICloseJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_close +/// this parameter is required + public CloseJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///True if the job should be forcefully closed + public CloseJobDescriptor Force(bool force = true) => AssignParam(p=>p.Force(force)); + + ///Controls the time to wait until a job has closed. Default to 30 minutes + public CloseJobDescriptor Timeout(Time timeout) => AssignParam(p=>p.Timeout(timeout.ToTimeSpan())); + + ///Pretty format the returned JSON response. + public CloseJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public CloseJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public CloseJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public CloseJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public CloseJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlDeleteDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
+ public partial class DeleteDatafeedDescriptor : RequestDescriptorBase, IDeleteDatafeedRequest + { + Id IDeleteDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id} +/// this parameter is required + public DeleteDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){} + + + + ///True if the datafeed should be forcefully deleted + public DeleteDatafeedDescriptor Force(bool force = true) => AssignParam(p=>p.Force(force)); + + ///Pretty format the returned JSON response. + public DeleteDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public DeleteDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public DeleteDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public DeleteDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlDeleteExpiredData
+ public partial class DeleteExpiredDataDescriptor : RequestDescriptorBase, IDeleteExpiredDataRequest + { + + ///Pretty format the returned JSON response. + public DeleteExpiredDataDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public DeleteExpiredDataDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public DeleteExpiredDataDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteExpiredDataDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public DeleteExpiredDataDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlDeleteJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html
+ public partial class DeleteJobDescriptor : RequestDescriptorBase, IDeleteJobRequest + { + Id IDeleteJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id} +/// this parameter is required + public DeleteJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///True if the job should be forcefully deleted + public DeleteJobDescriptor Force(bool force = true) => AssignParam(p=>p.Force(force)); + + ///Pretty format the returned JSON response. + public DeleteJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public DeleteJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public DeleteJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public DeleteJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlDeleteModelSnapshot
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html
+ public partial class DeleteModelSnapshotDescriptor : RequestDescriptorBase, IDeleteModelSnapshotRequest + { + Id IDeleteModelSnapshotRequest.JobId => Self.RouteValues.Get("job_id"); + Id IDeleteModelSnapshotRequest.SnapshotId => Self.RouteValues.Get("snapshot_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id} +/// this parameter is required +/// this parameter is required + public DeleteModelSnapshotDescriptor(Id job_id, Id snapshot_id) : base(r=>r.Required("job_id", job_id).Required("snapshot_id", snapshot_id)){} + + + + ///Pretty format the returned JSON response. + public DeleteModelSnapshotDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public DeleteModelSnapshotDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public DeleteModelSnapshotDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public DeleteModelSnapshotDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public DeleteModelSnapshotDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlFlushJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html
+ public partial class FlushJobDescriptor : RequestDescriptorBase, IFlushJobRequest + { + Id IFlushJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_flush +/// this parameter is required + public FlushJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public FlushJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public FlushJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public FlushJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public FlushJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public FlushJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetBuckets
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html
+ public partial class GetBucketsDescriptor : RequestDescriptorBase, IGetBucketsRequest + { + Id IGetBucketsRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/results/buckets +/// this parameter is required + public GetBucketsDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public GetBucketsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetBucketsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetBucketsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetBucketsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetBucketsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetCategories
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
+ public partial class GetCategoriesDescriptor : RequestDescriptorBase, IGetCategoriesRequest + { + Id IGetCategoriesRequest.JobId => Self.RouteValues.Get("job_id"); + CategoryId IGetCategoriesRequest.CategoryId => Self.RouteValues.Get("category_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id} +/// this parameter is required + public GetCategoriesDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + ///The identifier of the category definition of interest + public GetCategoriesDescriptor CategoryId(CategoryId categoryId) => Assign(a=>a.RouteValues.Optional("category_id", categoryId)); + + + ///Pretty format the returned JSON response. + public GetCategoriesDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetCategoriesDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetCategoriesDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetCategoriesDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetCategoriesDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetDatafeeds
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html
+ public partial class GetDatafeedsDescriptor : RequestDescriptorBase, IGetDatafeedsRequest + { + Id IGetDatafeedsRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id} + public GetDatafeedsDescriptor() : base(){} + + + ///The ID of the datafeeds to fetch + public GetDatafeedsDescriptor DatafeedId(Id datafeedId) => Assign(a=>a.RouteValues.Optional("datafeed_id", datafeedId)); + + + ///Pretty format the returned JSON response. + public GetDatafeedsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetDatafeedsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetDatafeedsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetDatafeedsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetDatafeedsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetDatafeedStats
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html
+ public partial class GetDatafeedStatsDescriptor : RequestDescriptorBase, IGetDatafeedStatsRequest + { + Id IGetDatafeedStatsRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}/_stats + public GetDatafeedStatsDescriptor() : base(){} + + + ///The ID of the datafeeds stats to fetch + public GetDatafeedStatsDescriptor DatafeedId(Id datafeedId) => Assign(a=>a.RouteValues.Optional("datafeed_id", datafeedId)); + + + ///Pretty format the returned JSON response. + public GetDatafeedStatsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetDatafeedStatsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetDatafeedStatsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetDatafeedStatsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetDatafeedStatsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetInfluencers
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html
+ public partial class GetInfluencersDescriptor : RequestDescriptorBase, IGetInfluencersRequest + { + Id IGetInfluencersRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/results/influencers +/// this parameter is required + public GetInfluencersDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public GetInfluencersDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetInfluencersDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetInfluencersDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetInfluencersDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetInfluencersDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetJobs
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html
+ public partial class GetJobsDescriptor : RequestDescriptorBase, IGetJobsRequest + { + Id IGetJobsRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id} + public GetJobsDescriptor() : base(){} + + + ///The ID of the jobs to fetch + public GetJobsDescriptor JobId(Id jobId) => Assign(a=>a.RouteValues.Optional("job_id", jobId)); + + + ///Pretty format the returned JSON response. + public GetJobsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetJobsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetJobsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetJobsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetJobsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetJobStats
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html
+ public partial class GetJobStatsDescriptor : RequestDescriptorBase, IGetJobStatsRequest + { + Id IGetJobStatsRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/_stats + public GetJobStatsDescriptor() : base(){} + + + ///The ID of the jobs stats to fetch + public GetJobStatsDescriptor JobId(Id jobId) => Assign(a=>a.RouteValues.Optional("job_id", jobId)); + + + ///Pretty format the returned JSON response. + public GetJobStatsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetJobStatsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetJobStatsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetJobStatsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetJobStatsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetModelSnapshots
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html
+ public partial class GetModelSnapshotsDescriptor : RequestDescriptorBase, IGetModelSnapshotsRequest + { + Id IGetModelSnapshotsRequest.JobId => Self.RouteValues.Get("job_id"); + Id IGetModelSnapshotsRequest.SnapshotId => Self.RouteValues.Get("snapshot_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id} +/// this parameter is required + public GetModelSnapshotsDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + ///The ID of the snapshot to fetch + public GetModelSnapshotsDescriptor SnapshotId(Id snapshotId) => Assign(a=>a.RouteValues.Optional("snapshot_id", snapshotId)); + + + ///Pretty format the returned JSON response. + public GetModelSnapshotsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetModelSnapshotsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetModelSnapshotsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetModelSnapshotsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetModelSnapshotsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlGetRecords
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html
+ public partial class GetAnomalyRecordsDescriptor : RequestDescriptorBase, IGetAnomalyRecordsRequest + { + Id IGetAnomalyRecordsRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/results/records +/// this parameter is required + public GetAnomalyRecordsDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public GetAnomalyRecordsDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public GetAnomalyRecordsDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public GetAnomalyRecordsDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public GetAnomalyRecordsDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public GetAnomalyRecordsDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlOpenJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html
+ public partial class OpenJobDescriptor : RequestDescriptorBase, IOpenJobRequest + { + Id IOpenJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_open +/// this parameter is required + public OpenJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public OpenJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public OpenJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public OpenJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public OpenJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public OpenJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlPostData
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html
+ public partial class PostJobDataDescriptor : RequestDescriptorBase, IPostJobDataRequest + { + Id IPostJobDataRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_data +/// this parameter is required + public PostJobDataDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Optional parameter to specify the start of the bucket resetting range + public PostJobDataDescriptor ResetStart(DateTimeOffset reset_start) => AssignParam(p=>p.ResetStart(reset_start)); + + ///Optional parameter to specify the end of the bucket resetting range + public PostJobDataDescriptor ResetEnd(DateTimeOffset reset_end) => AssignParam(p=>p.ResetEnd(reset_end)); + + ///Pretty format the returned JSON response. + public PostJobDataDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public PostJobDataDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public PostJobDataDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PostJobDataDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public PostJobDataDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlPreviewDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html
+ public partial class PreviewDatafeedDescriptor : RequestDescriptorBase, IPreviewDatafeedRequest + { + Id IPreviewDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}/_preview +/// this parameter is required + public PreviewDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){} + + + + ///Pretty format the returned JSON response. + public PreviewDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public PreviewDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public PreviewDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PreviewDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public PreviewDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlPutDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html
+ public partial class PutDatafeedDescriptor : RequestDescriptorBase,PutDatafeedRequestParameters, IPutDatafeedRequest>, IPutDatafeedRequest + { + Id IPutDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}. Will infer the index and type from the generic type +/// this parameter is required + public PutDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){ Self.Indices = typeof(T); Self.Types = typeof(T); } + + + + ///Pretty format the returned JSON response. + public PutDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public PutDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public PutDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PutDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public PutDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlPutJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html
+ public partial class PutJobDescriptor : RequestDescriptorBase,PutJobRequestParameters, IPutJobRequest>, IPutJobRequest + { + Id IPutJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id} +/// this parameter is required + public PutJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public PutJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public PutJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public PutJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public PutJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public PutJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlRevertModelSnapshot
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html
+ public partial class RevertModelSnapshotDescriptor : RequestDescriptorBase, IRevertModelSnapshotRequest + { + Id IRevertModelSnapshotRequest.JobId => Self.RouteValues.Get("job_id"); + Id IRevertModelSnapshotRequest.SnapshotId => Self.RouteValues.Get("snapshot_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert +/// this parameter is required +/// this parameter is required + public RevertModelSnapshotDescriptor(Id job_id, Id snapshot_id) : base(r=>r.Required("job_id", job_id).Required("snapshot_id", snapshot_id)){} + + + + ///Pretty format the returned JSON response. + public RevertModelSnapshotDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public RevertModelSnapshotDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public RevertModelSnapshotDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public RevertModelSnapshotDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public RevertModelSnapshotDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlStartDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html
+ public partial class StartDatafeedDescriptor : RequestDescriptorBase, IStartDatafeedRequest + { + Id IStartDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}/_start +/// this parameter is required + public StartDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){} + + + + ///Pretty format the returned JSON response. + public StartDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public StartDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public StartDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public StartDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public StartDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlStopDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html
+ public partial class StopDatafeedDescriptor : RequestDescriptorBase, IStopDatafeedRequest + { + Id IStopDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}/_stop +/// this parameter is required + public StopDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){} + + + + ///Pretty format the returned JSON response. + public StopDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public StopDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public StopDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public StopDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public StopDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlUpdateDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html
+ public partial class UpdateDatafeedDescriptor : RequestDescriptorBase,UpdateDatafeedRequestParameters, IUpdateDatafeedRequest>, IUpdateDatafeedRequest + { + Id IUpdateDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + /// /_xpack/ml/datafeeds/{datafeed_id}/_update. Will infer the index and type from the generic type +/// this parameter is required + public UpdateDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_id", datafeed_id)){ Self.Indices = typeof(T); Self.Types = typeof(T); } + + + + ///Pretty format the returned JSON response. + public UpdateDatafeedDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public UpdateDatafeedDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public UpdateDatafeedDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateDatafeedDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public UpdateDatafeedDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlUpdateJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html
+ public partial class UpdateJobDescriptor : RequestDescriptorBase,UpdateJobRequestParameters, IUpdateJobRequest>, IUpdateJobRequest + { + Id IUpdateJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_update +/// this parameter is required + public UpdateJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + + ///Pretty format the returned JSON response. + public UpdateJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public UpdateJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public UpdateJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public UpdateJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlUpdateModelSnapshot
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html
+ public partial class UpdateModelSnapshotDescriptor : RequestDescriptorBase, IUpdateModelSnapshotRequest + { + Id IUpdateModelSnapshotRequest.JobId => Self.RouteValues.Get("job_id"); + Id IUpdateModelSnapshotRequest.SnapshotId => Self.RouteValues.Get("snapshot_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update +/// this parameter is required +/// this parameter is required + public UpdateModelSnapshotDescriptor(Id job_id, Id snapshot_id) : base(r=>r.Required("job_id", job_id).Required("snapshot_id", snapshot_id)){} + + + + ///Pretty format the returned JSON response. + public UpdateModelSnapshotDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public UpdateModelSnapshotDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public UpdateModelSnapshotDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public UpdateModelSnapshotDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public UpdateModelSnapshotDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlValidate
+ public partial class ValidateJobDescriptor : RequestDescriptorBase,ValidateJobRequestParameters, IValidateJobRequest>, IValidateJobRequest + { + + ///Pretty format the returned JSON response. + public ValidateJobDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public ValidateJobDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public ValidateJobDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public ValidateJobDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public ValidateJobDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + + ///descriptor for XpackMlValidateDetector
+ public partial class ValidateDetectorDescriptor : RequestDescriptorBase,ValidateDetectorRequestParameters, IValidateDetectorRequest>, IValidateDetectorRequest + { + + ///Pretty format the returned JSON response. + public ValidateDetectorDescriptor Pretty(bool pretty = true) => AssignParam(p=>p.Pretty(pretty)); + + ///Return human readable values for statistics. + public ValidateDetectorDescriptor Human(bool human = true) => AssignParam(p=>p.Human(human)); + + ///Include the stack trace of returned errors. + public ValidateDetectorDescriptor ErrorTrace(bool error_trace = true) => AssignParam(p=>p.ErrorTrace(error_trace)); + + ///The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + public ValidateDetectorDescriptor Source(string source) => AssignParam(p=>p.Source(source)); + + ///A comma-separated list of filters used to reduce the respone. + public ValidateDetectorDescriptor FilterPath(params string[] filter_path) => AssignParam(p=>p.FilterPath(filter_path)); + + } + ///descriptor for XpackSecurityAuthenticate
https://www.elastic.co/guide/en/x-pack/master/security-api-authenticate.html
public partial class AuthenticateDescriptor : RequestDescriptorBase, IAuthenticateRequest { diff --git a/src/Nest/_Generated/_LowLevelDispatch.generated.cs b/src/Nest/_Generated/_LowLevelDispatch.generated.cs index a4f8f0126e6..d103eed62af 100644 --- a/src/Nest/_Generated/_LowLevelDispatch.generated.cs +++ b/src/Nest/_Generated/_LowLevelDispatch.generated.cs @@ -3510,6 +3510,720 @@ internal Task> XpackLicensePostDispatchAsync(IReques throw InvalidDispatch("XpackLicensePost", p, new [] { PUT }, "/_xpack/license"); } + internal ElasticsearchResponse XpackMlCloseJobDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJob(p.RouteValues.JobId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlCloseJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_close"); + } + + internal Task> XpackMlCloseJobDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJobAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlCloseJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_close"); + } + + internal ElasticsearchResponse XpackMlDeleteDatafeedDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlDeleteDatafeed(p.RouteValues.DatafeedId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlDeleteDatafeed", p, new [] { DELETE }, "/_xpack/ml/datafeeds/{datafeed_id}"); + } + + internal Task> XpackMlDeleteDatafeedDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlDeleteDatafeedAsync(p.RouteValues.DatafeedId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlDeleteDatafeed", p, new [] { DELETE }, "/_xpack/ml/datafeeds/{datafeed_id}"); + } + + internal ElasticsearchResponse XpackMlDeleteExpiredDataDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + return _lowLevel.XpackMlDeleteExpiredData(u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlDeleteExpiredData", p, new [] { DELETE }, "/_xpack/ml/_delete_expired_data"); + } + + internal Task> XpackMlDeleteExpiredDataDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + return _lowLevel.XpackMlDeleteExpiredDataAsync(u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlDeleteExpiredData", p, new [] { DELETE }, "/_xpack/ml/_delete_expired_data"); + } + + internal ElasticsearchResponse XpackMlDeleteJobDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlDeleteJob(p.RouteValues.JobId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlDeleteJob", p, new [] { DELETE }, "/_xpack/ml/anomaly_detectors/{job_id}"); + } + + internal Task> XpackMlDeleteJobDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlDeleteJobAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlDeleteJob", p, new [] { DELETE }, "/_xpack/ml/anomaly_detectors/{job_id}"); + } + + internal ElasticsearchResponse XpackMlDeleteModelSnapshotDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlDeleteModelSnapshot(p.RouteValues.JobId,p.RouteValues.SnapshotId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlDeleteModelSnapshot", p, new [] { DELETE }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}"); + } + + internal Task> XpackMlDeleteModelSnapshotDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlDeleteModelSnapshotAsync(p.RouteValues.JobId,p.RouteValues.SnapshotId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlDeleteModelSnapshot", p, new [] { DELETE }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}"); + } + + internal ElasticsearchResponse XpackMlFlushJobDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlFlushJob(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlFlushJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_flush"); + } + + internal Task> XpackMlFlushJobDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlFlushJobAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlFlushJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_flush"); + } + + internal ElasticsearchResponse XpackMlGetBucketsDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetBuckets(p.RouteValues.JobId,u => p.RequestParameters); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetBuckets(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlGetBuckets", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets"); + } + + internal Task> XpackMlGetBucketsDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetBucketsAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetBucketsAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlGetBuckets", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets"); + } + + internal ElasticsearchResponse XpackMlGetCategoriesDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId, p.RouteValues.CategoryId)) return _lowLevel.XpackMlGetCategories(p.RouteValues.JobId,long.Parse(p.RouteValues.CategoryId),u => p.RequestParameters); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetCategories(p.RouteValues.JobId,u => p.RequestParameters); + break; + + case POST: + if (AllSet(p.RouteValues.JobId, p.RouteValues.CategoryId)) return _lowLevel.XpackMlGetCategories(p.RouteValues.JobId,long.Parse(p.RouteValues.CategoryId),body,u => p.RequestParameters); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetCategories(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlGetCategories", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}", "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/"); + } + + internal Task> XpackMlGetCategoriesDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId, p.RouteValues.CategoryId)) return _lowLevel.XpackMlGetCategoriesAsync(p.RouteValues.JobId,long.Parse(p.RouteValues.CategoryId),u => p.RequestParameters,cancellationToken); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetCategoriesAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + case POST: + if (AllSet(p.RouteValues.JobId, p.RouteValues.CategoryId)) return _lowLevel.XpackMlGetCategoriesAsync(p.RouteValues.JobId,long.Parse(p.RouteValues.CategoryId),body,u => p.RequestParameters,cancellationToken); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetCategoriesAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlGetCategories", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}", "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/"); + } + + internal ElasticsearchResponse XpackMlGetDatafeedsDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlGetDatafeeds(p.RouteValues.DatafeedId,u => p.RequestParameters); + return _lowLevel.XpackMlGetDatafeeds(u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlGetDatafeeds", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}", "/_xpack/ml/datafeeds"); + } + + internal Task> XpackMlGetDatafeedsDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlGetDatafeedsAsync(p.RouteValues.DatafeedId,u => p.RequestParameters,cancellationToken); + return _lowLevel.XpackMlGetDatafeedsAsync(u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlGetDatafeeds", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}", "/_xpack/ml/datafeeds"); + } + + internal ElasticsearchResponse XpackMlGetDatafeedStatsDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlGetDatafeedStats(p.RouteValues.DatafeedId,u => p.RequestParameters); + return _lowLevel.XpackMlGetDatafeedStats(u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlGetDatafeedStats", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}/_stats", "/_xpack/ml/datafeeds/_stats"); + } + + internal Task> XpackMlGetDatafeedStatsDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlGetDatafeedStatsAsync(p.RouteValues.DatafeedId,u => p.RequestParameters,cancellationToken); + return _lowLevel.XpackMlGetDatafeedStatsAsync(u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlGetDatafeedStats", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}/_stats", "/_xpack/ml/datafeeds/_stats"); + } + + internal ElasticsearchResponse XpackMlGetInfluencersDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetInfluencers(p.RouteValues.JobId,u => p.RequestParameters); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetInfluencers(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlGetInfluencers", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/influencers"); + } + + internal Task> XpackMlGetInfluencersDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetInfluencersAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetInfluencersAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlGetInfluencers", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/influencers"); + } + + internal ElasticsearchResponse XpackMlGetJobsDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId)) return _lowLevel.XpackMlGetJobs(p.RouteValues.JobId,u => p.RequestParameters); + return _lowLevel.XpackMlGetJobs(u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlGetJobs", p, new [] { GET }, "/_xpack/ml/anomaly_detectors/{job_id}", "/_xpack/ml/anomaly_detectors/"); + } + + internal Task> XpackMlGetJobsDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId)) return _lowLevel.XpackMlGetJobsAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + return _lowLevel.XpackMlGetJobsAsync(u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlGetJobs", p, new [] { GET }, "/_xpack/ml/anomaly_detectors/{job_id}", "/_xpack/ml/anomaly_detectors/"); + } + + internal ElasticsearchResponse XpackMlGetJobStatsDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId)) return _lowLevel.XpackMlGetJobStats(p.RouteValues.JobId,u => p.RequestParameters); + return _lowLevel.XpackMlGetJobStats(u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlGetJobStats", p, new [] { GET }, "/_xpack/ml/anomaly_detectors/_stats", "/_xpack/ml/anomaly_detectors/{job_id}/_stats"); + } + + internal Task> XpackMlGetJobStatsDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId)) return _lowLevel.XpackMlGetJobStatsAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + return _lowLevel.XpackMlGetJobStatsAsync(u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlGetJobStats", p, new [] { GET }, "/_xpack/ml/anomaly_detectors/_stats", "/_xpack/ml/anomaly_detectors/{job_id}/_stats"); + } + + internal ElasticsearchResponse XpackMlGetModelSnapshotsDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlGetModelSnapshots(p.RouteValues.JobId,p.RouteValues.SnapshotId,u => p.RequestParameters); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetModelSnapshots(p.RouteValues.JobId,u => p.RequestParameters); + break; + + case POST: + if (AllSet(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlGetModelSnapshots(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetModelSnapshots(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlGetModelSnapshots", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots"); + } + + internal Task> XpackMlGetModelSnapshotsDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlGetModelSnapshotsAsync(p.RouteValues.JobId,p.RouteValues.SnapshotId,u => p.RequestParameters,cancellationToken); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetModelSnapshotsAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + case POST: + if (AllSet(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlGetModelSnapshotsAsync(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters,cancellationToken); + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetModelSnapshotsAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlGetModelSnapshots", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots"); + } + + internal ElasticsearchResponse XpackMlGetRecordsDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetRecords(p.RouteValues.JobId,u => p.RequestParameters); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetRecords(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlGetRecords", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/records"); + } + + internal Task> XpackMlGetRecordsDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetRecordsAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlGetRecordsAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlGetRecords", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/records"); + } + + internal ElasticsearchResponse XpackMlOpenJobDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlOpenJob(p.RouteValues.JobId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlOpenJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_open"); + } + + internal Task> XpackMlOpenJobDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlOpenJobAsync(p.RouteValues.JobId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlOpenJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_open"); + } + + internal ElasticsearchResponse XpackMlPostDataDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlPostData(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlPostData", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_data"); + } + + internal Task> XpackMlPostDataDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlPostDataAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlPostData", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_data"); + } + + internal ElasticsearchResponse XpackMlPreviewDatafeedDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlPreviewDatafeed(p.RouteValues.DatafeedId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlPreviewDatafeed", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}/_preview"); + } + + internal Task> XpackMlPreviewDatafeedDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlPreviewDatafeedAsync(p.RouteValues.DatafeedId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlPreviewDatafeed", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}/_preview"); + } + + internal ElasticsearchResponse XpackMlPutDatafeedDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlPutDatafeed(p.RouteValues.DatafeedId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlPutDatafeed", p, new [] { PUT }, "/_xpack/ml/datafeeds/{datafeed_id}"); + } + + internal Task> XpackMlPutDatafeedDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlPutDatafeedAsync(p.RouteValues.DatafeedId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlPutDatafeed", p, new [] { PUT }, "/_xpack/ml/datafeeds/{datafeed_id}"); + } + + internal ElasticsearchResponse XpackMlPutJobDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlPutJob(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlPutJob", p, new [] { PUT }, "/_xpack/ml/anomaly_detectors/{job_id}"); + } + + internal Task> XpackMlPutJobDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlPutJobAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlPutJob", p, new [] { PUT }, "/_xpack/ml/anomaly_detectors/{job_id}"); + } + + internal ElasticsearchResponse XpackMlRevertModelSnapshotDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlRevertModelSnapshot(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlRevertModelSnapshot", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert"); + } + + internal Task> XpackMlRevertModelSnapshotDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlRevertModelSnapshotAsync(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlRevertModelSnapshot", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert"); + } + + internal ElasticsearchResponse XpackMlStartDatafeedDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlStartDatafeed(p.RouteValues.DatafeedId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlStartDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_start"); + } + + internal Task> XpackMlStartDatafeedDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlStartDatafeedAsync(p.RouteValues.DatafeedId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlStartDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_start"); + } + + internal ElasticsearchResponse XpackMlStopDatafeedDispatch(IRequest p ) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlStopDatafeed(p.RouteValues.DatafeedId,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlStopDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_stop"); + } + + internal Task> XpackMlStopDatafeedDispatchAsync(IRequest p , CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlStopDatafeedAsync(p.RouteValues.DatafeedId,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlStopDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_stop"); + } + + internal ElasticsearchResponse XpackMlUpdateDatafeedDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlUpdateDatafeed(p.RouteValues.DatafeedId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlUpdateDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_update"); + } + + internal Task> XpackMlUpdateDatafeedDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.DatafeedId)) return _lowLevel.XpackMlUpdateDatafeedAsync(p.RouteValues.DatafeedId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlUpdateDatafeed", p, new [] { POST }, "/_xpack/ml/datafeeds/{datafeed_id}/_update"); + } + + internal ElasticsearchResponse XpackMlUpdateJobDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlUpdateJob(p.RouteValues.JobId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlUpdateJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_update"); + } + + internal Task> XpackMlUpdateJobDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlUpdateJobAsync(p.RouteValues.JobId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlUpdateJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_update"); + } + + internal ElasticsearchResponse XpackMlUpdateModelSnapshotDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlUpdateModelSnapshot(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters); + break; + + } + throw InvalidDispatch("XpackMlUpdateModelSnapshot", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update"); + } + + internal Task> XpackMlUpdateModelSnapshotDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.JobId, p.RouteValues.SnapshotId)) return _lowLevel.XpackMlUpdateModelSnapshotAsync(p.RouteValues.JobId,p.RouteValues.SnapshotId,body,u => p.RequestParameters,cancellationToken); + break; + + } + throw InvalidDispatch("XpackMlUpdateModelSnapshot", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update"); + } + + internal ElasticsearchResponse XpackMlValidateDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + return _lowLevel.XpackMlValidate(body,u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlValidate", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/_validate"); + } + + internal Task> XpackMlValidateDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + return _lowLevel.XpackMlValidateAsync(body,u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlValidate", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/_validate"); + } + + internal ElasticsearchResponse XpackMlValidateDetectorDispatch(IRequest p , PostData body) where T : class + { + switch(p.HttpMethod) + { + case POST: + return _lowLevel.XpackMlValidateDetector(body,u => p.RequestParameters); + + } + throw InvalidDispatch("XpackMlValidateDetector", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/_validate/detector"); + } + + internal Task> XpackMlValidateDetectorDispatchAsync(IRequest p , PostData body, CancellationToken cancellationToken) where T : class + { + switch(p.HttpMethod) + { + case POST: + return _lowLevel.XpackMlValidateDetectorAsync(body,u => p.RequestParameters,cancellationToken); + + } + throw InvalidDispatch("XpackMlValidateDetector", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/_validate/detector"); + } + internal ElasticsearchResponse XpackSecurityAuthenticateDispatch(IRequest p ) where T : class { switch(p.HttpMethod) diff --git a/src/Nest/_Generated/_Requests.generated.cs b/src/Nest/_Generated/_Requests.generated.cs index a501d268458..2906c78df96 100644 --- a/src/Nest/_Generated/_Requests.generated.cs +++ b/src/Nest/_Generated/_Requests.generated.cs @@ -1667,6 +1667,44 @@ public CloseIndexRequest(Indices index) : base(r=>r.Required("index", index)){} } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface ICloseJobRequest : IRequest + { + Id JobId { get; } + } + ///Request parameters for XpackMlCloseJob
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html
+ public partial class CloseJobRequest : PlainRequestBase, ICloseJobRequest + { + protected ICloseJobRequest Self => this; + Id ICloseJobRequest.JobId => Self.RouteValues.Get("job_id"); + /// /_xpack/ml/anomaly_detectors/{job_id}/_close +///this parameter is required + public CloseJobRequest(Id job_id) : base(r=>r.Required("job_id", job_id)){} + + + ///True if the job should be forcefully closed + public bool Force { get { return Q("force"); } set { Q("force", value); } } + + ///Controls the time to wait until a job has closed. Default to 30 minutes + public Time Timeout { get { return Q