Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.license.LicenseUtils;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.tasks.Task;
Expand Down Expand Up @@ -106,7 +107,7 @@ private void explain(Task task, PutDataFrameAnalyticsAction.Request request,
);
if (licenseState.isSecurityEnabled()) {
useSecondaryAuthIfAvailable(this.securityContext, () -> {
// Set the auth headers (preferring the secondary headers) to the caller's.
// Set the auth headers (preferring the secondary headers) to the caller's.
// Regardless if the config was previously stored or not.
DataFrameAnalyticsConfig config = new DataFrameAnalyticsConfig.Builder(request.getConfig())
.setHeaders(filterSecurityHeaders(threadPool.getThreadContext().getHeaders()))
Expand Down Expand Up @@ -152,6 +153,11 @@ private void estimateMemoryUsage(Task task,
DataFrameAnalyticsConfig config,
ExtractedFields extractedFields,
ActionListener<MemoryEstimation> listener) {
if (extractedFields.getAllFields().isEmpty()) {
listener.onResponse(new MemoryEstimation(ByteSizeValue.ZERO, ByteSizeValue.ZERO));
return;
}

final String estimateMemoryTaskId = "memory_usage_estimation_" + task.getId();
DataFrameDataExtractorFactory extractorFactory = DataFrameDataExtractorFactory.createForSourceIndices(
new ParentTaskAssigningClient(client, task.getParentTaskId()), estimateMemoryTaskId, config, extractedFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,35 @@
- match: { field_selection.4.is_required: false }
- match: { field_selection.4.feature_type: "categorical" }
- is_false: field_selection.4.reason

---
"Test given no included field":

- do:
indices.create:
index: index-source
body:
mappings:
properties:
x:
type: keyword

- do:
index:
index: index-source
refresh: true
body: { x: "hello!" }
- match: { result: "created" }

- do:
ml.explain_data_frame_analytics:
body:
source: { index: "index-source" }
analysis: { outlier_detection: {} }
- match:
memory_estimation.expected_memory_without_disk: "0"
- match:
memory_estimation.expected_memory_with_disk: "0"
- length: { field_selection: 1 }
- match: { field_selection.0.name: "x" }
- match: { field_selection.0.is_included: false }