@@ -41,7 +41,7 @@ export interface MsearchHelperOptions extends T.MsearchRequest {
4141
4242export interface MsearchHelper extends Promise < void > {
4343 stop : ( error ?: Error | null ) => void
44- search : < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . MsearchMultisearchBody ) => Promise < MsearchHelperResponse < TDocument > >
44+ search : < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . SearchSearchRequestBody ) => Promise < MsearchHelperResponse < TDocument > >
4545}
4646
4747export interface MsearchHelperResponse < TDocument > {
@@ -362,7 +362,7 @@ export default class Helpers {
362362 // TODO: support abort a single search?
363363 // NOTE: the validation checks are synchronous and the callback/promise will
364364 // be resolved in the same tick. We might want to fix this in the future.
365- search < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . MsearchMultisearchBody ) : Promise < MsearchHelperResponse < TDocument > > {
365+ search < TDocument = unknown > ( header : T . MsearchMultisearchHeader , body : T . SearchSearchRequestBody ) : Promise < MsearchHelperResponse < TDocument > > {
366366 if ( stopReading ) {
367367 const error = stopError === null
368368 ? new ConfigurationError ( 'The msearch processor has been stopped' )
@@ -397,7 +397,7 @@ export default class Helpers {
397397
398398 async function iterate ( ) : Promise < void > {
399399 const { semaphore, finish } = buildSemaphore ( )
400- const msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > = [ ]
400+ const msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > = [ ]
401401 const callbacks : any [ ] = [ ]
402402 let loadedOperations = 0
403403 timeoutRef = setTimeout ( onFlushTimeout , flushInterval ) // eslint-disable-line
@@ -490,7 +490,7 @@ export default class Helpers {
490490 }
491491 }
492492
493- function send ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) : void {
493+ function send ( msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > , callbacks : any [ ] ) : void {
494494 /* istanbul ignore if */
495495 if ( running > concurrency ) {
496496 throw new Error ( 'Max concurrency reached' )
@@ -508,15 +508,15 @@ export default class Helpers {
508508 }
509509 }
510510
511- function msearchOperation ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] , done : ( ) => void ) : void {
511+ function msearchOperation ( msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > , callbacks : any [ ] , done : ( ) => void ) : void {
512512 let retryCount = retries
513513
514514 // Instead of going full on async-await, which would make the code easier to read,
515515 // we have decided to use callback style instead.
516516 // This because every time we use async await, V8 will create multiple promises
517517 // behind the scenes, making the code slightly slower.
518518 tryMsearch ( msearchBody , callbacks , retrySearch )
519- function retrySearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) : void {
519+ function retrySearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > , callbacks : any [ ] ) : void {
520520 if ( msearchBody . length > 0 && retryCount > 0 ) {
521521 retryCount -= 1
522522 setTimeout ( tryMsearch , wait , msearchBody , callbacks , retrySearch )
@@ -528,7 +528,7 @@ export default class Helpers {
528528
529529 // This function never returns an error, if the msearch operation fails,
530530 // the error is dispatched to all search executors.
531- function tryMsearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] , done : ( msearchBody : Array < T . MsearchMultisearchHeader | T . MsearchMultisearchBody > , callbacks : any [ ] ) => void ) : void {
531+ function tryMsearch ( msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > , callbacks : any [ ] , done : ( msearchBody : Array < T . MsearchMultisearchHeader | T . SearchSearchRequestBody > , callbacks : any [ ] ) => void ) : void {
532532 client . msearch ( Object . assign ( { } , msearchOptions , { body : msearchBody } ) , reqOptions as TransportRequestOptionsWithMeta )
533533 . then ( results => {
534534 const retryBody = [ ]
0 commit comments