Do not use scroll when finding duplicate API key (#45026)

When we create API key we check if the API key with the name
already exists. It searches with scroll enabled and this causes
the request to fail when creating large number of API keys in
parallel as it hits the number of open scroll limit (default 500).
We do not need the search context to be created so this commit
removes the scroll parameter from the search request for duplicate
API key.
This commit is contained in:
Yogesh Gaikwad 2019-08-02 09:29:46 +10:00 committed by Yogesh Gaikwad
parent 8a6675b994
commit ae5c01e2d2
1 changed files with 0 additions and 1 deletions

View File

@ -211,7 +211,6 @@ public class ApiKeyService {
boolQuery.filter(expiredQuery); boolQuery.filter(expiredQuery);
final SearchRequest searchRequest = client.prepareSearch(SECURITY_MAIN_ALIAS) final SearchRequest searchRequest = client.prepareSearch(SECURITY_MAIN_ALIAS)
.setScroll(DEFAULT_KEEPALIVE_SETTING.get(settings))
.setQuery(boolQuery) .setQuery(boolQuery)
.setVersion(false) .setVersion(false)
.setSize(1) .setSize(1)