[MM-49084] public/model/config: elasticsearch: add ingore option to some indexes to purge (#23571)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b9f52126c2
Коммит
446b474489
@@ -8687,6 +8687,10 @@
|
||||
"id": "model.config.is_valid.elastic_search.enable_searching.app_error",
|
||||
"translation": "Elasticsearch EnableIndexing setting must be set to true when Elasticsearch EnableSearching is set to true"
|
||||
},
|
||||
{
|
||||
"id": "model.config.is_valid.elastic_search.ignored_indexes_dash_prefix.app_error",
|
||||
"translation": "Ignored indexes for purge should not start with dash."
|
||||
},
|
||||
{
|
||||
"id": "model.config.is_valid.elastic_search.live_indexing_batch_size.app_error",
|
||||
"translation": "Elasticsearch Live Indexing Batch Size must be at least 1."
|
||||
|
||||
@@ -2628,6 +2628,7 @@ type ElasticsearchSettings struct {
|
||||
ClientCert *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
ClientKey *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
Trace *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
IgnoredPurgeIndexes *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
}
|
||||
|
||||
func (s *ElasticsearchSettings) SetDefaults() {
|
||||
@@ -2726,6 +2727,10 @@ func (s *ElasticsearchSettings) SetDefaults() {
|
||||
if s.Trace == nil {
|
||||
s.Trace = NewString("")
|
||||
}
|
||||
|
||||
if s.IgnoredPurgeIndexes == nil {
|
||||
s.IgnoredPurgeIndexes = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
type BleveSettings struct {
|
||||
@@ -3874,6 +3879,15 @@ func (s *ElasticsearchSettings) isValid() *AppError {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.request_timeout_seconds.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if ign := *s.IgnoredPurgeIndexes; ign != "" {
|
||||
s := strings.Split(ign, ",")
|
||||
for _, ix := range s {
|
||||
if strings.HasPrefix(ix, "-") {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.ignored_indexes_dash_prefix.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user