|
25 | 25 | "shard.check_on_startup", |
26 | 26 | "sort.field", |
27 | 27 | "sort.order", |
| 28 | + "index.similarity.default", |
28 | 29 | } |
29 | 30 | dynamicsSettingsKeys = []string{ |
30 | 31 | "number_of_replicas", |
@@ -141,6 +142,13 @@ var ( |
141 | 142 | ForceNew: true, |
142 | 143 | Optional: true, |
143 | 144 | }, |
| 145 | + "index_similarity_default": { |
| 146 | + Type: schema.TypeString, |
| 147 | + Description: "A JSON string describing the default index similarity config.", |
| 148 | + Optional: true, |
| 149 | + ForceNew: true, // To update index similarity config, the index must be closed, updated, and then reopened; we can't handle that here. |
| 150 | + ValidateFunc: validation.StringIsJSON, |
| 151 | + }, |
144 | 152 | // Dynamic settings that can be changed at runtime |
145 | 153 | "number_of_replicas": { |
146 | 154 | Type: schema.TypeString, |
@@ -498,6 +506,17 @@ func resourceElasticsearchIndexCreate(d *schema.ResourceData, meta interface{}) |
498 | 506 | body["mappings"] = mappings |
499 | 507 | } |
500 | 508 |
|
| 509 | + // Decode index.similarity.default JSON |
| 510 | + if defaultIndexSimilarityJSON, ok := d.GetOk("index_similarity_default"); ok { |
| 511 | + var defaultIndexSimilarity map[string]interface{} |
| 512 | + bytes := []byte(defaultIndexSimilarityJSON.(string)) |
| 513 | + err = json.Unmarshal(bytes, &defaultIndexSimilarity) |
| 514 | + if err != nil { |
| 515 | + return fmt.Errorf("fail to unmarshal: %v", err) |
| 516 | + } |
| 517 | + settings["index.similarity.default"] = defaultIndexSimilarity |
| 518 | + } |
| 519 | + |
501 | 520 | // if date math is used, we need to pass the resolved name along to the read |
502 | 521 | // so we can pull the right result from the response |
503 | 522 | var resolvedName string |
|
0 commit comments