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:
parent
8a6675b994
commit
ae5c01e2d2
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue