diff --git a/esapi/api._.go b/esapi/api._.go index 0c467094db..e0fc404018 100755 --- a/esapi/api._.go +++ b/esapi/api._.go @@ -1,4 +1,4 @@ -// Code generated from specification version 7.8.0 (8686200a320): DO NOT EDIT +// Code generated from specification version 7.8.0 (cd7638416b4): DO NOT EDIT package esapi diff --git a/esapi/api.bulk.go b/esapi/api.bulk.go index 377800640a..1abbd9b3ef 100644 --- a/esapi/api.bulk.go +++ b/esapi/api.bulk.go @@ -10,7 +10,6 @@ import ( "context" "io" "net/http" - "strconv" "strings" "time" ) @@ -42,7 +41,6 @@ type BulkRequest struct { Body io.Reader Pipeline string - PreferV2Templates *bool Refresh string Routing string Source []string @@ -90,10 +88,6 @@ func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, er params["pipeline"] = r.Pipeline } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Refresh != "" { params["refresh"] = r.Refresh } @@ -221,14 +215,6 @@ func (f Bulk) WithPipeline(v string) func(*BulkRequest) { } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during automatic index creation. -// -func (f Bulk) WithPreferV2Templates(v bool) func(*BulkRequest) { - return func(r *BulkRequest) { - r.PreferV2Templates = &v - } -} - // WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. // func (f Bulk) WithRefresh(v string) func(*BulkRequest) { diff --git a/esapi/api.cluster.delete_component_template.go b/esapi/api.cluster.delete_component_template.go index 20d223b106..8bf7b74712 100644 --- a/esapi/api.cluster.delete_component_template.go +++ b/esapi/api.cluster.delete_component_template.go @@ -29,7 +29,7 @@ func newClusterDeleteComponentTemplateFunc(t Transport) ClusterDeleteComponentTe // // This API is experimental. // -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html. +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. // type ClusterDeleteComponentTemplate func(name string, o ...func(*ClusterDeleteComponentTemplateRequest)) (*Response, error) diff --git a/esapi/api.cluster.exists_component_template.go b/esapi/api.cluster.exists_component_template.go index 3ead2194c3..d7ff8536d6 100644 --- a/esapi/api.cluster.exists_component_template.go +++ b/esapi/api.cluster.exists_component_template.go @@ -30,7 +30,7 @@ func newClusterExistsComponentTemplateFunc(t Transport) ClusterExistsComponentTe // // This API is experimental. // -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html. +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. // type ClusterExistsComponentTemplate func(name string, o ...func(*ClusterExistsComponentTemplateRequest)) (*Response, error) diff --git a/esapi/api.cluster.get_component_template.go b/esapi/api.cluster.get_component_template.go index 2be7bf43ae..7d4be58614 100644 --- a/esapi/api.cluster.get_component_template.go +++ b/esapi/api.cluster.get_component_template.go @@ -30,7 +30,7 @@ func newClusterGetComponentTemplateFunc(t Transport) ClusterGetComponentTemplate // // This API is experimental. // -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html. +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. // type ClusterGetComponentTemplate func(o ...func(*ClusterGetComponentTemplateRequest)) (*Response, error) diff --git a/esapi/api.cluster.put_component_template.go b/esapi/api.cluster.put_component_template.go index 14e755c638..ddca82b67f 100644 --- a/esapi/api.cluster.put_component_template.go +++ b/esapi/api.cluster.put_component_template.go @@ -31,7 +31,7 @@ func newClusterPutComponentTemplateFunc(t Transport) ClusterPutComponentTemplate // // This API is experimental. // -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html. +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. // type ClusterPutComponentTemplate func(name string, body io.Reader, o ...func(*ClusterPutComponentTemplateRequest)) (*Response, error) diff --git a/esapi/api.create.go b/esapi/api.create.go index ab6c6c9595..226abed467 100644 --- a/esapi/api.create.go +++ b/esapi/api.create.go @@ -45,7 +45,6 @@ type CreateRequest struct { Body io.Reader Pipeline string - PreferV2Templates *bool Refresh string Routing string Timeout time.Duration @@ -96,10 +95,6 @@ func (r CreateRequest) Do(ctx context.Context, transport Transport) (*Response, params["pipeline"] = r.Pipeline } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Refresh != "" { params["refresh"] = r.Refresh } @@ -211,14 +206,6 @@ func (f Create) WithPipeline(v string) func(*CreateRequest) { } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during automatic index creation. -// -func (f Create) WithPreferV2Templates(v bool) func(*CreateRequest) { - return func(r *CreateRequest) { - r.PreferV2Templates = &v - } -} - // WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. // func (f Create) WithRefresh(v string) func(*CreateRequest) { diff --git a/esapi/api.index.go b/esapi/api.index.go index 5491f8941c..47f2971c9d 100644 --- a/esapi/api.index.go +++ b/esapi/api.index.go @@ -46,7 +46,6 @@ type IndexRequest struct { IfSeqNo *int OpType string Pipeline string - PreferV2Templates *bool Refresh string Routing string Timeout time.Duration @@ -113,10 +112,6 @@ func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, e params["pipeline"] = r.Pipeline } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Refresh != "" { params["refresh"] = r.Refresh } @@ -260,14 +255,6 @@ func (f Index) WithPipeline(v string) func(*IndexRequest) { } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during automatic index creation. -// -func (f Index) WithPreferV2Templates(v bool) func(*IndexRequest) { - return func(r *IndexRequest) { - r.PreferV2Templates = &v - } -} - // WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. // func (f Index) WithRefresh(v string) func(*IndexRequest) { diff --git a/esapi/api.indices.create.go b/esapi/api.indices.create.go index e461034c6e..d0eeb7f572 100644 --- a/esapi/api.indices.create.go +++ b/esapi/api.indices.create.go @@ -42,7 +42,6 @@ type IndicesCreateRequest struct { IncludeTypeName *bool MasterTimeout time.Duration - PreferV2Templates *bool Timeout time.Duration WaitForActiveShards string @@ -81,10 +80,6 @@ func (r IndicesCreateRequest) Do(ctx context.Context, transport Transport) (*Res params["master_timeout"] = formatDuration(r.MasterTimeout) } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } @@ -188,14 +183,6 @@ func (f IndicesCreate) WithMasterTimeout(v time.Duration) func(*IndicesCreateReq } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during index creation. -// -func (f IndicesCreate) WithPreferV2Templates(v bool) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.PreferV2Templates = &v - } -} - // WithTimeout - explicit operation timeout. // func (f IndicesCreate) WithTimeout(v time.Duration) func(*IndicesCreateRequest) { diff --git a/esapi/api.indices.rollover.go b/esapi/api.indices.rollover.go index b9ce695299..8a6b8168fd 100644 --- a/esapi/api.indices.rollover.go +++ b/esapi/api.indices.rollover.go @@ -45,7 +45,6 @@ type IndicesRolloverRequest struct { DryRun *bool IncludeTypeName *bool MasterTimeout time.Duration - PreferV2Templates *bool Timeout time.Duration WaitForActiveShards string @@ -94,10 +93,6 @@ func (r IndicesRolloverRequest) Do(ctx context.Context, transport Transport) (*R params["master_timeout"] = formatDuration(r.MasterTimeout) } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } @@ -217,14 +212,6 @@ func (f IndicesRollover) WithMasterTimeout(v time.Duration) func(*IndicesRollove } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during automatic index creation. -// -func (f IndicesRollover) WithPreferV2Templates(v bool) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.PreferV2Templates = &v - } -} - // WithTimeout - explicit operation timeout. // func (f IndicesRollover) WithTimeout(v time.Duration) func(*IndicesRolloverRequest) { diff --git a/esapi/api.indices.simulate_index_template.go b/esapi/api.indices.simulate_index_template.go index 39702ac93b..0c7c0e8316 100644 --- a/esapi/api.indices.simulate_index_template.go +++ b/esapi/api.indices.simulate_index_template.go @@ -29,6 +29,8 @@ func newIndicesSimulateIndexTemplateFunc(t Transport) IndicesSimulateIndexTempla // IndicesSimulateIndexTemplate simulate matching the given index name against the index templates in the system // +// This API is experimental. +// // See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. // type IndicesSimulateIndexTemplate func(name string, o ...func(*IndicesSimulateIndexTemplateRequest)) (*Response, error) diff --git a/esapi/api.snapshot.cleanup_repository.go b/esapi/api.snapshot.cleanup_repository.go index 8799fd95c2..b261dd2175 100644 --- a/esapi/api.snapshot.cleanup_repository.go +++ b/esapi/api.snapshot.cleanup_repository.go @@ -27,7 +27,7 @@ func newSnapshotCleanupRepositoryFunc(t Transport) SnapshotCleanupRepository { // SnapshotCleanupRepository removes stale data from repository. // -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. +// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html. // type SnapshotCleanupRepository func(repository string, o ...func(*SnapshotCleanupRepositoryRequest)) (*Response, error) diff --git a/esapi/api.update.go b/esapi/api.update.go index ec1fac66db..f4b5aa64f2 100644 --- a/esapi/api.update.go +++ b/esapi/api.update.go @@ -45,7 +45,6 @@ type UpdateRequest struct { IfPrimaryTerm *int IfSeqNo *int Lang string - PreferV2Templates *bool Refresh string RetryOnConflict *int Routing string @@ -106,10 +105,6 @@ func (r UpdateRequest) Do(ctx context.Context, transport Transport) (*Response, params["lang"] = r.Lang } - if r.PreferV2Templates != nil { - params["prefer_v2_templates"] = strconv.FormatBool(*r.PreferV2Templates) - } - if r.Refresh != "" { params["refresh"] = r.Refresh } @@ -245,14 +240,6 @@ func (f Update) WithLang(v string) func(*UpdateRequest) { } } -// WithPreferV2Templates - favor v2 templates instead of v1 templates during automatic index creation. -// -func (f Update) WithPreferV2Templates(v bool) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.PreferV2Templates = &v - } -} - // WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. // func (f Update) WithRefresh(v string) func(*UpdateRequest) { diff --git a/esapi/api.xpack.ml.delete_data_frame_analytics.go b/esapi/api.xpack.ml.delete_data_frame_analytics.go index 4808f69ec3..83c5cbc582 100644 --- a/esapi/api.xpack.ml.delete_data_frame_analytics.go +++ b/esapi/api.xpack.ml.delete_data_frame_analytics.go @@ -11,6 +11,7 @@ import ( "net/http" "strconv" "strings" + "time" ) func newMLDeleteDataFrameAnalyticsFunc(t Transport) MLDeleteDataFrameAnalytics { @@ -38,7 +39,8 @@ type MLDeleteDataFrameAnalytics func(id string, o ...func(*MLDeleteDataFrameAnal type MLDeleteDataFrameAnalyticsRequest struct { ID string - Force *bool + Force *bool + Timeout time.Duration Pretty bool Human bool @@ -77,6 +79,10 @@ func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Tra params["force"] = strconv.FormatBool(*r.Force) } + if r.Timeout != 0 { + params["timeout"] = formatDuration(r.Timeout) + } + if r.Pretty { params["pretty"] = "true" } @@ -152,6 +158,14 @@ func (f MLDeleteDataFrameAnalytics) WithForce(v bool) func(*MLDeleteDataFrameAna } } +// WithTimeout - controls the time to wait until a job is deleted. defaults to 1 minute. +// +func (f MLDeleteDataFrameAnalytics) WithTimeout(v time.Duration) func(*MLDeleteDataFrameAnalyticsRequest) { + return func(r *MLDeleteDataFrameAnalyticsRequest) { + r.Timeout = v + } +} + // WithPretty makes the response body pretty-printed. // func (f MLDeleteDataFrameAnalytics) WithPretty() func(*MLDeleteDataFrameAnalyticsRequest) { diff --git a/esapi/api.xpack.ml.delete_expired_data.go b/esapi/api.xpack.ml.delete_expired_data.go index 60e406e94f..c5169649b5 100644 --- a/esapi/api.xpack.ml.delete_expired_data.go +++ b/esapi/api.xpack.ml.delete_expired_data.go @@ -8,6 +8,7 @@ package esapi import ( "context" + "io" "net/http" "strings" ) @@ -33,6 +34,8 @@ type MLDeleteExpiredData func(o ...func(*MLDeleteExpiredDataRequest)) (*Response // MLDeleteExpiredDataRequest configures the ML Delete Expired Data API request. // type MLDeleteExpiredDataRequest struct { + Body io.Reader + Pretty bool Human bool ErrorTrace bool @@ -75,7 +78,7 @@ func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) params["filter_path"] = strings.Join(r.FilterPath, ",") } - req, err := newRequest(method, path.String(), nil) + req, err := newRequest(method, path.String(), r.Body) if err != nil { return nil, err } @@ -88,6 +91,10 @@ func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) req.URL.RawQuery = q.Encode() } + if r.Body != nil { + req.Header[headerContentType] = headerContentTypeJSON + } + if len(r.Header) > 0 { if len(req.Header) == 0 { req.Header = r.Header @@ -126,6 +133,14 @@ func (f MLDeleteExpiredData) WithContext(v context.Context) func(*MLDeleteExpire } } +// WithBody - deleting expired data parameters. +// +func (f MLDeleteExpiredData) WithBody(v io.Reader) func(*MLDeleteExpiredDataRequest) { + return func(r *MLDeleteExpiredDataRequest) { + r.Body = v + } +} + // WithPretty makes the response body pretty-printed. // func (f MLDeleteExpiredData) WithPretty() func(*MLDeleteExpiredDataRequest) { diff --git a/esapi/api.xpack.ml.validate.go b/esapi/api.xpack.ml.validate.go index 0d5fb4c6d0..d88bfa3613 100644 --- a/esapi/api.xpack.ml.validate.go +++ b/esapi/api.xpack.ml.validate.go @@ -27,6 +27,8 @@ func newMLValidateFunc(t Transport) MLValidate { // MLValidate - Validates an anomaly detection job. // +// See full documentation at https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html. +// type MLValidate func(body io.Reader, o ...func(*MLValidateRequest)) (*Response, error) // MLValidateRequest configures the ML Validate API request. diff --git a/esapi/api.xpack.ml.validate_detector.go b/esapi/api.xpack.ml.validate_detector.go index fbe5294f54..7acb56a9d2 100644 --- a/esapi/api.xpack.ml.validate_detector.go +++ b/esapi/api.xpack.ml.validate_detector.go @@ -27,6 +27,8 @@ func newMLValidateDetectorFunc(t Transport) MLValidateDetector { // MLValidateDetector - Validates an anomaly detection detector. // +// See full documentation at https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html. +// type MLValidateDetector func(body io.Reader, o ...func(*MLValidateDetectorRequest)) (*Response, error) // MLValidateDetectorRequest configures the ML Validate Detector API request.