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 04991f4aeefd6..d0fb5a5d70f5e 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 @@ -446,6 +446,7 @@ describe('Session index', () => { { index: aliasName, keep_alive: '5m', + allow_partial_search_results: true, }, { ignore: [404], meta: true } ); @@ -454,6 +455,7 @@ describe('Session index', () => { { index: aliasName, keep_alive: '5m', + allow_partial_search_results: true, }, { meta: true } ); @@ -473,7 +475,6 @@ 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, @@ -556,7 +557,6 @@ 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, @@ -651,7 +651,6 @@ 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, @@ -740,7 +739,6 @@ 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, @@ -854,7 +852,6 @@ 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 9166ec9deb91f..b4bea1900c577 100644 --- a/x-pack/plugins/security/server/session_management/session_index.ts +++ b/x-pack/plugins/security/server/session_management/session_index.ts @@ -830,6 +830,10 @@ export class SessionIndex { { index: this.aliasName, keep_alive: SESSION_INDEX_CLEANUP_KEEP_ALIVE, + // @ts-expect-error client support this option, but it is not documented and typed yet. + // once support added we should remove this expected type error + // https://github.com/elastic/elasticsearch-specification/issues/3144 + allow_partial_search_results: true, }, { ignore: [404], meta: true } ); @@ -841,6 +845,10 @@ export class SessionIndex { { index: this.aliasName, keep_alive: SESSION_INDEX_CLEANUP_KEEP_ALIVE, + // @ts-expect-error client support this option, but it is not documented and typed yet. + // once support added we should remove this expected type error + // https://github.com/elastic/elasticsearch-specification/issues/3144 + allow_partial_search_results: true, }, { meta: true } )); @@ -857,7 +865,6 @@ 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) {