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
23 changes: 22 additions & 1 deletion installer/services/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ func InitOpenSearch() error {
return err
}

if err := execCurl(containerID, "PUT", "https://localhost:9200/v11-alert-*,v11-log-*,.utm-*,.utmstack-*/_settings?allow_no_indices=true", `{"index.mapping.total_fields.limit":50000}`); err != nil {
logTemplateData := `{"index_patterns":["v11-log-*"],"template":{"settings":{"index.max_shards":30000}}}`
if err := execCurl(containerID, "PUT", "https://localhost:9200/_index_template/utmstack_log_indexes", logTemplateData); err != nil {
return err
}


// Restore geoip snapshot
restoreData := `{"indices":".utm-geoip","include_global_state":false}`
if err := execCurl(containerID, "POST", "https://localhost:9200/_snapshot/.utm_geoip/.utm_geoip/_restore", restoreData); err != nil {
Expand All @@ -75,3 +77,22 @@ func InitOpenSearch() error {

return nil
}

func UpdateOpenSearch() error{

containerID, err := getOpenSearchContainerID()
if err != nil {
return err
}
// updated already existing index (update case)
if err := execCurl(containerID, "PUT", "https://localhost:9200/v11-log-*/_settings?allow_no_indices=true", `{"index.max_shards":30000}`); err != nil {
return err
}

if err := execCurl(containerID, "PUT", "https://localhost:9200/v11-alert-*,v11-log-*,.utm-*,.utmstack-*/_settings?allow_no_indices=true", `{"index.mapping.total_fields.limit":50000}`); err != nil {
return err
}
return nil

}

10 changes: 10 additions & 0 deletions installer/setup/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ func Apply(version string, updating bool) (string, error) {
return "", err
}
fmt.Println(" [OK]")
}else if utils.GetLock(20260926001, stack.LocksDir) {
fmt.Print("Updating OpenSearch.")
if err := services.UpdateOpenSearch(); err != nil {
return "", err
}

if err := utils.SetLock(20260926001, stack.LocksDir); err != nil {
return "", err
}
fmt.Println(" [OK]")
}

if !updating {
Expand Down
Loading