summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-02 14:50:09 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-02 09:50:09 -0400
commit29be10ca2f6ce0c72d90309eb00dbd02224c8e08 (patch)
tree4fd2be3d4adee7299870c72efd7804e0c8f9d8c0 /model
parentb47cf82043f737b3ae944f8e31a06d15227e91e2 (diff)
downloadchat-29be10ca2f6ce0c72d90309eb00dbd02224c8e08.tar.gz
chat-29be10ca2f6ce0c72d90309eb00dbd02224c8e08.tar.bz2
chat-29be10ca2f6ce0c72d90309eb00dbd02224c8e08.zip
PLT-7275: Configure replica/shard count for Elasticsearch indexes. (#7093)
Diffstat (limited to 'model')
-rw-r--r--model/config.go32
1 files changed, 23 insertions, 9 deletions
diff --git a/model/config.go b/model/config.go
index 8c7cd0d68..0bcc092f7 100644
--- a/model/config.go
+++ b/model/config.go
@@ -119,9 +119,11 @@ const (
ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_COLOR = "#f2a93b"
ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_TEXT_COLOR = "#333333"
- ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL = ""
- ELASTICSEARCH_SETTINGS_DEFAULT_USERNAME = ""
- ELASTICSEARCH_SETTINGS_DEFAULT_PASSWORD = ""
+ ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL = ""
+ ELASTICSEARCH_SETTINGS_DEFAULT_USERNAME = ""
+ ELASTICSEARCH_SETTINGS_DEFAULT_PASSWORD = ""
+ ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_REPLICAS = 2
+ ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_SHARDS = 1
)
type ServiceSettings struct {
@@ -432,12 +434,14 @@ type WebrtcSettings struct {
}
type ElasticsearchSettings struct {
- ConnectionUrl *string
- Username *string
- Password *string
- EnableIndexing *bool
- EnableSearching *bool
- Sniff *bool
+ ConnectionUrl *string
+ Username *string
+ Password *string
+ EnableIndexing *bool
+ EnableSearching *bool
+ Sniff *bool
+ PostIndexReplicas *int
+ PostIndexShards *int
}
type DataRetentionSettings struct {
@@ -1417,6 +1421,16 @@ func (o *Config) SetDefaults() {
*o.ElasticsearchSettings.Sniff = true
}
+ if o.ElasticsearchSettings.PostIndexReplicas == nil {
+ o.ElasticsearchSettings.PostIndexReplicas = new(int)
+ *o.ElasticsearchSettings.PostIndexReplicas = ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_REPLICAS
+ }
+
+ if o.ElasticsearchSettings.PostIndexShards == nil {
+ o.ElasticsearchSettings.PostIndexShards = new(int)
+ *o.ElasticsearchSettings.PostIndexShards = ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_SHARDS
+ }
+
if o.DataRetentionSettings.Enable == nil {
o.DataRetentionSettings.Enable = new(bool)
*o.DataRetentionSettings.Enable = false