|
16 | 16 | import org.elasticsearch.common.Strings; |
17 | 17 | import org.elasticsearch.common.util.Maps; |
18 | 18 | import org.elasticsearch.index.IndexMode; |
| 19 | +import org.elasticsearch.index.IndexNotFoundException; |
19 | 20 | import org.elasticsearch.index.mapper.TimeSeriesParams; |
20 | 21 | import org.elasticsearch.index.query.QueryBuilder; |
21 | 22 | import org.elasticsearch.threadpool.ThreadPool; |
@@ -56,7 +57,7 @@ public class IndexResolver { |
56 | 57 | public static final String UNMAPPED = "unmapped"; |
57 | 58 |
|
58 | 59 | public static final IndicesOptions FIELD_CAPS_INDICES_OPTIONS = IndicesOptions.builder() |
59 | | - .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ALLOW_UNAVAILABLE_TARGETS) |
| 60 | + .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS) |
60 | 61 | .wildcardOptions( |
61 | 62 | IndicesOptions.WildcardOptions.builder() |
62 | 63 | .matchOpen(true) |
@@ -91,11 +92,34 @@ public void resolveAsMergedMapping( |
91 | 92 | client.execute( |
92 | 93 | EsqlResolveFieldsAction.TYPE, |
93 | 94 | createFieldCapsRequest(indexWildcard, fieldNames, requestFilter, includeAllDimensions), |
94 | | - listener.delegateFailureAndWrap( |
95 | | - (l, response) -> l.onResponse( |
96 | | - mergedMappings(indexWildcard, new FieldsInfo(response, supportsAggregateMetricDouble, supportsDenseVector)) |
97 | | - ) |
| 95 | + ActionListener.wrap( |
| 96 | + r -> listener.onResponse( |
| 97 | + mergedMappings(indexWildcard, new FieldsInfo(r, supportsAggregateMetricDouble, supportsDenseVector)) |
| 98 | + ), |
| 99 | + f -> { |
| 100 | + if (f instanceof IndexNotFoundException e) { |
| 101 | + listener.onResponse(IndexResolution.notFound(e.getIndex().getName())); |
| 102 | + } else { |
| 103 | + listener.onFailure(f); |
| 104 | + } |
| 105 | + } |
98 | 106 | ) |
| 107 | + // new ActionListener<FieldCapabilitiesResponse>() { |
| 108 | + // @Override |
| 109 | + // public void onResponse(FieldCapabilitiesResponse fieldCapabilitiesResponse) { |
| 110 | + // |
| 111 | + // } |
| 112 | + // |
| 113 | + // @Override |
| 114 | + // public void onFailure(Exception e) { |
| 115 | + // |
| 116 | + // } |
| 117 | + // } |
| 118 | + // listener.delegateFailureAndWrap( |
| 119 | + // (l, response) -> l.onResponse( |
| 120 | + // mergedMappings(indexWildcard, new FieldsInfo(response, supportsAggregateMetricDouble, supportsDenseVector)) |
| 121 | + // ) |
| 122 | + // ) |
99 | 123 | ); |
100 | 124 | } |
101 | 125 |
|
|
0 commit comments