Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Add `elasticstack_elasticsearch_security_role_mapping` data source ([#178](https://github.com/elastic/terraform-provider-elasticstack/pull/178))
- Apply `total_shards_per_node` setting in `allocate` action in ILM. Supported from Elasticsearch version **7.16** ([#112](https://github.com/elastic/terraform-provider-elasticstack/issues/112))
- Add `elasticstack_elasticsearch_security_api_key` resource ([#193](https://github.com/elastic/terraform-provider-elasticstack/pull/193))
- Add `unassigned_node_left_delayed_timeout` to index resource ([#196](https://github.com/elastic/terraform-provider-elasticstack/pull/196))

### Fixed
- Remove unnecessary unsetting id on delete ([#174](https://github.com/elastic/terraform-provider-elasticstack/pull/174))
Expand Down
1 change: 1 addition & 0 deletions docs/resources/elasticsearch_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ If specified, this mapping can include: field names, [field data types](https://
- `shard_check_on_startup` (String) Whether or not shards should be checked for corruption before opening. When corruption is detected, it will prevent the shard from being opened. Accepts `false`, `true`, `checksum`.
- `sort_field` (Set of String) The field to sort shards in this index by.
- `sort_order` (List of String) The direction to sort shards in. Accepts `asc`, `desc`.
- `unassigned_node_left_delayed_timeout` (String) Time to delay the allocation of replica shards which become unassigned because a node has left, in time units, e.g. `10s`

### Read-Only

Expand Down
7 changes: 7 additions & 0 deletions internal/elasticsearch/index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (
"gc_deletes": schema.TypeString,
"default_pipeline": schema.TypeString,
"final_pipeline": schema.TypeString,
"unassigned.node_left.delayed_timeout": schema.TypeString,
"search.slowlog.threshold.query.warn": schema.TypeString,
"search.slowlog.threshold.query.info": schema.TypeString,
"search.slowlog.threshold.query.debug": schema.TypeString,
Expand Down Expand Up @@ -299,6 +300,12 @@ func ResourceIndex() *schema.Resource {
Description: "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.",
Optional: true,
},
"unassigned_node_left_delayed_timeout": {

Type: schema.TypeString,
Description: "Time to delay the allocation of replica shards which become unassigned because a node has left, in time units, e.g. `10s`",
Optional: true,
},
"search_slowlog_threshold_query_warn": {
Type: schema.TypeString,
Description: "Set the cutoff for shard level slow search logging of slow searches in the query phase, in time units, e.g. `10s`",
Expand Down
2 changes: 2 additions & 0 deletions internal/elasticsearch/index/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func TestAccResourceIndexSettings(t *testing.T) {
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "routing_allocation_enable", "primaries"),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "routing_rebalance_enable", "primaries"),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "gc_deletes", "30s"),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "unassigned_node_left_delayed_timeout", "5m"),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_analyzer", `{"text_en":{"char_filter":"zero_width_spaces","filter":["lowercase","minimal_english_stemmer"],"tokenizer":"standard","type":"custom"}}`),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_char_filter", `{"zero_width_spaces":{"mappings":["\\u200C=\u003e\\u0020"],"type":"mapping"}}`),
resource.TestCheckResourceAttr("elasticstack_elasticsearch_index.test_settings", "analysis_filter", `{"minimal_english_stemmer":{"language":"minimal_english","type":"stemmer"}}`),
Expand Down Expand Up @@ -245,6 +246,7 @@ resource "elasticstack_elasticsearch_index" "test_settings" {
routing_allocation_enable = "primaries"
routing_rebalance_enable = "primaries"
gc_deletes = "30s"
unassigned_node_left_delayed_timeout = "5m"

analysis_char_filter = jsonencode({
zero_width_spaces = {
Expand Down