Skip to content

Commit

Permalink
Elasticsearch: Use array of strings as index in backend queries (#67276)
Browse files Browse the repository at this point in the history
Elasticsearch: Use array of strings as indice in backend queries
  • Loading branch information
ivanahuckova committed Apr 26, 2023
1 parent a420040 commit d0ced39
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/tsdb/elasticsearch/client/client.go
Expand Up @@ -207,7 +207,7 @@ func (c *baseClientImpl) createMultiSearchRequests(searchRequests []*SearchReque
header: map[string]interface{}{
"search_type": "query_then_fetch",
"ignore_unavailable": true,
"index": strings.Join(c.indices, ","),
"index": c.indices,
},
body: searchReq,
interval: searchReq.Interval,
Expand Down
2 changes: 1 addition & 1 deletion pkg/tsdb/elasticsearch/client/client_test.go
Expand Up @@ -96,7 +96,7 @@ func TestClient_ExecuteMultisearch(t *testing.T) {
jBody, err := simplejson.NewJson(bodyBytes)
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.Equal(t, "query_then_fetch", jHeader.Get("search_type").MustString())
assert.Empty(t, jHeader.Get("max_concurrent_shard_requests"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/tsdb/elasticsearch/snapshot_test.go
Expand Up @@ -82,7 +82,7 @@ func TestRequestSnapshots(t *testing.T) {
queryHeader := []byte(`
{
"ignore_unavailable": true,
"index": "testdb-2022.11.14",
"index": ["testdb-2022.11.14"],
"search_type": "query_then_fetch"
}
`)
Expand Down

0 comments on commit d0ced39

Please sign in to comment.