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 @@ -60,7 +60,6 @@ module.directive('mlBucketSpanEstimator', function (i18n) {
end: $scope.formConfig.end
},
fields: [],
filters: $scope.formConfig.filters,
index: $scope.formConfig.indexPattern.title,
query: $scope.formConfig.combinedQuery,
splitField: $scope.formConfig.splitField && $scope.formConfig.splitField.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ module
const {
indexPattern,
savedSearch,
query,
filters,
combinedQuery } = createSearchItems();

timeBasedIndexCheck(indexPattern, true);
Expand Down Expand Up @@ -232,8 +230,6 @@ module
influencerFields: [],
firstSplitFieldName: undefined,
indexPattern,
query,
filters,
combinedQuery,
usesSavedSearch: (savedSearch.id !== undefined),
jobId: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ module
const {
indexPattern,
savedSearch,
query,
filters,
combinedQuery } = createSearchItems();

timeBasedIndexCheck(indexPattern, true);
Expand Down Expand Up @@ -236,8 +234,6 @@ module
influencerFields: [],
firstSplitFieldName: undefined,
indexPattern: indexPattern,
query,
filters,
combinedQuery,
usesSavedSearch: (savedSearch.id !== undefined),
jobId: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ module
const {
indexPattern,
savedSearch,
query,
combinedQuery } = createSearchItems();

const pageTitle = (savedSearch.id !== undefined) ?
Expand Down Expand Up @@ -145,8 +144,6 @@ module
kibanaObjects: {},
start: 0,
end: 0,
query,
filters: [],
useFullIndexData: true,
startDatafeedAfterSave: true,
useDedicatedIndex: false,
Expand All @@ -157,7 +154,6 @@ module
$scope.resetJob = function () {
$scope.overallState = SAVE_STATE.NOT_SAVED;
$scope.formConfig.jobs = [];
$scope.formConfig.filters = [];
$scope.formConfig.kibanaObjects = {};

loadJobConfigs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ module
const {
indexPattern,
savedSearch,
query,
filters,
combinedQuery } = createSearchItems();

timeBasedIndexCheck(indexPattern, true);
Expand Down Expand Up @@ -243,8 +241,6 @@ module
timeField: indexPattern.timeFieldName,
indexPattern: undefined,
usesSavedSearch: (savedSearch.id !== undefined),
query,
filters,
combinedQuery,
jobId: '',
description: '',
Expand Down
21 changes: 9 additions & 12 deletions x-pack/plugins/ml/public/jobs/new_job/utils/new_job_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@ export function SearchItemsProvider(Private, $route, config) {
function createSearchItems() {
let indexPattern = $route.current.locals.indexPattern;

// query is only used by the data visualizer as it needs
// a lucene query_string.
// Using a blank query will cause match_all:{} to be used
// when passed through luceneStringToDsl
let query = {
query: '*',
query: '',
language: 'lucene'
};

let combinedQuery = {
bool: {
must: [{
query_string: {
analyze_wildcard: true,
query: '*'
}
match_all: {}
}]
}
};

let filters = [];

const savedSearch = $route.current.locals.savedSearch;
if (indexPattern.id === undefined && savedSearch.id !== undefined) {
const searchSource = savedSearch.searchSource;
Expand All @@ -46,19 +45,17 @@ export function SearchItemsProvider(Private, $route, config) {
query = searchSource.getField('query');
const fs = searchSource.getField('filter');

if (fs.length) {
filters = fs;
}
const filters = (fs.length) ? fs : [];

const esQueryConfigs = getEsQueryConfig(config);
combinedQuery = buildEsQuery(indexPattern, [query], filters, esQueryConfigs);
}

return {
indexPattern,
savedSearch,
filters,
query,
combinedQuery
combinedQuery,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ const formConfig = {
aggTypes: ['count'],
duration: {},
fields: [null],
filters: [],
index: '',
query: {
bool: {
must: [{ query_string: { analyze_wildcard: true, query: '*' } }],
must: [{ match_all: {} }],
must_not: []
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ export function estimateBucketSpanFactory(callWithRequest, server) {
throw new Error('Invalid formConfig: Missing fields.');
}

if (typeof formConfig.filters === 'undefined') {
throw new Error('Invalid formConfig: Missing filters.');
}

if (typeof formConfig.query === 'undefined') {
throw new Error('Invalid formConfig: Missing query.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export async function validateBucketSpan(callWithRequest, job, duration, server)
aggTypes: [],
duration,
fields: [],
filters: [],
index: job.datafeed_config.indices.join(','),
query: wrapQuery(job.datafeed_config.query),
splitField: undefined,
Expand Down