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:
Ivana Huckova 2023-04-26 16:07:15 +02:00 committed by GitHub
parent a420040c73
commit d0ced39847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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,

View File

@ -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"))

View File

@ -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"
}
`)