diff --git a/src/core/server/elasticsearch/cluster_client.ts b/src/core/server/elasticsearch/cluster_client.ts index 2352677b8d3e0a7..86a8f294339c66c 100644 --- a/src/core/server/elasticsearch/cluster_client.ts +++ b/src/core/server/elasticsearch/cluster_client.ts @@ -64,7 +64,9 @@ const callAPI = async ( const request = api.call(apiContext, clientParams); if (options.signal) { options.signal.addEventListener('abort', () => { - request.abort(); + if (typeof request.abort === 'function') { + request.abort(); + } reject(new Error('Request was aborted')); }); }