From 690bd06a48d62d1ef227bc7740a4838af4b2b002 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 22 Nov 2024 03:03:39 +1100 Subject: [PATCH] [8.x] [Session management] update cleanup to allow partial search results for PIT query (#200912) (#201205) # Backport This will backport the following commits from `main` to `8.x`: - [[Session management] update cleanup to allow partial search results for PIT query (#200912)](https://github.com/elastic/kibana/pull/200912) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Sid --- .../security/server/session_management/session_index.test.ts | 5 +++++ .../security/server/session_management/session_index.ts | 1 + 2 files changed, 6 insertions(+) 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) {