MM-53962: Adding ES8 dependency (#24399)

* Adding ES8 dependency

```release-note
NONE
```


Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Agniva De Sarker 2024-07-11 13:13:31 +05:30 committed by GitHub
parent a695a755f6
commit 177389d224
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 149 additions and 35 deletions

View File

@ -128,7 +128,7 @@ $(if mme2e_is_token_in_list "elasticsearch" "$ENABLED_DOCKER_SERVICES"; then
if [ "$MME2E_ARCHTYPE" = "arm64" ]; then
echo '
elasticsearch:
image: mattermostdevelopment/mattermost-elasticsearch:7.17.10
image: mattermostdevelopment/mattermost-elasticsearch:8.9.0
platform: linux/arm64/v8
restart: "no"
network_mode: host

View File

@ -589,6 +589,7 @@ const defaultServerConfig: AdminConfig = {
ConnectionURL: 'http://localhost:9200',
Username: 'elastic',
Password: 'changeme',
Backend: 'elasticsearch',
EnableIndexing: false,
EnableSearching: false,
EnableAutocomplete: false,

View File

@ -0,0 +1,3 @@
FROM opensearchproject/opensearch:2.7.0
RUN /usr/share/opensearch/bin/opensearch-plugin install analysis-icu

View File

@ -31,6 +31,7 @@ func main() {
"inbucket": 9001,
"openldap": 389,
"elasticsearch": 9200,
"opensearch": 9201,
"dejavu": 1358,
"keycloak": 8080,
"prometheus": 9090,

View File

@ -87,7 +87,7 @@ services:
LDAP_DOMAIN: "mm.test.com"
LDAP_ADMIN_PASSWORD: "mostest"
elasticsearch:
image: "mattermostdevelopment/mattermost-elasticsearch:7.17.10"
image: "mattermostdevelopment/mattermost-elasticsearch:8.9.0"
networks:
- mm-test
environment:
@ -98,6 +98,25 @@ services:
http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
http.cors.allow-credentials: "true"
transport.host: "127.0.0.1"
xpack.security.enabled: "false"
action.destructive_requires_name: "false"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
opensearch:
build:
context: .
dockerfile: ./Dockerfile.opensearch
networks:
- mm-test
environment:
http.host: "0.0.0.0"
http.port: 9201
http.cors.enabled: "true"
http.cors.allow-origin: "http://localhost:1358,http://127.0.0.1:1358"
http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
http.cors.allow-credentials: "true"
transport.host: "127.0.0.1"
discovery.type: single-node
plugins.security.disabled: "true"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
dejavu:
image: "appbaseio/dejavu:3.4.2"

View File

@ -28,6 +28,10 @@ services:
extends:
file: docker-compose.common.yml
service: elasticsearch
opensearch:
extends:
file: docker-compose.common.yml
service: opensearch
dejavu:
extends:
file: docker-compose.common.yml
@ -64,7 +68,8 @@ services:
- inbucket
- openldap
- elasticsearch
command: postgres:5432 mysql:3306 minio:9000 inbucket:9001 openldap:389 elasticsearch:9200
- opensearch
command: postgres:5432 mysql:3306 minio:9000 inbucket:9001 openldap:389 elasticsearch:9200 opensearch:9201
networks:
mm-test:

View File

@ -234,8 +234,9 @@ func (srv *JobServer) HandleJobPanic(logger mlog.LoggerIFace, job *model.Job) {
rerr = fmt.Errorf("job panic: %v", r)
}
appErr := srv.SetJobError(job, model.NewAppError("HandleJobPanic", "app.job.update.app_error", nil, "", http.StatusInternalServerError)).Wrap(rerr)
appErr := srv.SetJobError(job, model.NewAppError("HandleJobPanic", "app.job.update.app_error", nil, "", http.StatusInternalServerError))
if appErr != nil {
appErr = appErr.Wrap(rerr)
logger.Error("Failed to set the job status to 'failed'", mlog.Err(appErr), mlog.Any("job", job))
}

View File

@ -12,6 +12,7 @@ package commands
import (
// Enterprise Deps
_ "github.com/elastic/go-elasticsearch/v8"
_ "github.com/gorilla/handlers"
_ "github.com/hako/durafmt"
_ "github.com/hashicorp/memberlist"
@ -24,5 +25,4 @@ import (
_ "github.com/prometheus/client_golang/prometheus/collectors"
_ "github.com/prometheus/client_golang/prometheus/promhttp"
_ "github.com/tylerb/graceful"
_ "gopkg.in/olivere/elastic.v6"
)

View File

@ -1,7 +1,7 @@
version: '2.4'
services:
elasticsearch:
image: "mattermostdevelopment/mattermost-elasticsearch:7.17.10"
image: "mattermostdevelopment/mattermost-elasticsearch:8.9.0"
platform: linux/arm64/v8
restart: 'no'
container_name: mattermost-elasticsearch

View File

@ -60,6 +60,13 @@ services:
extends:
file: build/docker-compose.common.yml
service: elasticsearch
opensearch:
container_name: mattermost-opensearch
ports:
- "9201:9201"
extends:
file: build/docker-compose.common.yml
service: opensearch
dejavu:
restart: 'no'
container_name: mattermost-dejavu

View File

@ -53,6 +53,13 @@ services:
extends:
file: build/docker-compose.common.yml
service: elasticsearch
opensearch:
container_name: mattermost-opensearch
ports:
- "9201:9201"
extends:
file: build/docker-compose.common.yml
service: opensearch
dejavu:
container_name: mattermost-dejavu
ports:
@ -107,11 +114,12 @@ services:
- inbucket
- openldap
- elasticsearch
- opensearch
- prometheus
- grafana
- loki
- promtail
command: postgres:5432 mysql:3306 minio:9000 inbucket:9001 openldap:389 elasticsearch:9200 prometheus:9090 grafana:3000 loki:3100 promtail:3180
command: postgres:5432 mysql:3306 minio:9000 inbucket:9001 openldap:389 elasticsearch:9200 opensearch:9201 prometheus:9090 grafana:3000 loki:3100 promtail:3180
leader:
build:

View File

@ -15,6 +15,7 @@ require (
github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3
github.com/disintegration/imaging v1.6.2
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a
github.com/elastic/go-elasticsearch/v8 v8.4.0-alpha.1.0.20230719162115-b74bbf87c923
github.com/fatih/color v1.16.0
github.com/fsnotify/fsnotify v1.7.0
github.com/getsentry/sentry-go v0.27.0
@ -79,7 +80,6 @@ require (
golang.org/x/term v0.17.0
golang.org/x/tools v0.18.0
gopkg.in/mail.v2 v2.3.1
gopkg.in/olivere/elastic.v6 v6.2.37
gopkg.in/yaml.v2 v2.4.0
)
@ -119,9 +119,9 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6 // indirect
github.com/fatih/set v0.2.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fortytw2/leaktest v1.3.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/gigawattio/window v0.0.0-20180317192513-0f5467e35573 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
@ -148,7 +148,6 @@ require (
github.com/isacikgoz/fuzzy v0.2.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
@ -156,7 +155,6 @@ require (
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/levigross/exp-html v0.0.0-20120902181939-8df60c69a8f5 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
@ -174,7 +172,6 @@ require (
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/olivere/elastic v6.2.37+incompatible // indirect
github.com/otiai10/gosseract/v2 v2.4.1 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect

View File

@ -137,6 +137,10 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a h1:etIrTD8BQqzColk9nKRusM9um5+1q0iOEJLqfBMIK64=
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a/go.mod h1:emQhSYTXqB0xxjLITTw4EaWZ+8IIQYw+kx9GqNUKdLg=
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6 h1:1+44gxLdKRnR/Bx/iAtr+XqNcE4e0oODa63+FABNANI=
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
github.com/elastic/go-elasticsearch/v8 v8.4.0-alpha.1.0.20230719162115-b74bbf87c923 h1:rnREIQkmMvcD53Ffjj+w3KP9u+k42isNhyWUrCj65TM=
github.com/elastic/go-elasticsearch/v8 v8.4.0-alpha.1.0.20230719162115-b74bbf87c923/go.mod h1:NGmpvohKiRHXI0Sw4fuUGn6hYOmAXlyCphKpzVBiqDE=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
@ -147,8 +151,6 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk=
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
@ -303,8 +305,6 @@ github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Cc
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@ -353,8 +353,6 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 h1:Khvh6waxG1cHc4Cz5ef9n3XVCxRWpAKUtqg9PJl5+y8=
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34=
github.com/mattermost/gosaml2 v0.8.0 h1:nkYiByawqwJ7KncK1LDWKwTx5aRarBTQsmH+XcCVsWQ=
@ -433,8 +431,6 @@ github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DV
github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/olivere/elastic v6.2.37+incompatible h1:UfSGJem5czY+x/LqxgeCBgjDn6St+z8OnsCuxwD3L0U=
github.com/olivere/elastic v6.2.37+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb h1:JF9kOhBBk4WPF7luXFu5yR+WgaFm9L/KiHJHhU9vDwA=
github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb/go.mod h1:GHI1bnmAcbp96z6LNfBJvtrjxhaXGkbsk967utPlvL8=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
@ -855,8 +851,6 @@ gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/olivere/elastic.v6 v6.2.37 h1:y1SqAL8MJvKckEOo3aZ+Ie0TDIYjrItZ9WBN3VzhoRM=
gopkg.in/olivere/elastic.v6 v6.2.37/go.mod h1:2cTT8Z+/LcArSWpCgvZqBgt3VOqXiy7v00w12Lz8bd4=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -7442,10 +7442,6 @@
"id": "ent.elasticsearch.aggregator_worker.index_job_failed.error",
"translation": "Elasticsearch aggregator worker failed due to the indexing job failing"
},
{
"id": "ent.elasticsearch.create_client.ca_cert_malformed",
"translation": "Decoding of the CA for Elasticsearch failed"
},
{
"id": "ent.elasticsearch.create_client.ca_cert_missing",
"translation": "Could not open the CA file for Elasticsearch"
@ -7650,10 +7646,6 @@
"id": "ent.elasticsearch.search_users.unmarshall_user_failed",
"translation": "Failed to decode search results"
},
{
"id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error",
"translation": "Failed to create Elasticsearch bulk processor."
},
{
"id": "ent.elasticsearch.start.get_server_version.app_error",
"translation": "Failed to get Elasticsearch server version."
@ -7662,10 +7654,6 @@
"id": "ent.elasticsearch.start.parse_server_version.app_error",
"translation": "Failed to parse Elasticsearch server version."
},
{
"id": "ent.elasticsearch.start.start_bulk_processor_failed.app_error",
"translation": "Failed to start Elasticsearch bulk processor."
},
{
"id": "ent.elasticsearch.stop.already_stopped.app_error",
"translation": "Elasticsearch is already stopped."
@ -8618,6 +8606,10 @@
"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.invalid_backend.app_error",
"translation": "Invalid search backend. Must be either elasticsearch or opensearch."
},
{
"id": "model.config.is_valid.elastic_search.live_indexing_batch_size.app_error",
"translation": "Elasticsearch Live Indexing Batch Size must be at least 1."

View File

@ -7,6 +7,7 @@ func NewBool(b bool) *bool { return &b }
func NewInt(n int) *int { return &n }
func NewInt64(n int64) *int64 { return &n }
func NewString(s string) *string { return &s }
func NewPointer[T any](t T) *T { return &t }
// SafeDereference returns the zero value of T if t is nil.
// Otherwise it return the derference of t.

View File

@ -205,6 +205,8 @@ const (
ElasticsearchSettingsDefaultLiveIndexingBatchSize = 1
ElasticsearchSettingsDefaultRequestTimeoutSeconds = 30
ElasticsearchSettingsDefaultBatchSize = 10000
ElasticsearchSettingsESBackend = "elasticsearch"
ElasticsearchSettingsOSBackend = "opensearch"
BleveSettingsDefaultIndexDir = ""
BleveSettingsDefaultBatchSize = 10000
@ -2763,6 +2765,7 @@ func (s *NativeAppSettings) SetDefaults() {
type ElasticsearchSettings struct {
ConnectionURL *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
Backend *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
Username *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
Password *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
EnableIndexing *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
@ -2795,6 +2798,10 @@ func (s *ElasticsearchSettings) SetDefaults() {
s.ConnectionURL = NewString(ElasticsearchSettingsDefaultConnectionURL)
}
if s.Backend == nil {
s.Backend = NewString(ElasticsearchSettingsESBackend)
}
if s.Username == nil {
s.Username = NewString(ElasticsearchSettingsDefaultUsername)
}
@ -4173,6 +4180,10 @@ func (s *ElasticsearchSettings) isValid() *AppError {
}
}
if *s.Backend != ElasticsearchSettingsOSBackend && *s.Backend != ElasticsearchSettingsESBackend {
return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.invalid_backend.app_error", nil, "", http.StatusBadRequest)
}
return nil
}

View File

@ -323,6 +323,7 @@
},
"ElasticsearchSettings": {
"ConnectionUrl": "http://localhost:9200",
"Backend": "elasticsearch",
"Username": "elastic",
"Password": "changeme",
"EnableIndexing": false,

View File

@ -52,6 +52,30 @@ exports[`components/ElasticSearchSettings should match snapshot, disabled 1`] =
}
value={false}
/>
<AdminTextSetting
disabled={true}
helpText={
<Memo(MemoizedFormattedMessage)
defaultMessage="The type of the search backend."
id="admin.elasticsearch.backendDescription"
/>
}
id="backend"
label={
<Memo(MemoizedFormattedMessage)
defaultMessage="Backend type:"
id="admin.elasticsearch.backendTitle"
/>
}
onChange={[Function]}
placeholder={
Object {
"defaultMessage": "E.g.: \\"elasticsearch\\"",
"id": "admin.elasticsearch.backendExample",
}
}
setByEnv={false}
/>
<AdminTextSetting
disabled={true}
helpText={
@ -602,6 +626,30 @@ exports[`components/ElasticSearchSettings should match snapshot, enabled 1`] = `
}
value={true}
/>
<AdminTextSetting
disabled={false}
helpText={
<Memo(MemoizedFormattedMessage)
defaultMessage="The type of the search backend."
id="admin.elasticsearch.backendDescription"
/>
}
id="backend"
label={
<Memo(MemoizedFormattedMessage)
defaultMessage="Backend type:"
id="admin.elasticsearch.backendTitle"
/>
}
onChange={[Function]}
placeholder={
Object {
"defaultMessage": "E.g.: \\"elasticsearch\\"",
"id": "admin.elasticsearch.backendExample",
}
}
setByEnv={false}
/>
<AdminTextSetting
disabled={false}
helpText={

View File

@ -24,6 +24,7 @@ import TextSetting from './text_setting';
interface State extends BaseState {
connectionUrl: string;
backend: string;
skipTLSVerification: boolean;
ca: string;
clientCert: string;
@ -50,6 +51,7 @@ export const messages = defineMessages({
enableIndexingDescription: {id: 'admin.elasticsearch.enableIndexingDescription', defaultMessage: 'When true, indexing of new posts occurs automatically. Search queries will use database search until "Enable Elasticsearch for search queries" is enabled. <link>Learn more about Elasticsearch in our documentation.</link>'},
connectionUrlTitle: {id: 'admin.elasticsearch.connectionUrlTitle', defaultMessage: 'Server Connection Address:'},
connectionUrlDescription: {id: 'admin.elasticsearch.connectionUrlDescription', defaultMessage: 'The address of the Elasticsearch server. <link>Please see documentation with server setup instructions.</link>'},
backendTitle: {id: 'admin.elasticsearch.backendTitle', defaultMessage: 'Backend type:'},
skipTLSVerificationTitle: {id: 'admin.elasticsearch.skipTLSVerificationTitle', defaultMessage: 'Skip TLS Verification:'},
skipTLSVerificationDescription: {id: 'admin.elasticsearch.skipTLSVerificationDescription', defaultMessage: 'When true, Mattermost will not require the Elasticsearch certificate to be signed by a trusted Certificate Authority.'},
usernameTitle: {id: 'admin.elasticsearch.usernameTitle', defaultMessage: 'Server Username:'},
@ -100,6 +102,7 @@ export const searchableStrings: Array<string|MessageDescriptor|[MessageDescripto
export default class ElasticsearchSettings extends AdminSettings<Props, State> {
getConfigFromState = (config: AdminConfig) => {
config.ElasticsearchSettings.ConnectionURL = this.state.connectionUrl;
config.ElasticsearchSettings.Backend = this.state.backend;
config.ElasticsearchSettings.SkipTLSVerification = this.state.skipTLSVerification;
config.ElasticsearchSettings.CA = this.state.ca;
config.ElasticsearchSettings.ClientCert = this.state.clientCert;
@ -118,6 +121,7 @@ export default class ElasticsearchSettings extends AdminSettings<Props, State> {
getStateFromConfig(config: AdminConfig) {
return {
connectionUrl: config.ElasticsearchSettings.ConnectionURL,
backend: config.ElasticsearchSettings.Backend,
skipTLSVerification: config.ElasticsearchSettings.SkipTLSVerification,
ca: config.ElasticsearchSettings.CA,
clientCert: config.ElasticsearchSettings.ClientCert,
@ -150,7 +154,7 @@ export default class ElasticsearchSettings extends AdminSettings<Props, State> {
}
}
if (id === 'connectionUrl' || id === 'skipTLSVerification' || id === 'username' || id === 'password' || id === 'sniff' || id === 'ca' || id === 'clientCert' || id === 'clientKey') {
if (id === 'connectionUrl' || id === 'backend' || id === 'skipTLSVerification' || id === 'username' || id === 'password' || id === 'sniff' || id === 'ca' || id === 'clientCert' || id === 'clientKey') {
this.setState({
configTested: false,
canSave: false,
@ -261,6 +265,23 @@ export default class ElasticsearchSettings extends AdminSettings<Props, State> {
setByEnv={this.isSetByEnv('ElasticsearchSettings.EnableIndexing')}
disabled={this.props.isDisabled}
/>
<TextSetting
id='backend'
label={
<FormattedMessage {...messages.backendTitle}/>
}
placeholder={defineMessage({id: 'admin.elasticsearch.backendExample', defaultMessage: 'E.g.: "elasticsearch"'})}
helpText={
<FormattedMessage
id='admin.elasticsearch.backendDescription'
defaultMessage='The type of the search backend.'
/>
}
value={this.state.backend}
disabled={this.props.isDisabled || !this.state.enableIndexing}
onChange={this.handleSettingChanged}
setByEnv={this.isSetByEnv('ElasticsearchSettings.Backend')}
/>
<TextSetting
id='connectionUrl'
label={

View File

@ -741,6 +741,9 @@
"admin.database.search_backend.title": "Active Search Backend",
"admin.database.title": "Database",
"admin.developer.title": "Developer Settings",
"admin.elasticsearch.backendDescription": "The type of the search backend.",
"admin.elasticsearch.backendExample": "E.g.: \"elasticsearch\"",
"admin.elasticsearch.backendTitle": "Backend type:",
"admin.elasticsearch.bulkIndexingTitle": "Bulk Indexing:",
"admin.elasticsearch.caDescription": "(Optional) Custom Certificate Authority certificates for the Elasticsearch server. Leave this empty to use the default CAs from the operating system.",
"admin.elasticsearch.caExample": "E.g.: \"./elasticsearch/ca.pem\"",

View File

@ -795,6 +795,7 @@ export type AnalyticsSettings = {
export type ElasticsearchSettings = {
ConnectionURL: string;
Backend: string;
Username: string;
Password: string;
EnableIndexing: boolean;