@@ -52,7 +52,7 @@ export interface MsearchHelperOptions extends T.MsearchRequest {
5252
5353export interface MsearchHelper extends Promise < void > {
5454 stop : ( error ?: Error | null ) => void
55- search : < TDocument = unknown > ( header : T . MsearchHeader , body : T . MsearchBody ) => Promise < MsearchHelperResponse < TDocument > >
55+ search : < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . MsearchMultisearchBody ) => Promise < MsearchHelperResponse < TDocument > >
5656}
5757
5858export interface MsearchHelperResponse < TDocument > {
@@ -315,7 +315,7 @@ export default class Helpers {
315315 // TODO: support abort a single search?
316316 // NOTE: the validation checks are synchronous and the callback/promise will
317317 // be resolved in the same tick. We might want to fix this in the future.
318- search < TDocument = unknown > ( header : T . MsearchHeader , body : T . MsearchBody ) : Promise < MsearchHelperResponse < TDocument > > {
318+ search < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . MsearchMultisearchBody ) : Promise < MsearchHelperResponse < TDocument > > {
319319 if ( stopReading ) {
320320 const error = stopError === null
321321 ? new ConfigurationError ( 'The msearch processor has been stopped' )
@@ -350,7 +350,7 @@ export default class Helpers {
350350
351351 async function iterate ( ) : Promise < void > {
352352 const { semaphore, finish } = buildSemaphore ( )
353- const msearchBody : Array < T . MsearchHeader | T . MsearchBody > = [ ]
353+ const msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > = [ ]
354354 const callbacks : any [ ] = [ ]
355355 let loadedOperations = 0
356356 timeoutRef = setTimeout ( onFlushTimeout , flushInterval ) // eslint-disable-line
@@ -440,7 +440,7 @@ export default class Helpers {
440440 }
441441 }
442442
443- function send ( msearchBody : Array < T . MsearchHeader | T . MsearchBody > , callbacks : any [ ] ) : void {
443+ function send ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) : void {
444444 /* istanbul ignore if */
445445 if ( running > concurrency ) {
446446 throw new Error ( 'Max concurrency reached' )
@@ -458,15 +458,15 @@ export default class Helpers {
458458 }
459459 }
460460
461- function msearchOperation ( msearchBody : Array < T . MsearchHeader | T . MsearchBody > , callbacks : any [ ] , done : ( ) => void ) : void {
461+ function msearchOperation ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] , done : ( ) => void ) : void {
462462 let retryCount = retries
463463
464464 // Instead of going full on async-await, which would make the code easier to read,
465465 // we have decided to use callback style instead.
466466 // This because every time we use async await, V8 will create multiple promises
467467 // behind the scenes, making the code slightly slower.
468468 tryMsearch ( msearchBody , callbacks , retrySearch )
469- function retrySearch ( msearchBody : Array < T . MsearchHeader | T . MsearchBody > , callbacks : any [ ] ) : void {
469+ function retrySearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) : void {
470470 if ( msearchBody . length > 0 && retryCount > 0 ) {
471471 retryCount -= 1
472472 setTimeout ( tryMsearch , wait , msearchBody , callbacks , retrySearch )
@@ -478,7 +478,7 @@ export default class Helpers {
478478
479479 // This function never returns an error, if the msearch operation fails,
480480 // the error is dispatched to all search executors.
481- function tryMsearch ( msearchBody : Array < T . MsearchHeader | T . MsearchBody > , callbacks : any [ ] , done : ( msearchBody : Array < T . MsearchHeader | T . MsearchBody > , callbacks : any [ ] ) => void ) : void {
481+ function tryMsearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] , done : ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) => void ) : void {
482482 client . msearch ( Object . assign ( { } , msearchOptions , { body : msearchBody } ) , reqOptions as TransportRequestOptionsWithMeta )
483483 . then ( results => {
484484 const retryBody = [ ]
0 commit comments