21
21
import org .elasticsearch .client .internal .OriginSettingClient ;
22
22
import org .elasticsearch .client .internal .node .NodeClient ;
23
23
import org .elasticsearch .cluster .node .DiscoveryNode ;
24
+ import org .elasticsearch .common .io .stream .NamedWriteableRegistry ;
24
25
import org .elasticsearch .common .io .stream .StreamInput ;
25
26
import org .elasticsearch .common .io .stream .StreamOutput ;
26
27
import org .elasticsearch .common .io .stream .Writeable ;
@@ -384,7 +385,11 @@ public void writeTo(StreamOutput out) throws IOException {
384
385
}
385
386
}
386
387
387
- public static void registerRequestHandler (TransportService transportService , SearchService searchService ) {
388
+ public static void registerRequestHandler (
389
+ TransportService transportService ,
390
+ SearchService searchService ,
391
+ NamedWriteableRegistry namedWriteableRegistry
392
+ ) {
388
393
final TransportRequestHandler <ScrollFreeContextRequest > freeContextHandler = (request , channel , task ) -> {
389
394
logger .trace ("releasing search context [{}]" , request .id ());
390
395
boolean freed = searchService .freeReaderContext (request .id ());
@@ -401,7 +406,8 @@ public static void registerRequestHandler(TransportService transportService, Sea
401
406
transportService ,
402
407
FREE_CONTEXT_SCROLL_ACTION_NAME ,
403
408
false ,
404
- SearchFreeContextResponse ::readFrom
409
+ SearchFreeContextResponse ::readFrom ,
410
+ namedWriteableRegistry
405
411
);
406
412
407
413
// TODO: remove this handler once the lowest compatible version stops using it
@@ -411,7 +417,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
411
417
OriginalIndices .readOriginalIndices (in );
412
418
return res ;
413
419
}, freeContextHandler );
414
- TransportActionProxy .registerProxyAction (transportService , FREE_CONTEXT_ACTION_NAME , false , SearchFreeContextResponse ::readFrom );
420
+ TransportActionProxy .registerProxyAction (
421
+ transportService ,
422
+ FREE_CONTEXT_ACTION_NAME ,
423
+ false ,
424
+ SearchFreeContextResponse ::readFrom ,
425
+ namedWriteableRegistry
426
+ );
415
427
416
428
transportService .registerRequestHandler (
417
429
CLEAR_SCROLL_CONTEXTS_ACTION_NAME ,
@@ -426,7 +438,8 @@ public static void registerRequestHandler(TransportService transportService, Sea
426
438
transportService ,
427
439
CLEAR_SCROLL_CONTEXTS_ACTION_NAME ,
428
440
false ,
429
- (in ) -> ActionResponse .Empty .INSTANCE
441
+ (in ) -> ActionResponse .Empty .INSTANCE ,
442
+ namedWriteableRegistry
430
443
);
431
444
432
445
transportService .registerRequestHandler (
@@ -435,7 +448,7 @@ public static void registerRequestHandler(TransportService transportService, Sea
435
448
ShardSearchRequest ::new ,
436
449
(request , channel , task ) -> searchService .executeDfsPhase (request , (SearchShardTask ) task , new ChannelActionListener <>(channel ))
437
450
);
438
- TransportActionProxy .registerProxyAction (transportService , DFS_ACTION_NAME , true , DfsSearchResult ::new );
451
+ TransportActionProxy .registerProxyAction (transportService , DFS_ACTION_NAME , true , DfsSearchResult ::new , namedWriteableRegistry );
439
452
440
453
transportService .registerRequestHandler (
441
454
QUERY_ACTION_NAME ,
@@ -451,7 +464,8 @@ public static void registerRequestHandler(TransportService transportService, Sea
451
464
transportService ,
452
465
QUERY_ACTION_NAME ,
453
466
true ,
454
- (request ) -> ((ShardSearchRequest ) request ).numberOfShards () == 1 ? QueryFetchSearchResult ::new : QuerySearchResult ::new
467
+ (request ) -> ((ShardSearchRequest ) request ).numberOfShards () == 1 ? QueryFetchSearchResult ::new : QuerySearchResult ::new ,
468
+ namedWriteableRegistry
455
469
);
456
470
457
471
transportService .registerRequestHandler (
@@ -465,7 +479,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
465
479
channel .getVersion ()
466
480
)
467
481
);
468
- TransportActionProxy .registerProxyAction (transportService , QUERY_ID_ACTION_NAME , true , QuerySearchResult ::new );
482
+ TransportActionProxy .registerProxyAction (
483
+ transportService ,
484
+ QUERY_ID_ACTION_NAME ,
485
+ true ,
486
+ QuerySearchResult ::new ,
487
+ namedWriteableRegistry
488
+ );
469
489
470
490
transportService .registerRequestHandler (
471
491
QUERY_SCROLL_ACTION_NAME ,
@@ -478,7 +498,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
478
498
channel .getVersion ()
479
499
)
480
500
);
481
- TransportActionProxy .registerProxyAction (transportService , QUERY_SCROLL_ACTION_NAME , true , ScrollQuerySearchResult ::new );
501
+ TransportActionProxy .registerProxyAction (
502
+ transportService ,
503
+ QUERY_SCROLL_ACTION_NAME ,
504
+ true ,
505
+ ScrollQuerySearchResult ::new ,
506
+ namedWriteableRegistry
507
+ );
482
508
483
509
transportService .registerRequestHandler (
484
510
QUERY_FETCH_SCROLL_ACTION_NAME ,
@@ -490,7 +516,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
490
516
new ChannelActionListener <>(channel )
491
517
)
492
518
);
493
- TransportActionProxy .registerProxyAction (transportService , QUERY_FETCH_SCROLL_ACTION_NAME , true , ScrollQueryFetchSearchResult ::new );
519
+ TransportActionProxy .registerProxyAction (
520
+ transportService ,
521
+ QUERY_FETCH_SCROLL_ACTION_NAME ,
522
+ true ,
523
+ ScrollQueryFetchSearchResult ::new ,
524
+ namedWriteableRegistry
525
+ );
494
526
495
527
final TransportRequestHandler <RankFeatureShardRequest > rankShardFeatureRequest = (request , channel , task ) -> searchService
496
528
.executeRankFeaturePhase (request , (SearchShardTask ) task , new ChannelActionListener <>(channel ));
@@ -500,7 +532,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
500
532
RankFeatureShardRequest ::new ,
501
533
rankShardFeatureRequest
502
534
);
503
- TransportActionProxy .registerProxyAction (transportService , RANK_FEATURE_SHARD_ACTION_NAME , true , RankFeatureResult ::new );
535
+ TransportActionProxy .registerProxyAction (
536
+ transportService ,
537
+ RANK_FEATURE_SHARD_ACTION_NAME ,
538
+ true ,
539
+ RankFeatureResult ::new ,
540
+ namedWriteableRegistry
541
+ );
504
542
505
543
final TransportRequestHandler <ShardFetchRequest > shardFetchRequestHandler = (request , channel , task ) -> searchService
506
544
.executeFetchPhase (request , (SearchShardTask ) task , new ChannelActionListener <>(channel ));
@@ -510,7 +548,13 @@ public static void registerRequestHandler(TransportService transportService, Sea
510
548
ShardFetchRequest ::new ,
511
549
shardFetchRequestHandler
512
550
);
513
- TransportActionProxy .registerProxyAction (transportService , FETCH_ID_SCROLL_ACTION_NAME , true , FetchSearchResult ::new );
551
+ TransportActionProxy .registerProxyAction (
552
+ transportService ,
553
+ FETCH_ID_SCROLL_ACTION_NAME ,
554
+ true ,
555
+ FetchSearchResult ::new ,
556
+ namedWriteableRegistry
557
+ );
514
558
515
559
transportService .registerRequestHandler (
516
560
FETCH_ID_ACTION_NAME ,
@@ -520,15 +564,27 @@ public static void registerRequestHandler(TransportService transportService, Sea
520
564
ShardFetchSearchRequest ::new ,
521
565
shardFetchRequestHandler
522
566
);
523
- TransportActionProxy .registerProxyAction (transportService , FETCH_ID_ACTION_NAME , true , FetchSearchResult ::new );
567
+ TransportActionProxy .registerProxyAction (
568
+ transportService ,
569
+ FETCH_ID_ACTION_NAME ,
570
+ true ,
571
+ FetchSearchResult ::new ,
572
+ namedWriteableRegistry
573
+ );
524
574
525
575
transportService .registerRequestHandler (
526
576
QUERY_CAN_MATCH_NODE_NAME ,
527
577
transportService .getThreadPool ().executor (ThreadPool .Names .SEARCH_COORDINATION ),
528
578
CanMatchNodeRequest ::new ,
529
579
(request , channel , task ) -> searchService .canMatch (request , new ChannelActionListener <>(channel ))
530
580
);
531
- TransportActionProxy .registerProxyAction (transportService , QUERY_CAN_MATCH_NODE_NAME , true , CanMatchNodeResponse ::new );
581
+ TransportActionProxy .registerProxyAction (
582
+ transportService ,
583
+ QUERY_CAN_MATCH_NODE_NAME ,
584
+ true ,
585
+ CanMatchNodeResponse ::new ,
586
+ namedWriteableRegistry
587
+ );
532
588
}
533
589
534
590
private static Executor buildFreeContextExecutor (TransportService transportService ) {
0 commit comments