|
41 | 41 | import org.opensearch.core.xcontent.NamedXContentRegistry;
|
42 | 42 | import org.opensearch.env.Environment;
|
43 | 43 | import org.opensearch.gateway.GatewayService;
|
| 44 | +import org.opensearch.index.IndexNotFoundException; |
44 | 45 | import org.opensearch.index.IndexSettings;
|
45 | 46 | import org.opensearch.index.analysis.AnalysisRegistry;
|
46 | 47 | import org.opensearch.ingest.ConfigurationUtils;
|
|
64 | 65 | /**
|
65 | 66 | * The main entry point for search pipelines. Handles CRUD operations and exposes the API to execute search pipelines
|
66 | 67 | * against requests and responses.
|
| 68 | + * |
| 69 | + * @opensearch.internal |
67 | 70 | */
|
68 | 71 | public class SearchPipelineService implements ClusterStateApplier, ReportingService<SearchPipelineInfo> {
|
69 | 72 |
|
@@ -393,22 +396,26 @@ public PipelinedRequest resolvePipeline(SearchRequest searchRequest, IndexNameEx
|
393 | 396 | // Named pipeline specified for the request
|
394 | 397 | pipelineId = searchRequest.pipeline();
|
395 | 398 | } else if (state != null && searchRequest.indices() != null && searchRequest.indices().length != 0) {
|
396 |
| - // Check for index default pipeline |
397 |
| - Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, searchRequest); |
398 |
| - for (Index index : concreteIndices) { |
399 |
| - IndexMetadata indexMetadata = state.metadata().index(index); |
400 |
| - if (indexMetadata != null) { |
401 |
| - Settings indexSettings = indexMetadata.getSettings(); |
402 |
| - if (IndexSettings.DEFAULT_SEARCH_PIPELINE.exists(indexSettings)) { |
403 |
| - String currentPipelineId = IndexSettings.DEFAULT_SEARCH_PIPELINE.get(indexSettings); |
404 |
| - if (NOOP_PIPELINE_ID.equals(pipelineId)) { |
405 |
| - pipelineId = currentPipelineId; |
406 |
| - } else if (pipelineId.equals(currentPipelineId) == false) { |
407 |
| - pipelineId = NOOP_PIPELINE_ID; |
408 |
| - break; |
| 399 | + try { |
| 400 | + // Check for index default pipeline |
| 401 | + Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, searchRequest); |
| 402 | + for (Index index : concreteIndices) { |
| 403 | + IndexMetadata indexMetadata = state.metadata().index(index); |
| 404 | + if (indexMetadata != null) { |
| 405 | + Settings indexSettings = indexMetadata.getSettings(); |
| 406 | + if (IndexSettings.DEFAULT_SEARCH_PIPELINE.exists(indexSettings)) { |
| 407 | + String currentPipelineId = IndexSettings.DEFAULT_SEARCH_PIPELINE.get(indexSettings); |
| 408 | + if (NOOP_PIPELINE_ID.equals(pipelineId)) { |
| 409 | + pipelineId = currentPipelineId; |
| 410 | + } else if (!pipelineId.equals(currentPipelineId)) { |
| 411 | + pipelineId = NOOP_PIPELINE_ID; |
| 412 | + break; |
| 413 | + } |
409 | 414 | }
|
410 | 415 | }
|
411 | 416 | }
|
| 417 | + } catch (IndexNotFoundException e) { |
| 418 | + logger.debug("Default pipeline not applied for {}", (Object) searchRequest.indices()); |
412 | 419 | }
|
413 | 420 | }
|
414 | 421 | if (NOOP_PIPELINE_ID.equals(pipelineId) == false) {
|
|
0 commit comments