mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Handle no-index case in backend mode (#68534)
* elastic: backend migration: fix no-index case * improved code
This commit is contained in:
parent
14936f85df
commit
fcef387151
@ -118,6 +118,12 @@ func TestClient_Index(t *testing.T) {
|
||||
patternInDatasource string
|
||||
indexInRequest []string
|
||||
}{
|
||||
{
|
||||
name: "empty string",
|
||||
indexInDatasource: "",
|
||||
patternInDatasource: "",
|
||||
indexInRequest: []string{},
|
||||
},
|
||||
{
|
||||
name: "single string",
|
||||
indexInDatasource: "logs-*",
|
||||
|
@ -35,7 +35,11 @@ type staticIndexPattern struct {
|
||||
}
|
||||
|
||||
func (ip *staticIndexPattern) GetIndices(timeRange backend.TimeRange) ([]string, error) {
|
||||
return []string{ip.indexName}, nil
|
||||
if ip.indexName != "" {
|
||||
return []string{ip.indexName}, nil
|
||||
} else {
|
||||
return []string{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
type intervalGenerator interface {
|
||||
|
Loading…
Reference in New Issue
Block a user