@@ -365,6 +365,7 @@ public void analyzedPlan(
365365 QueryBuilder requestFilter ,
366366 ActionListener <LogicalPlan > logicalPlanListener
367367 ) {
368+ assert ThreadPool .assertCurrentThreadPool (ThreadPool .Names .SEARCH );
368369 if (parsed .analyzed ()) {
369370 logicalPlanListener .onResponse (parsed );
370371 return ;
@@ -448,6 +449,11 @@ private void preAnalyzeLookupIndex(
448449 String localPattern = lookupIndexPattern .indexPattern ();
449450 assert RemoteClusterAware .isRemoteIndexName (localPattern ) == false
450451 : "Lookup index name should not include remote, but got: " + localPattern ;
452+ assert ThreadPool .assertCurrentThreadPool (
453+ ThreadPool .Names .SEARCH ,
454+ ThreadPool .Names .SEARCH_COORDINATION ,
455+ ThreadPool .Names .SYSTEM_READ
456+ );
451457 Set <String > fieldNames = result .wildcardJoinIndices ().contains (localPattern ) ? IndexResolver .ALL_FIELDS : result .fieldNames ;
452458
453459 String patternWithRemotes ;
@@ -633,6 +639,11 @@ private void preAnalyzeMainIndices(
633639 QueryBuilder requestFilter ,
634640 ActionListener <PreAnalysisResult > listener
635641 ) {
642+ assert ThreadPool .assertCurrentThreadPool (
643+ ThreadPool .Names .SEARCH ,
644+ ThreadPool .Names .SEARCH_COORDINATION ,
645+ ThreadPool .Names .SYSTEM_READ
646+ );
636647 // TODO we plan to support joins in the future when possible, but for now we'll just fail early if we see one
637648 List <IndexPattern > indices = preAnalysis .indices ;
638649 if (indices .size () > 1 ) {
0 commit comments