diff --git a/x-pack/plugins/security/server/session_management/session_index.test.ts b/x-pack/plugins/security/server/session_management/session_index.test.ts index e1890273469ed..04991f4aeefd6 100644 --- a/x-pack/plugins/security/server/session_management/session_index.test.ts +++ b/x-pack/plugins/security/server/session_management/session_index.test.ts @@ -473,6 +473,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledWith({ _source_includes: 'usernameHash,provider', + allow_partial_search_results: true, sort: '_shard_doc', track_total_hits: false, search_after: undefined, @@ -555,6 +556,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledWith({ _source_includes: 'usernameHash,provider', + allow_partial_search_results: true, sort: '_shard_doc', track_total_hits: false, search_after: undefined, @@ -649,6 +651,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledWith({ _source_includes: 'usernameHash,provider', + allow_partial_search_results: true, sort: '_shard_doc', track_total_hits: false, search_after: undefined, @@ -737,6 +740,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledWith({ _source_includes: 'usernameHash,provider', + allow_partial_search_results: true, sort: '_shard_doc', track_total_hits: false, search_after: undefined, @@ -850,6 +854,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledWith({ _source_includes: 'usernameHash,provider', + allow_partial_search_results: true, sort: '_shard_doc', track_total_hits: false, search_after: undefined, diff --git a/x-pack/plugins/security/server/session_management/session_index.ts b/x-pack/plugins/security/server/session_management/session_index.ts index 9f11e9224243c..9166ec9deb91f 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -857,6 +857,7 @@ export class SessionIndex { size: SESSION_INDEX_CLEANUP_BATCH_SIZE, sort: '_shard_doc', track_total_hits: false, // for performance + allow_partial_search_results: true, }); const { hits } = searchResponse.hits; if (hits.length > 0) {