Skip to content

Use go-elasticsearch v8 #832

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
## [Unreleased]

- Add support for the `.gemini` connector type for Kibana action connectors ([#819](https://github.com./elastic/terraform-provider-elasticstack/pull/819))
### Breaking changes

- Remove support for specifying `include_type_name` from the `elasticstack_elasticsearch_index` resource. This parameter has been deprecated from 7.0, with indices restricted to a single type since 6.0. ([#832](https://github.com./elastic/terraform-provider-elasticstack/pull/832))

### Changes

- Fix secret handling `elasticstack_fleet_integration_policy` resource. ([#821](https://github.com./elastic/terraform-provider-elasticstack/pull/821))
- Fix merge values for `elasticstack_kibana_synthetics_monitor` monitor locations ([#823](https://github.com./elastic/terraform-provider-elasticstack/pull/823))
- Migrate to a v8 Elasticsearch client ([#832](https://github.com./elastic/terraform-provider-elasticstack/pull/832))
- Add support for the `.gemini` connector type for Kibana action connectors ([#819](https://github.com./elastic/terraform-provider-elasticstack/pull/819))
- Add `aliases` attribute to `elasticstack_elasticsearch_transform` resource. ([#825](https://github.com./elastic/terraform-provider-elasticstack/pull/825))
- Add `description` attribute to `elasticstack_elasticsearch_security_role` resource. ([#824](https://github.com./elastic/terraform-provider-elasticstack/pull/824))
- Fix merge values for `elasticstack_kibana_synthetics_monitor` monitor locations ([#823](https://github.com./elastic/terraform-provider-elasticstack/pull/823)
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/elasticsearch_indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Optional:
- `final_pipeline` (String) Final ingest pipeline for the index. Indexing requests will fail if the final pipeline is set and the pipeline does not exist. The final pipeline always runs after the request pipeline (if specified) and the default pipeline (if it exists). The special pipeline name _none indicates no ingest pipeline will run.
- `gc_deletes` (String) The length of time that a deleted document's version number remains available for further versioned operations.
- `highlight_max_analyzed_offset` (Number) The maximum number of characters that will be analyzed for a highlight request.
- `include_type_name` (Boolean) If true, a mapping type is expected in the body of mappings. Defaults to false. Supported for Elasticsearch 7.x.
- `indexing_slowlog_level` (String) Set which logging level to use for the search slow log, can be: `warn`, `info`, `debug`, `trace`
- `indexing_slowlog_source` (String) Set the number of characters of the `_source` to include in the slowlog lines, `false` or `0` will skip logging the source entirely and setting it to `true` will log the entire source regardless of size. The original `_source` is reformatted by default to make sure that it fits on a single log line.
- `indexing_slowlog_threshold_index_debug` (String) Set the cutoff for shard level slow search logging of slow searches for indexing queries, in time units, e.g. `2s`
Expand Down
1 change: 0 additions & 1 deletion docs/resources/elasticsearch_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ resource "elasticstack_elasticsearch_index" "my_index" {
- `final_pipeline` (String) Final ingest pipeline for the index. Indexing requests will fail if the final pipeline is set and the pipeline does not exist. The final pipeline always runs after the request pipeline (if specified) and the default pipeline (if it exists). The special pipeline name _none indicates no ingest pipeline will run.
- `gc_deletes` (String) The length of time that a deleted document's version number remains available for further versioned operations.
- `highlight_max_analyzed_offset` (Number) The maximum number of characters that will be analyzed for a highlight request.
- `include_type_name` (Boolean) If true, a mapping type is expected in the body of mappings. Defaults to false. Supported for Elasticsearch 7.x.
- `indexing_slowlog_level` (String) Set which logging level to use for the search slow log, can be: `warn`, `info`, `debug`, `trace`
- `indexing_slowlog_source` (String) Set the number of characters of the `_source` to include in the slowlog lines, `false` or `0` will skip logging the source entirely and setting it to `true` will log the entire source regardless of size. The original `_source` is reformatted by default to make sure that it fits on a single log line.
- `indexing_slowlog_threshold_index_debug` (String) Set the cutoff for shard level slow search logging of slow searches for indexing queries, in time units, e.g. `2s`
Expand Down
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ toolchain go1.23.1

require (
github.com./disaster37/go-kibana-rest/v8 v8.5.0
github.com./elastic/go-elasticsearch/v7 v7.17.10
github.com./elastic/elastic-transport-go/v8 v8.6.0
github.com./elastic/go-elasticsearch/v8 v8.15.0
github.com./google/gofuzz v1.2.0
github.com./google/uuid v1.6.0
github.com./hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
Expand All @@ -33,6 +34,8 @@ require (
github.com./cloudflare/circl v1.3.9 // indirect
github.com./davecgh/go-spew v1.1.1 // indirect
github.com./fatih/color v1.17.0 // indirect
github.com./go-logr/logr v1.4.1 // indirect
github.com./go-logr/stdr v1.2.2 // indirect
github.com./go-resty/resty/v2 v2.15.3 // indirect
github.com./go-test/deep v1.0.8 // indirect
github.com./golang/protobuf v1.5.4 // indirect
Expand Down Expand Up @@ -68,6 +71,9 @@ require (
github.com./vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com./vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com./zclconf/go-cty v1.15.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
Expand Down
19 changes: 17 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ github.com./cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG
github.com./davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com./davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com./davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com./elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxxUhhltAs3Gyu1yo=
github.com./elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4=
github.com./elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
github.com./elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
github.com./elastic/go-elasticsearch/v8 v8.15.0 h1:IZyJhe7t7WI3NEFdcHnf6IJXqpRf+8S8QWLtZYYyBYk=
github.com./elastic/go-elasticsearch/v8 v8.15.0/go.mod h1:HCON3zj4btpqs2N1jjsAy4a/fiAul+YBP00mBH4xik8=
github.com./emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com./emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com./fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
Expand All @@ -36,6 +38,11 @@ github.com./go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+
github.com./go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
github.com./go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
github.com./go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
github.com./go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com./go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com./go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com./go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com./go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com./go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
github.com./go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU=
github.com./go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
Expand Down Expand Up @@ -186,6 +193,14 @@ github.com./zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ
github.com./zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com./zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
github.com./zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8=
go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
2 changes: 1 addition & 1 deletion internal/clients/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com./disaster37/go-kibana-rest/v8"
"github.com./elastic/go-elasticsearch/v7"
"github.com./elastic/go-elasticsearch/v8"
"github.com./elastic/terraform-provider-elasticstack/generated/alerting"
"github.com./elastic/terraform-provider-elasticstack/generated/connectors"
"github.com./elastic/terraform-provider-elasticstack/generated/data_views"
Expand Down
2 changes: 1 addition & 1 deletion internal/clients/config/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"os"

"github.com./elastic/go-elasticsearch/v7"
"github.com./elastic/go-elasticsearch/v8"
"github.com./hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/clients/config/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

import (
"github.com./disaster37/go-kibana-rest/v8"
"github.com./elastic/go-elasticsearch/v7"
"github.com./elastic/go-elasticsearch/v8"
"github.com./elastic/terraform-provider-elasticstack/internal/clients/fleet"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/clients/config/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httputil"
"time"

"github.com./elastic/go-elasticsearch/v7/estransport"
"github.com./elastic/elastic-transport-go/v8/elastictransport"
"github.com./elastic/terraform-provider-elasticstack/internal/utils"
"github.com./hashicorp/terraform-plugin-log/tflog"
)
Expand All @@ -22,7 +22,7 @@ const logRespMsg = `%s API Response for [%s] Details:
%s
-----------------------------------------------------`

var _ estransport.Logger = &debugLogger{}
var _ elastictransport.Logger = &debugLogger{}

type debugLogger struct {
Name string
Expand Down
2 changes: 1 addition & 1 deletion internal/clients/config/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com./elastic/go-elasticsearch/v7"
"github.com./elastic/go-elasticsearch/v8"
fwdiags "github.com./hashicorp/terraform-plugin-framework/diag"
sdkdiags "github.com./hashicorp/terraform-plugin-sdk/v2/diag"
"github.com./hashicorp/terraform-plugin-sdk/v2/helper/logging"
Expand Down
8 changes: 2 additions & 6 deletions internal/clients/elasticsearch/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"strings"

"github.com./elastic/go-elasticsearch/v7/esapi"
"github.com./elastic/go-elasticsearch/v8/esapi"
"github.com./elastic/terraform-provider-elasticstack/internal/clients"
"github.com./elastic/terraform-provider-elasticstack/internal/models"
"github.com./elastic/terraform-provider-elasticstack/internal/utils"
Expand Down Expand Up @@ -268,9 +268,6 @@ func PutIndex(ctx context.Context, apiClient *clients.ApiClient, index *models.I
esClient.Indices.Create.WithMasterTimeout(params.MasterTimeout),
esClient.Indices.Create.WithTimeout(params.Timeout),
}
if params.IncludeTypeName {
opts = append(opts, esClient.Indices.Create.WithIncludeTypeName(params.IncludeTypeName))
}
res, err := esClient.Indices.Create(
index.Name,
opts...,
Expand Down Expand Up @@ -425,8 +422,7 @@ func UpdateIndexMappings(ctx context.Context, apiClient *clients.ApiClient, inde
fwdiags.NewErrorDiagnostic(err.Error(), err.Error()),
}
}
req := esClient.Indices.PutMapping.WithIndex(index)
res, err := esClient.Indices.PutMapping(strings.NewReader(mappings), req, esClient.Indices.PutMapping.WithContext(ctx))
res, err := esClient.Indices.PutMapping([]string{index}, strings.NewReader(mappings), esClient.Indices.PutMapping.WithContext(ctx))
if err != nil {
return fwdiags.Diagnostics{
fwdiags.NewErrorDiagnostic(err.Error(), err.Error()),
Expand Down
2 changes: 1 addition & 1 deletion internal/clients/elasticsearch/logstash.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func GetLogstashPipeline(ctx context.Context, apiClient *clients.ApiClient, pipe
if err != nil {
return nil, diag.FromErr(err)
}
res, err := esClient.LogstashGetPipeline(pipelineID, esClient.LogstashGetPipeline.WithContext(ctx))
res, err := esClient.LogstashGetPipeline(esClient.LogstashGetPipeline.WithDocumentID(pipelineID), esClient.LogstashGetPipeline.WithContext(ctx))
if err != nil {
return nil, diag.FromErr(err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/clients/elasticsearch/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"time"

"github.com./elastic/go-elasticsearch/v7"
"github.com./elastic/go-elasticsearch/v7/esapi"
"github.com./elastic/go-elasticsearch/v8"
"github.com./elastic/go-elasticsearch/v8/esapi"
"github.com./elastic/terraform-provider-elasticstack/internal/clients"
"github.com./elastic/terraform-provider-elasticstack/internal/models"
"github.com./elastic/terraform-provider-elasticstack/internal/utils"
Expand Down
19 changes: 0 additions & 19 deletions internal/elasticsearch/index/index/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ package index

import (
"context"
"fmt"

"github.com./elastic/terraform-provider-elasticstack/internal/clients"
"github.com./elastic/terraform-provider-elasticstack/internal/clients/elasticsearch"
"github.com./elastic/terraform-provider-elasticstack/internal/utils"
"github.com./hashicorp/go-version"
"github.com./hashicorp/terraform-plugin-framework/path"
"github.com./hashicorp/terraform-plugin-framework/resource"
"github.com./hashicorp/terraform-plugin-framework/types"
)

var includeTypeNameMinUnsupportedVersion = version.Must(version.NewVersion("8.0.0"))

func (r Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var planModel tfModel
resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...)
Expand Down Expand Up @@ -49,20 +44,6 @@ func (r Resource) Create(ctx context.Context, req resource.CreateRequest, resp *
}

params := planModel.toPutIndexParams(serverFlavor)
serverVersion, sdkDiags := client.ServerVersion(ctx)
if sdkDiags.HasError() {
resp.Diagnostics.Append(utils.FrameworkDiagsFromSDK(sdkDiags)...)
return
}

if params.IncludeTypeName && serverVersion.GreaterThanOrEqual(includeTypeNameMinUnsupportedVersion) {
resp.Diagnostics.AddAttributeError(
path.Root("include_type_name"),
"'include_type_name' field is only supported for Elasticsearch v7.x",
fmt.Sprintf("'include_type_name' field is only supported for Elasticsearch v7.x. Got %s", serverVersion),
)
return
}

resp.Diagnostics.Append(elasticsearch.PutIndex(ctx, client, &apiModel, &params)...)
if resp.Diagnostics.HasError() {
Expand Down
2 changes: 0 additions & 2 deletions internal/elasticsearch/index/index/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ type tfModel struct {
Mappings jsontypes.Normalized `tfsdk:"mappings"`
SettingsRaw jsontypes.Normalized `tfsdk:"settings_raw"`
DeletionProtection types.Bool `tfsdk:"deletion_protection"`
IncludeTypeName types.Bool `tfsdk:"include_type_name"`
WaitForActiveShards types.String `tfsdk:"wait_for_active_shards"`
MasterTimeout customtypes.Duration `tfsdk:"master_timeout"`
Timeout customtypes.Duration `tfsdk:"timeout"`
Expand Down Expand Up @@ -293,7 +292,6 @@ func (model tfModel) toPutIndexParams(serverFlavor string) models.PutIndexParams

if serverFlavor != "serverless" {
params.WaitForActiveShards = model.WaitForActiveShards.ValueString()
params.IncludeTypeName = model.IncludeTypeName.ValueBool()
}

return params
Expand Down
2 changes: 0 additions & 2 deletions internal/elasticsearch/index/index/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,11 @@ func Test_tfModel_toPutIndexParams(t *testing.T) {
MasterTimeout: customtypes.NewDurationValue(expectedParams.MasterTimeout.String()),
Timeout: customtypes.NewDurationValue(expectedParams.Timeout.String()),
WaitForActiveShards: basetypes.NewStringValue(expectedParams.WaitForActiveShards),
IncludeTypeName: basetypes.NewBoolValue(expectedParams.IncludeTypeName),
}

flavor := "not_serverless"
if isServerless {
flavor = "serverless"
expectedParams.IncludeTypeName = false
expectedParams.WaitForActiveShards = ""
}

Expand Down
8 changes: 0 additions & 8 deletions internal/elasticsearch/index/index/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,6 @@ func getSchema() schema.Schema {
planmodifiers.BoolUseDefaultIfUnknown(true),
},
},
"include_type_name": schema.BoolAttribute{
Description: "If true, a mapping type is expected in the body of mappings. Defaults to false. Supported for Elasticsearch 7.x.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
planmodifiers.BoolUseDefaultIfUnknown(false),
},
},
"wait_for_active_shards": schema.StringAttribute{
Description: "The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (number_of_replicas+1). Default: `1`, the primary shard. This value is ignored when running against Serverless projects.",
Optional: true,
Expand Down
1 change: 0 additions & 1 deletion internal/elasticsearch/index/indices/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ type indexTfModel struct {
AnalysisFilter jsontypes.Normalized `tfsdk:"analysis_filter"`
AnalysisNormalizer jsontypes.Normalized `tfsdk:"analysis_normalizer"`
DeletionProtection types.Bool `tfsdk:"deletion_protection"`
IncludeTypeName types.Bool `tfsdk:"include_type_name"`
WaitForActiveShards types.String `tfsdk:"wait_for_active_shards"`
MasterTimeout customtypes.Duration `tfsdk:"master_timeout"`
Timeout customtypes.Duration `tfsdk:"timeout"`
Expand Down
5 changes: 0 additions & 5 deletions internal/elasticsearch/index/indices/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,6 @@ func getSchema() schema.Schema {
Computed: true,
Description: "Whether to allow Terraform to destroy the index. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply command that deletes the instance will fail.",
},
"include_type_name": schema.BoolAttribute{
Description: "If true, a mapping type is expected in the body of mappings. Defaults to false. Supported for Elasticsearch 7.x.",
Optional: true,
Computed: true,
},
"wait_for_active_shards": schema.StringAttribute{
Description: "The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (number_of_replicas+1). Default: `1`, the primary shard. This value is ignored when running against Serverless projects.",
Optional: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/elasticsearch/logstash/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func checkResourceLogstashPipelineDestroy(s *terraform.State) error {
if err != nil {
return err
}
res, err := esClient.LogstashGetPipeline(compId.ResourceId)
res, err := esClient.LogstashGetPipeline(esClient.LogstashGetPipeline.WithDocumentID(compId.ResourceId))
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion internal/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ type PutIndexParams struct {
WaitForActiveShards string
MasterTimeout time.Duration
Timeout time.Duration
IncludeTypeName bool // IncludeTypeName is supported only in v7.x
}

type IndexAlias struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"time"

"github.com./elastic/go-elasticsearch/v7/esapi"
"github.com./elastic/go-elasticsearch/v8/esapi"
providerSchema "github.com./elastic/terraform-provider-elasticstack/internal/schema"
"github.com./hashicorp/terraform-plugin-framework/diag"
fwdiag "github.com./hashicorp/terraform-plugin-framework/diag"
Expand Down
Loading