Elastic: Store index in jsonData (#62808)

* feat(typescript): read and write index to jsonData

* feat(go): read index from jsonData

* clear database column when index-name is updated

* Update public/app/plugins/datasource/elasticsearch/datasource.ts

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

* Update public/app/plugins/datasource/elasticsearch/configuration/ElasticDetails.tsx

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

* add indexChangeHandler function

* fix

* fix failing tests

* fix

* fix

---------

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
Gareth Dawson
2023-04-19 09:30:09 +01:00
committed by GitHub
co-authored by Gábor Farkas
parent 98778289cb
commit 82a6c8a647
5 changed files with 26 additions and 15 deletions
+9 -1
View File
@@ -108,6 +108,14 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
timeInterval = ""
}
index, ok := jsonData["index"].(string)
if !ok {
index = ""
}
if index == "" {
index = settings.Database
}
var maxConcurrentShardRequests float64
switch v := jsonData["maxConcurrentShardRequests"].(type) {
@@ -142,7 +150,7 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
ID: settings.ID,
URL: settings.URL,
HTTPClient: httpCli,
Database: settings.Database,
Database: index,
MaxConcurrentShardRequests: int64(maxConcurrentShardRequests),
ConfiguredFields: configuredFields,
Interval: interval,