|
17 | 17 | import org.elasticsearch.common.collect.Tuple; |
18 | 18 | import org.elasticsearch.common.inject.Inject; |
19 | 19 | import org.elasticsearch.common.settings.Settings; |
| 20 | +import org.elasticsearch.common.unit.ByteSizeValue; |
20 | 21 | import org.elasticsearch.license.LicenseUtils; |
21 | 22 | import org.elasticsearch.license.XPackLicenseState; |
22 | 23 | import org.elasticsearch.tasks.Task; |
@@ -106,7 +107,7 @@ private void explain(Task task, PutDataFrameAnalyticsAction.Request request, |
106 | 107 | ); |
107 | 108 | if (licenseState.isSecurityEnabled()) { |
108 | 109 | useSecondaryAuthIfAvailable(this.securityContext, () -> { |
109 | | - // Set the auth headers (preferring the secondary headers) to the caller's. |
| 110 | + // Set the auth headers (preferring the secondary headers) to the caller's. |
110 | 111 | // Regardless if the config was previously stored or not. |
111 | 112 | DataFrameAnalyticsConfig config = new DataFrameAnalyticsConfig.Builder(request.getConfig()) |
112 | 113 | .setHeaders(filterSecurityHeaders(threadPool.getThreadContext().getHeaders())) |
@@ -152,6 +153,11 @@ private void estimateMemoryUsage(Task task, |
152 | 153 | DataFrameAnalyticsConfig config, |
153 | 154 | ExtractedFields extractedFields, |
154 | 155 | ActionListener<MemoryEstimation> listener) { |
| 156 | + if (extractedFields.getAllFields().isEmpty()) { |
| 157 | + listener.onResponse(new MemoryEstimation(ByteSizeValue.ZERO, ByteSizeValue.ZERO)); |
| 158 | + return; |
| 159 | + } |
| 160 | + |
155 | 161 | final String estimateMemoryTaskId = "memory_usage_estimation_" + task.getId(); |
156 | 162 | DataFrameDataExtractorFactory extractorFactory = DataFrameDataExtractorFactory.createForSourceIndices( |
157 | 163 | new ParentTaskAssigningClient(client, task.getParentTaskId()), estimateMemoryTaskId, config, extractedFields); |
|
0 commit comments