[v10.0.x] Elasticsearch: Handle no-index case in backend mode (#68629)
Elasticsearch: Handle no-index case in backend mode (#68534)
* elastic: backend migration: fix no-index case
* improved code
(cherry picked from commit fcef387151)
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
co-authored by
Gábor Farkas
parent
3c1b5dda40
commit
21e2ac6d8a
@@ -118,6 +118,12 @@ func TestClient_Index(t *testing.T) {
|
|||||||
patternInDatasource string
|
patternInDatasource string
|
||||||
indexInRequest []string
|
indexInRequest []string
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "empty string",
|
||||||
|
indexInDatasource: "",
|
||||||
|
patternInDatasource: "",
|
||||||
|
indexInRequest: []string{},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "single string",
|
name: "single string",
|
||||||
indexInDatasource: "logs-*",
|
indexInDatasource: "logs-*",
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ type staticIndexPattern struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ip *staticIndexPattern) GetIndices(timeRange backend.TimeRange) ([]string, error) {
|
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 {
|
type intervalGenerator interface {
|
||||||
|
|||||||
Reference in New Issue
Block a user