mirror of https://github.com/grafana/grafana.git
Elasticsearch: Use array of strings as index in backend queries (#67276)
Elasticsearch: Use array of strings as indice in backend queries
This commit is contained in:
parent
a420040c73
commit
d0ced39847
|
|
@ -207,7 +207,7 @@ func (c *baseClientImpl) createMultiSearchRequests(searchRequests []*SearchReque
|
||||||
header: map[string]interface{}{
|
header: map[string]interface{}{
|
||||||
"search_type": "query_then_fetch",
|
"search_type": "query_then_fetch",
|
||||||
"ignore_unavailable": true,
|
"ignore_unavailable": true,
|
||||||
"index": strings.Join(c.indices, ","),
|
"index": c.indices,
|
||||||
},
|
},
|
||||||
body: searchReq,
|
body: searchReq,
|
||||||
interval: searchReq.Interval,
|
interval: searchReq.Interval,
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
|
||||||
jBody, err := simplejson.NewJson(bodyBytes)
|
jBody, err := simplejson.NewJson(bodyBytes)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, "metrics-2018.05.15", jHeader.Get("index").MustString())
|
assert.Equal(t, []string{"metrics-2018.05.15"}, jHeader.Get("index").MustStringArray())
|
||||||
assert.True(t, jHeader.Get("ignore_unavailable").MustBool(false))
|
assert.True(t, jHeader.Get("ignore_unavailable").MustBool(false))
|
||||||
assert.Equal(t, "query_then_fetch", jHeader.Get("search_type").MustString())
|
assert.Equal(t, "query_then_fetch", jHeader.Get("search_type").MustString())
|
||||||
assert.Empty(t, jHeader.Get("max_concurrent_shard_requests"))
|
assert.Empty(t, jHeader.Get("max_concurrent_shard_requests"))
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ func TestRequestSnapshots(t *testing.T) {
|
||||||
queryHeader := []byte(`
|
queryHeader := []byte(`
|
||||||
{
|
{
|
||||||
"ignore_unavailable": true,
|
"ignore_unavailable": true,
|
||||||
"index": "testdb-2022.11.14",
|
"index": ["testdb-2022.11.14"],
|
||||||
"search_type": "query_then_fetch"
|
"search_type": "query_then_fetch"
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue