diff --git a/src/plugins/data/common/es_query/es_query/build_es_query.ts b/src/plugins/data/common/es_query/es_query/build_es_query.ts
index 66d44f5e0747fe6..34ca90dd7eab792 100644
--- a/src/plugins/data/common/es_query/es_query/build_es_query.ts
+++ b/src/plugins/data/common/es_query/es_query/build_es_query.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { groupBy, has } from 'lodash';
+import { groupBy, has } from 'lodash4';
import { buildQueryFromKuery } from './from_kuery';
import { buildQueryFromFilters } from './from_filters';
import { buildQueryFromLucene } from './from_lucene';
diff --git a/src/plugins/data/common/es_query/es_query/decorate_query.ts b/src/plugins/data/common/es_query/es_query/decorate_query.ts
index 891712d057886ca..fec5821a95e6d59 100644
--- a/src/plugins/data/common/es_query/es_query/decorate_query.ts
+++ b/src/plugins/data/common/es_query/es_query/decorate_query.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { extend, defaults } from 'lodash';
+import { extend, defaults } from 'lodash4';
import { getTimeZoneFromSettings } from '../utils';
import { DslQuery, isEsQueryString } from './es_query_dsl';
diff --git a/src/plugins/data/common/es_query/es_query/es_query_dsl.ts b/src/plugins/data/common/es_query/es_query/es_query_dsl.ts
index d906ae5359ec20b..adfd17092b73bae 100644
--- a/src/plugins/data/common/es_query/es_query/es_query_dsl.ts
+++ b/src/plugins/data/common/es_query/es_query/es_query_dsl.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { has } from 'lodash';
+import { has } from 'lodash4';
export interface DslRangeQuery {
range: {
diff --git a/src/plugins/data/common/es_query/es_query/from_filters.ts b/src/plugins/data/common/es_query/es_query/from_filters.ts
index d2d52efedd08591..b3c2efcaf5ca629 100644
--- a/src/plugins/data/common/es_query/es_query/from_filters.ts
+++ b/src/plugins/data/common/es_query/es_query/from_filters.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { isUndefined } from 'lodash';
+import { isUndefined } from 'lodash4';
import { migrateFilter } from './migrate_filter';
import { filterMatchesIndex } from './filter_matches_index';
import { Filter, cleanFilter, isFilterDisabled } from '../filters';
diff --git a/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts b/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts
index 5fa3c67dea400c4..ef0bd747c25dbb4 100644
--- a/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts
+++ b/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { getEsQueryConfig } from './get_es_query_config';
import { IUiSettingsClient } from 'kibana/public';
import { UI_SETTINGS } from '../../';
diff --git a/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts b/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts
index 6e8d519ec0ce28a..1a06bbc0cce5cdc 100644
--- a/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts
+++ b/src/plugins/data/common/es_query/es_query/lucene_string_to_dsl.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isString } from 'lodash';
+import { isString } from 'lodash4';
import { DslQuery } from './es_query_dsl';
export function luceneStringToDsl(query: string | any): DslQuery {
diff --git a/src/plugins/data/common/es_query/es_query/migrate_filter.test.ts b/src/plugins/data/common/es_query/es_query/migrate_filter.test.ts
index ae9d1c792195517..261977b8596591b 100644
--- a/src/plugins/data/common/es_query/es_query/migrate_filter.test.ts
+++ b/src/plugins/data/common/es_query/es_query/migrate_filter.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isEqual, clone } from 'lodash';
+import { isEqual, cloneDeep } from 'lodash';
import { migrateFilter, DeprecatedMatchPhraseFilter } from './migrate_filter';
import { PhraseFilter, MatchAllFilter } from '../filters';
@@ -52,7 +52,7 @@ describe('migrateFilter', function () {
});
it('should not modify the original filter', function () {
- const oldMatchPhraseFilterCopy = clone(oldMatchPhraseFilter, true);
+ const oldMatchPhraseFilterCopy = cloneDeep(oldMatchPhraseFilter);
migrateFilter(oldMatchPhraseFilter, undefined);
diff --git a/src/plugins/data/common/es_query/es_query/migrate_filter.ts b/src/plugins/data/common/es_query/es_query/migrate_filter.ts
index 498763be538dec7..bb85cfed9ed9550 100644
--- a/src/plugins/data/common/es_query/es_query/migrate_filter.ts
+++ b/src/plugins/data/common/es_query/es_query/migrate_filter.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get, omit } from 'lodash';
+import { get, omit } from 'lodash4';
import { getConvertedValueForField } from '../filters';
import { Filter } from '../filters';
import { IIndexPattern } from '../../index_patterns';
diff --git a/src/plugins/data/common/es_query/filters/get_display_value.ts b/src/plugins/data/common/es_query/filters/get_display_value.ts
index 10b4dab3f46efa8..aa988a133569646 100644
--- a/src/plugins/data/common/es_query/filters/get_display_value.ts
+++ b/src/plugins/data/common/es_query/filters/get_display_value.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { IIndexPattern, IFieldType } from '../..';
import { getIndexPatternFromFilter } from './get_index_pattern_from_filter';
diff --git a/src/plugins/data/common/es_query/filters/index.ts b/src/plugins/data/common/es_query/filters/index.ts
index 990d58835944236..114d29c5b07be34 100644
--- a/src/plugins/data/common/es_query/filters/index.ts
+++ b/src/plugins/data/common/es_query/filters/index.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { omit, get } from 'lodash';
+import { omit, get } from 'lodash4';
import { Filter } from './meta_filter';
export * from './build_filters';
@@ -44,6 +44,6 @@ export * from './types';
* @param {object} filter The filter to clean
* @returns {object}
*/
-export const cleanFilter = (filter: Filter): Filter => omit(filter, ['meta', '$state']);
+export const cleanFilter = (filter: Filter): Filter => omit(filter, ['meta', '$state']) as Filter;
export const isFilterDisabled = (filter: Filter): boolean => get(filter, 'meta.disabled', false);
diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/src/plugins/data/common/es_query/filters/phrase_filter.ts
index 167bb3f84035095..e8f48ff190cbae0 100644
--- a/src/plugins/data/common/es_query/filters/phrase_filter.ts
+++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get, isPlainObject } from 'lodash';
+import { get, isPlainObject } from 'lodash4';
import { Filter, FilterMeta } from './meta_filter';
import { IIndexPattern, IFieldType } from '../../index_patterns';
diff --git a/src/plugins/data/common/es_query/filters/range_filter.test.ts b/src/plugins/data/common/es_query/filters/range_filter.test.ts
index 8accca5c29a45b2..91ca5f02a97d422 100644
--- a/src/plugins/data/common/es_query/filters/range_filter.test.ts
+++ b/src/plugins/data/common/es_query/filters/range_filter.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { each } from 'lodash';
+import { each } from 'lodash4';
import { buildRangeFilter, getRangeFilterField, RangeFilter } from './range_filter';
import { fields, getField } from '../../index_patterns/mocks';
import { IIndexPattern, IFieldType } from '../../index_patterns';
diff --git a/src/plugins/data/common/es_query/filters/range_filter.ts b/src/plugins/data/common/es_query/filters/range_filter.ts
index c318a0f0c2c3d96..4fd490809311b3d 100644
--- a/src/plugins/data/common/es_query/filters/range_filter.ts
+++ b/src/plugins/data/common/es_query/filters/range_filter.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { map, reduce, mapValues, get, keys, pick } from 'lodash';
+import { map, reduce, mapValues, get, keys, pickBy } from 'lodash4';
import { Filter, FilterMeta } from './meta_filter';
import { IIndexPattern, IFieldType } from '../../index_patterns';
@@ -112,7 +112,9 @@ export const buildRangeFilter = (
filter.meta.formattedValue = formattedValue;
}
- params = mapValues(params, (value) => (field.type === 'number' ? parseFloat(value) : value));
+ params = mapValues(params, (value: string) =>
+ field.type === 'number' ? parseFloat(value) : value
+ ) as RangeFilterParams;
if ('gte' in params && 'gt' in params) throw new Error('gte and gt are mutually exclusive');
if ('lte' in params && 'lt' in params) throw new Error('lte and lt are mutually exclusive');
@@ -148,7 +150,7 @@ export const buildRangeFilter = (
};
export const getRangeScript = (field: IFieldType, params: RangeFilterParams) => {
- const knownParams = pick(params, (val, key: any) => key in operators);
+ const knownParams = pickBy(params, (val, key: any) => key in operators);
let script = map(
knownParams,
(val: any, key: string) => '(' + field.script + ')' + get(operators, key) + key
diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts
index cf287ff2c437ace..26a836c13f3b58b 100644
--- a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { nodeTypes } from '../node_types';
import { fields } from '../../../index_patterns/mocks';
import { IIndexPattern } from '../../../index_patterns';
diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts
index d61b16f8dcd853f..300fa82a39dd383 100644
--- a/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/geo_bounding_box.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import { nodeTypes } from '../node_types';
import * as ast from '../ast';
import { IIndexPattern, KueryNode, IFieldType, LatLon } from '../../..';
diff --git a/src/plugins/data/common/es_query/kuery/functions/is.ts b/src/plugins/data/common/es_query/kuery/functions/is.ts
index 89aec6e55e81baf..404f27b38992c37 100644
--- a/src/plugins/data/common/es_query/kuery/functions/is.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/is.ts
@@ -97,7 +97,7 @@ export function toElasticsearchQuery(
});
}
- const isExistsQuery = valueArg.type === 'wildcard' && value === '*';
+ const isExistsQuery = valueArg.type === 'wildcard' && (value as any) === '*';
const isAllFieldsQuery =
(fullFieldNameArg.type === 'wildcard' && ((fieldName as unknown) as string) === '*') ||
(fields && indexPattern && fields.length === indexPattern.fields.length);
@@ -135,7 +135,7 @@ export function toElasticsearchQuery(
...accumulator,
{
script: {
- ...getPhraseScript(field, value),
+ ...getPhraseScript(field, value as any),
},
},
];
diff --git a/src/plugins/data/common/es_query/kuery/functions/range.ts b/src/plugins/data/common/es_query/kuery/functions/range.ts
index feffaa3ec7dda66..a636840c3a6f1cc 100644
--- a/src/plugins/data/common/es_query/kuery/functions/range.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/range.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import { nodeTypes } from '../node_types';
import * as ast from '../ast';
import { getRangeScript, RangeFilterParams } from '../../filters';
diff --git a/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts b/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts
index 6aac1a3b3486d2c..631bf3dcf4f5833 100644
--- a/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts
+++ b/src/plugins/data/common/es_query/kuery/kuery_syntax_error.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { repeat } from 'lodash';
+import { repeat } from 'lodash4';
import { i18n } from '@kbn/i18n';
const endOfInputText = i18n.translate('data.common.kql.errors.endOfInputText', {
diff --git a/src/plugins/data/common/field_formats/converters/color.ts b/src/plugins/data/common/field_formats/converters/color.ts
index ca659916f7671dc..8451f48f47f866a 100644
--- a/src/plugins/data/common/field_formats/converters/color.ts
+++ b/src/plugins/data/common/field_formats/converters/color.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { findLast, cloneDeep, template, escape } from 'lodash';
+import { findLast, cloneDeep, template, escape } from 'lodash4';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
import { HtmlContextTypeConvert, FIELD_FORMAT_IDS } from '../types';
diff --git a/src/plugins/data/common/field_formats/converters/source.ts b/src/plugins/data/common/field_formats/converters/source.ts
index f00261e00971aaf..5a5fdca99d28116 100644
--- a/src/plugins/data/common/field_formats/converters/source.ts
+++ b/src/plugins/data/common/field_formats/converters/source.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { template, escape, keys } from 'lodash';
+import { template, escape, keys } from 'lodash4';
import { shortenDottedString } from '../../utils';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
diff --git a/src/plugins/data/common/field_formats/converters/truncate.ts b/src/plugins/data/common/field_formats/converters/truncate.ts
index a6c4a1133a2ed34..c9ab9df920e16d3 100644
--- a/src/plugins/data/common/field_formats/converters/truncate.ts
+++ b/src/plugins/data/common/field_formats/converters/truncate.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { trunc } from 'lodash';
+import { truncate } from 'lodash';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
import { TextContextTypeConvert, FIELD_FORMAT_IDS } from '../types';
@@ -35,7 +35,7 @@ export class TruncateFormat extends FieldFormat {
textConvert: TextContextTypeConvert = (val) => {
const length = this.param('fieldLength');
if (length > 0) {
- return trunc(val, {
+ return truncate(val, {
length: length + omission.length,
omission,
});
diff --git a/src/plugins/data/common/field_formats/converters/url.ts b/src/plugins/data/common/field_formats/converters/url.ts
index a0a498b6cab344c..bfc5e4f3a244869 100644
--- a/src/plugins/data/common/field_formats/converters/url.ts
+++ b/src/plugins/data/common/field_formats/converters/url.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { escape, memoize } from 'lodash';
+import { escape, memoize } from 'lodash4';
import { getHighlightHtml } from '../utils';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
diff --git a/src/plugins/data/common/field_formats/field_format.test.ts b/src/plugins/data/common/field_formats/field_format.test.ts
index 2229601994496d5..b5d3204412f0221 100644
--- a/src/plugins/data/common/field_formats/field_format.test.ts
+++ b/src/plugins/data/common/field_formats/field_format.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { constant, trimRight, trimLeft, get } from 'lodash';
+import { constant, trimEnd, trimStart, get } from 'lodash4';
import { FieldFormat } from './field_format';
import { asPrettyString } from './utils';
@@ -120,8 +120,8 @@ describe('FieldFormat class', () => {
test('does escape the output of the text converter if used in an html context', () => {
const f = getTestFormat(undefined, constant(''));
- const expected = trimRight(
- trimLeft(f.convert('', 'html'), ''),
+ const expected = trimEnd(
+ trimStart(f.convert('', 'html'), ''),
''
);
diff --git a/src/plugins/data/common/field_formats/field_format.ts b/src/plugins/data/common/field_formats/field_format.ts
index 26f07a12067ce56..1509e31b2bd1b81 100644
--- a/src/plugins/data/common/field_formats/field_format.ts
+++ b/src/plugins/data/common/field_formats/field_format.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { transform, size, cloneDeep, get, defaults } from 'lodash';
+import { transform, size, cloneDeep, get, defaults } from 'lodash4';
import { createCustomFieldFormat } from './converters/custom';
import {
FieldFormatsGetConfigFn,
@@ -185,7 +185,7 @@ export abstract class FieldFormat {
const params = transform(
this._params,
- (uniqParams, val, param) => {
+ (uniqParams: any, val, param) => {
if (param && val !== get(defaultsParams, param)) {
uniqParams[param] = val;
}
diff --git a/src/plugins/data/common/field_formats/field_formats_registry.ts b/src/plugins/data/common/field_formats/field_formats_registry.ts
index 9325485bce75d61..ee656813c61960c 100644
--- a/src/plugins/data/common/field_formats/field_formats_registry.ts
+++ b/src/plugins/data/common/field_formats/field_formats_registry.ts
@@ -18,7 +18,7 @@
*/
// eslint-disable-next-line max-classes-per-file
-import { forOwn, isFunction, memoize, identity } from 'lodash';
+import { forOwn, isFunction, memoize, identity } from 'lodash4';
import {
FieldFormatsGetConfigFn,
@@ -233,7 +233,7 @@ export class FieldFormatsRegistry {
parseDefaultTypeMap(value: any) {
this.defaultMap = value;
forOwn(this, (fn) => {
- if (isFunction(fn) && fn.cache) {
+ if (isFunction(fn) && (fn as any).cache) {
// clear all memoize caches
// @ts-ignore
fn.cache = new memoize.Cache();
diff --git a/src/plugins/data/common/field_mapping/mapping_setup.ts b/src/plugins/data/common/field_mapping/mapping_setup.ts
index 99b49b401a8b8ef..0bad47d9889f0cb 100644
--- a/src/plugins/data/common/field_mapping/mapping_setup.ts
+++ b/src/plugins/data/common/field_mapping/mapping_setup.ts
@@ -28,7 +28,7 @@ type ShorthandFieldMapObject = FieldMappingSpec | ES_FIELD_TYPES | 'json';
/** @public */
export const expandShorthand = (sh: Record): MappingObject => {
- return mapValues>(sh, (val: ShorthandFieldMapObject) => {
+ return mapValues(sh, (val: ShorthandFieldMapObject) => {
const fieldMap = isString(val) ? { type: val } : val;
const json: FieldMappingSpec = {
type: ES_FIELD_TYPES.TEXT,
diff --git a/src/plugins/data/common/index_patterns/fields/field_list.ts b/src/plugins/data/common/index_patterns/fields/field_list.ts
index 173a629863a7165..982ad20946e634e 100644
--- a/src/plugins/data/common/index_patterns/fields/field_list.ts
+++ b/src/plugins/data/common/index_patterns/fields/field_list.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { findIndex } from 'lodash';
+import { findIndex } from 'lodash4';
import { IIndexPattern } from '../../types';
import { IFieldType } from '../../../common';
import { Field, FieldSpec } from './field';
diff --git a/src/plugins/data/common/index_patterns/fields/obj_define.js b/src/plugins/data/common/index_patterns/fields/obj_define.js
index 9c9e5c8f3d55fad..03e7bcb2177aef6 100644
--- a/src/plugins/data/common/index_patterns/fields/obj_define.js
+++ b/src/plugins/data/common/index_patterns/fields/obj_define.js
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
export function ObjDefine(defaults, prototype) {
this.obj; // created by this.create()
diff --git a/src/plugins/data/common/index_patterns/index_patterns/ensure_default_index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/ensure_default_index_pattern.ts
index 2737627bf1977ba..f0e893ed772c9cd 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/ensure_default_index_pattern.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/ensure_default_index_pattern.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { contains } from 'lodash';
+import { includes } from 'lodash4';
import { CoreStart } from 'kibana/public';
import { IndexPatternsContract } from './index_patterns';
@@ -35,7 +35,7 @@ export const createEnsureDefaultIndexPattern = (
const patterns = await this.getIds();
let defaultId = uiSettings.get('defaultIndex');
let defined = !!defaultId;
- const exists = contains(patterns, defaultId);
+ const exists = includes(patterns, defaultId);
if (defined && !exists) {
uiSettings.remove('defaultIndex');
diff --git a/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.ts b/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.ts
index c194687b7c3bfae..854f992c6cbcd15 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import { IndexPattern } from './index_pattern';
// Takes a hit, merges it with any stored/scripted fields, and with the metaFields
@@ -77,7 +77,7 @@ function decorateFlattenedWrapper(hit: Record, metaFields: Record {
const scriptedNames = mockLogStashFields()
.filter((item: Field) => item.scripted === true)
.map((item: Field) => item.name);
- const respNames = pluck(indexPattern.getScriptedFields(), 'name');
+ const respNames = map(indexPattern.getScriptedFields(), 'name');
expect(respNames).toEqual(scriptedNames);
});
@@ -211,7 +211,7 @@ describe('IndexPattern', () => {
const notScriptedNames = mockLogStashFields()
.filter((item: Field) => item.scripted === false)
.map((item: Field) => item.name);
- const respNames = pluck(indexPattern.getNonScriptedFields(), 'name');
+ const respNames = map(indexPattern.getNonScriptedFields(), 'name');
expect(respNames).toEqual(notScriptedNames);
});
@@ -282,7 +282,7 @@ describe('IndexPattern', () => {
// const saveSpy = sinon.spy(indexPattern, 'save');
const scriptedFields = indexPattern.getScriptedFields();
const oldCount = scriptedFields.length;
- const scriptedField = last(scriptedFields);
+ const scriptedField = last(scriptedFields) as any;
await indexPattern.removeScriptedField(scriptedField);
@@ -293,7 +293,7 @@ describe('IndexPattern', () => {
test('should not allow duplicate names', async () => {
const scriptedFields = indexPattern.getScriptedFields();
- const scriptedField = last(scriptedFields);
+ const scriptedField = last(scriptedFields) as any;
expect.assertions(1);
try {
await indexPattern.addScriptedField(scriptedField.name, "'new script'", 'string', 'lang');
diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts
index 666d99362ce8033..e458ecee52e2a06 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _, { each, reject } from 'lodash';
+import _, { each, reject } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { SavedObjectsClientContract } from 'src/core/public';
import { DuplicateField, SavedObjectNotFound } from '../../../../kibana_utils/common';
@@ -292,9 +292,9 @@ export class IndexPattern implements IIndexPattern {
async addScriptedField(name: string, script: string, fieldType: string = 'string', lang: string) {
const scriptedFields = this.getScriptedFields();
- const names = _.pluck(scriptedFields, 'name');
+ const names = _.map(scriptedFields, 'name');
- if (_.contains(names, name)) {
+ if (_.includes(names, name)) {
throw new DuplicateField(name);
}
@@ -356,11 +356,11 @@ export class IndexPattern implements IIndexPattern {
}
getNonScriptedFields() {
- return _.where(this.fields, { scripted: false });
+ return _.filter(this.fields, { scripted: false });
}
getScriptedFields() {
- return _.where(this.fields, { scripted: true });
+ return _.filter(this.fields, { scripted: true });
}
isTimeBased(): boolean {
diff --git a/src/plugins/data/common/index_patterns/lib/get_from_saved_object.ts b/src/plugins/data/common/index_patterns/lib/get_from_saved_object.ts
index 1630a4547b7a14c..9071fd5458e5ae5 100644
--- a/src/plugins/data/common/index_patterns/lib/get_from_saved_object.ts
+++ b/src/plugins/data/common/index_patterns/lib/get_from_saved_object.ts
@@ -18,7 +18,7 @@
*/
import { SavedObject } from 'src/core/public';
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { IIndexPattern, IndexPatternAttributes } from '../..';
export function getFromSavedObject(
diff --git a/src/plugins/data/common/index_patterns/utils.ts b/src/plugins/data/common/index_patterns/utils.ts
index c3f9af62f8c0e7e..7f5fc1f787773ef 100644
--- a/src/plugins/data/common/index_patterns/utils.ts
+++ b/src/plugins/data/common/index_patterns/utils.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { find } from 'lodash';
+import { find } from 'lodash4';
import { SavedObjectsClientContract, SimpleSavedObject } from 'src/core/public';
/**
diff --git a/src/plugins/data/common/query/filter_manager/compare_filters.ts b/src/plugins/data/common/query/filter_manager/compare_filters.ts
index 65df6e26a25b30f..2f72eadc97848f5 100644
--- a/src/plugins/data/common/query/filter_manager/compare_filters.ts
+++ b/src/plugins/data/common/query/filter_manager/compare_filters.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { defaults, isEqual, omit, map } from 'lodash';
+import { defaults, isEqual, omit, map } from 'lodash4';
import { FilterMeta, Filter } from '../../es_query';
export interface FilterCompareOptions {
@@ -44,7 +44,7 @@ const mapFilter = (
comparators: FilterCompareOptions,
excludedAttributes: string[]
) => {
- const cleaned: FilterMeta = omit(filter, excludedAttributes);
+ const cleaned: FilterMeta = omit(filter, excludedAttributes) as FilterMeta;
if (comparators.index) cleaned.index = filter.meta?.index;
if (comparators.negate) cleaned.negate = filter.meta && Boolean(filter.meta.negate);
diff --git a/src/plugins/data/common/query/filter_manager/dedup_filters.ts b/src/plugins/data/common/query/filter_manager/dedup_filters.ts
index 7d1b00ac10c0dd0..25672705d733013 100644
--- a/src/plugins/data/common/query/filter_manager/dedup_filters.ts
+++ b/src/plugins/data/common/query/filter_manager/dedup_filters.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { filter, find } from 'lodash';
+import { filter, find } from 'lodash4';
import { compareFilters, FilterCompareOptions } from './compare_filters';
import { Filter } from '../../es_query';
diff --git a/src/plugins/data/common/query/filter_manager/uniq_filters.ts b/src/plugins/data/common/query/filter_manager/uniq_filters.ts
index 683cbf7c78a8998..33f91bf9da627a6 100644
--- a/src/plugins/data/common/query/filter_manager/uniq_filters.ts
+++ b/src/plugins/data/common/query/filter_manager/uniq_filters.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { each, union } from 'lodash';
+import { each, union } from 'lodash4';
import { Filter } from '../../es_query';
import { dedupFilters } from './dedup_filters';
diff --git a/src/plugins/data/public/actions/filters/create_filters_from_range_select.ts b/src/plugins/data/public/actions/filters/create_filters_from_range_select.ts
index 409614ca9c3802e..4912f2ddeeb6ec4 100644
--- a/src/plugins/data/public/actions/filters/create_filters_from_range_select.ts
+++ b/src/plugins/data/public/actions/filters/create_filters_from_range_select.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { last } from 'lodash';
+import { last } from 'lodash4';
import moment from 'moment';
import { esFilters, IFieldType, RangeFilterParams } from '../../../public';
import { getIndexPatterns } from '../../../public/services';
diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
index a6a45a26f06b397..e3ce47092a1a8e9 100644
--- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
+++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { memoize } from 'lodash';
+import { memoize } from 'lodash4';
import { CoreSetup } from 'src/core/public';
import { IIndexPattern, IFieldType, UI_SETTINGS } from '../../../common';
diff --git a/src/plugins/data/public/field_formats/converters/date.ts b/src/plugins/data/public/field_formats/converters/date.ts
index 78ef8b293e8b9e4..ab265a9c1e470c4 100644
--- a/src/plugins/data/public/field_formats/converters/date.ts
+++ b/src/plugins/data/public/field_formats/converters/date.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { memoize, noop } from 'lodash';
+import { memoize, noop } from 'lodash4';
import moment from 'moment';
import {
FieldFormat,
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index 23213d4d1165a69..392a357092feb49 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -584,8 +584,8 @@ export abstract class FieldFormat {
textConvert: TextContextTypeConvert | undefined;
static title: string;
toJSON(): {
- id: unknown;
- params: _.Dictionary | undefined;
+ id: any;
+ params: any;
};
type: any;
}
diff --git a/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts b/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts
index 432a763bfd48c9a..6eabc21d634428a 100644
--- a/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/generate_filters.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import {
IFieldType,
IIndexPattern,
@@ -53,7 +53,7 @@ function getExistingFilter(
if (isScriptedPhraseFilter(filter)) {
return filter.meta.field === fieldName && filter.script!.script.params.value === value;
}
- });
+ }) as Filter | undefined;
}
function updateExistingFilter(existingFilter: Filter, negate: boolean) {
diff --git a/src/plugins/data/public/query/filter_manager/lib/map_and_flatten_filters.ts b/src/plugins/data/public/query/filter_manager/lib/map_and_flatten_filters.ts
index 13c99e1655d4c48..815062f5a13aacf 100644
--- a/src/plugins/data/public/query/filter_manager/lib/map_and_flatten_filters.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/map_and_flatten_filters.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { compact, flatten } from 'lodash';
+import { compact, flatten } from 'lodash4';
import { mapFilter } from './map_filter';
import { Filter } from '../../../../common';
diff --git a/src/plugins/data/public/query/filter_manager/lib/map_filter.ts b/src/plugins/data/public/query/filter_manager/lib/map_filter.ts
index 7b223a68455598f..5abf6058909b94c 100644
--- a/src/plugins/data/public/query/filter_manager/lib/map_filter.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/map_filter.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { reduceRight } from 'lodash';
+import { reduceRight } from 'lodash4';
import { mapSpatialFilter } from './mappers/map_spatial_filter';
import { mapMatchAll } from './mappers/map_match_all';
diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts
index b5715e33a4677a9..1c2c6122171fd4c 100644
--- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_default.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { find, keys, get } from 'lodash';
+import { find, keys, get } from 'lodash4';
import { Filter, FILTERS } from '../../../../../common';
export const mapDefault = (filter: Filter) => {
diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts
index 6555652a37ca877..479635765b9ae4d 100644
--- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_exists.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { Filter, isExistsFilter, FILTERS } from '../../../../../common';
export const mapExists = (filter: Filter) => {
diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts
index a5e92d57d6a5b66..c5a3d75ac11572b 100644
--- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import {
PhraseFilter,
FilterValueFormatter,
diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts
index d2d5a4b06921864..c30243bb883399a 100644
--- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/mappers/map_range.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get, has } from 'lodash';
+import { get, has } from 'lodash4';
import {
FilterValueFormatter,
RangeFilter,
diff --git a/src/plugins/data/public/query/filter_manager/lib/only_disabled.ts b/src/plugins/data/public/query/filter_manager/lib/only_disabled.ts
index 18c51ebeabe545a..4ceda36031945f1 100644
--- a/src/plugins/data/public/query/filter_manager/lib/only_disabled.ts
+++ b/src/plugins/data/public/query/filter_manager/lib/only_disabled.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { filter } from 'lodash';
+import { filter } from 'lodash4';
import { Filter, compareFilters, COMPARE_ALL_OPTIONS } from '../../../../common';
const isEnabled = (f: Filter) => f && f.meta && !f.meta.disabled;
diff --git a/src/plugins/data/public/query/lib/from_user.ts b/src/plugins/data/public/query/lib/from_user.ts
index fbb1726fc99ea28..1779c3dcf12c046 100644
--- a/src/plugins/data/public/query/lib/from_user.ts
+++ b/src/plugins/data/public/query/lib/from_user.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
/**
* Take userInput from the user and make it into a query object
diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.ts
index e74497a5053b46d..94d3454e3ce381b 100644
--- a/src/plugins/data/public/query/state_sync/connect_to_query_state.ts
+++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.ts
@@ -19,7 +19,7 @@
import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
-import _ from 'lodash';
+import _ from 'lodash4';
import { BaseStateContainer } from '../../../../kibana_utils/public';
import { QuerySetup, QueryStart } from '../query_service';
import { QueryState, QueryStateChange } from './types';
diff --git a/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts b/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts
index cbbf2f275431296..a567250c7524380 100644
--- a/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts
+++ b/src/plugins/data/public/query/timefilter/lib/change_time_filter.ts
@@ -18,7 +18,7 @@
*/
import moment from 'moment';
-import { keys } from 'lodash';
+import { keys } from 'lodash4';
import { TimefilterContract } from '../../timefilter';
import { RangeFilter, TimeRange } from '../../../../common';
diff --git a/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts b/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts
index 23dd1547baf10bd..6fbf489a0ad3b73 100644
--- a/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts
+++ b/src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { keys, partition } from 'lodash';
+import { keys, partition } from 'lodash4';
import { Filter, isRangeFilter, RangeFilter } from '../../../../common';
export function extractTimeFilter(timeFieldName: string, filters: Filter[]) {
diff --git a/src/plugins/data/public/search/aggs/agg_config.test.ts b/src/plugins/data/public/search/aggs/agg_config.test.ts
index 6a0dad07b69bb53..3b62d271d1f8659 100644
--- a/src/plugins/data/public/search/aggs/agg_config.test.ts
+++ b/src/plugins/data/public/search/aggs/agg_config.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { identity } from 'lodash';
+import { identity } from 'lodash4';
import { AggConfig, IAggConfig } from './agg_config';
import { AggConfigs, CreateAggConfigParams } from './agg_configs';
diff --git a/src/plugins/data/public/search/aggs/agg_config.ts b/src/plugins/data/public/search/aggs/agg_config.ts
index ee4116eefc0e275..442eaef04f25495 100644
--- a/src/plugins/data/public/search/aggs/agg_config.ts
+++ b/src/plugins/data/public/search/aggs/agg_config.ts
@@ -280,7 +280,7 @@ export class AggConfig {
const outParams = _.transform(
this.getAggParams(),
- (out, aggParam) => {
+ (out: any, aggParam) => {
let val = params[aggParam.name];
// don't serialize undefined/null values
@@ -361,7 +361,7 @@ export class AggConfig {
}
getAggParams() {
- return [...(_.has(this, 'type.params') ? this.type.params : [])];
+ return [...(_.hasIn(this, 'type.params') ? this.type.params : [])];
}
getRequestAggs() {
@@ -452,14 +452,10 @@ export class AggConfig {
public set type(type) {
if (this.__typeDecorations) {
- _.forOwn(
- this.__typeDecorations,
- function (prop, name: string | undefined) {
- // @ts-ignore
- delete this[name];
- },
- this
- );
+ _.forOwn(this.__typeDecorations, (prop, name: string | undefined) => {
+ // @ts-ignore
+ delete this[name];
+ });
}
if (type && _.isFunction(type.decorateAggConfig)) {
diff --git a/src/plugins/data/public/search/aggs/agg_configs.test.ts b/src/plugins/data/public/search/aggs/agg_configs.test.ts
index 6e6fb3350d901f1..04482958f13c403 100644
--- a/src/plugins/data/public/search/aggs/agg_configs.test.ts
+++ b/src/plugins/data/public/search/aggs/agg_configs.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { indexBy } from 'lodash';
+import { keyBy } from 'lodash';
import { AggConfig } from './agg_config';
import { AggConfigs } from './agg_configs';
import { AggTypesRegistryStart } from './agg_types_registry';
@@ -172,7 +172,7 @@ describe('AggConfigs', () => {
const ac = new AggConfigs(indexPattern, configStates, { typesRegistry, fieldFormats });
const sorted = ac.getRequestAggs();
- const aggs = indexBy(ac.aggs, (agg) => agg.type.name);
+ const aggs = keyBy(ac.aggs, (agg) => agg.type.name);
expect(sorted.shift()).toBe(aggs.terms);
expect(sorted.shift()).toBe(aggs.histogram);
@@ -195,7 +195,7 @@ describe('AggConfigs', () => {
const ac = new AggConfigs(indexPattern, configStates, { typesRegistry, fieldFormats });
const sorted = ac.getResponseAggs();
- const aggs = indexBy(ac.aggs, (agg) => agg.type.name);
+ const aggs = keyBy(ac.aggs, (agg) => agg.type.name);
expect(sorted.shift()).toBe(aggs.terms);
expect(sorted.shift()).toBe(aggs.date_histogram);
@@ -212,7 +212,7 @@ describe('AggConfigs', () => {
const ac = new AggConfigs(indexPattern, configStates, { typesRegistry, fieldFormats });
const sorted = ac.getResponseAggs();
- const aggs = indexBy(ac.aggs, (agg) => agg.type.name);
+ const aggs = keyBy(ac.aggs, (agg) => agg.type.name);
expect(sorted.shift()).toBe(aggs.terms);
expect(sorted.shift()).toBe(aggs.date_histogram);
diff --git a/src/plugins/data/public/search/aggs/agg_configs.ts b/src/plugins/data/public/search/aggs/agg_configs.ts
index 6cc03be292d7b5f..67de3ba4a649679 100644
--- a/src/plugins/data/public/search/aggs/agg_configs.ts
+++ b/src/plugins/data/public/search/aggs/agg_configs.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import { Assign } from '@kbn/utility-types';
import { AggConfig, AggConfigSerialized, IAggConfig } from './agg_config';
diff --git a/src/plugins/data/public/search/aggs/buckets/_terms_other_bucket_helper.ts b/src/plugins/data/public/search/aggs/buckets/_terms_other_bucket_helper.ts
index fba3d35f002af78..0efb4d599a85704 100644
--- a/src/plugins/data/public/search/aggs/buckets/_terms_other_bucket_helper.ts
+++ b/src/plugins/data/public/search/aggs/buckets/_terms_other_bucket_helper.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isNumber, keys, values, find, each, cloneDeep, flatten } from 'lodash';
+import { isNumber, keys, values, find, each, cloneDeep, flatten } from 'lodash4';
import { buildExistsFilter, buildPhrasesFilter, buildQueryFromFilters } from '../../../../common';
import { AggGroupNames } from '../agg_groups';
import { IAggConfigs } from '../agg_configs';
diff --git a/src/plugins/data/public/search/aggs/buckets/create_filter/filters.ts b/src/plugins/data/public/search/aggs/buckets/create_filter/filters.ts
index 72d2029a12b0da6..72392931b66bd38 100644
--- a/src/plugins/data/public/search/aggs/buckets/create_filter/filters.ts
+++ b/src/plugins/data/public/search/aggs/buckets/create_filter/filters.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { IBucketAggConfig } from '../bucket_agg_type';
import { buildQueryFilter } from '../../../../../common';
diff --git a/src/plugins/data/public/search/aggs/buckets/filters.ts b/src/plugins/data/public/search/aggs/buckets/filters.ts
index 4052c0b39015562..5bb8aaef99d877d 100644
--- a/src/plugins/data/public/search/aggs/buckets/filters.ts
+++ b/src/plugins/data/public/search/aggs/buckets/filters.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { size, transform, cloneDeep } from 'lodash';
+import { size, transform, cloneDeep } from 'lodash4';
import { IUiSettingsClient } from 'src/core/public';
import { createFilterFilters } from './create_filter/filters';
@@ -90,7 +90,7 @@ export const getFiltersBucketAgg = ({
const outFilters = transform(
inFilters,
- function (filters, filter) {
+ function (filters: any, filter) {
const input = cloneDeep(filter.input);
if (!input) {
diff --git a/src/plugins/data/public/search/aggs/buckets/geo_tile.ts b/src/plugins/data/public/search/aggs/buckets/geo_tile.ts
index 1212bba23a93aab..61b73eb89acc9be 100644
--- a/src/plugins/data/public/search/aggs/buckets/geo_tile.ts
+++ b/src/plugins/data/public/search/aggs/buckets/geo_tile.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { noop } from 'lodash';
+import { noop } from 'lodash4';
import { BucketAggType, IBucketAggConfig } from './bucket_agg_type';
import { BUCKET_TYPES } from './bucket_agg_types';
diff --git a/src/plugins/data/public/search/aggs/buckets/ip_range.ts b/src/plugins/data/public/search/aggs/buckets/ip_range.ts
index 10fdb2d93b56ea8..5ab1586354fb092 100644
--- a/src/plugins/data/public/search/aggs/buckets/ip_range.ts
+++ b/src/plugins/data/public/search/aggs/buckets/ip_range.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { noop, map, omit, isNull } from 'lodash';
+import { noop, map, omitBy, isNull } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { BucketAggType } from './bucket_agg_type';
import { BUCKET_TYPES } from './bucket_agg_types';
@@ -111,7 +111,7 @@ export const getIpRangeBucketAgg = ({ getInternalStartServices }: IpRangeBucketA
let ranges = aggConfig.params.ranges[ipRangeType];
if (ipRangeType === IP_RANGE_TYPES.FROM_TO) {
- ranges = map(ranges, (range: any) => omit(range, isNull));
+ ranges = map(ranges, (range: any) => omitBy(range, isNull));
}
output.params.ranges = ranges;
diff --git a/src/plugins/data/public/search/aggs/buckets/lib/time_buckets/time_buckets.ts b/src/plugins/data/public/search/aggs/buckets/lib/time_buckets/time_buckets.ts
index b8d6586652d6b16..65a8700f50fcc81 100644
--- a/src/plugins/data/public/search/aggs/buckets/lib/time_buckets/time_buckets.ts
+++ b/src/plugins/data/public/search/aggs/buckets/lib/time_buckets/time_buckets.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isString, isObject as isObjectLodash, isPlainObject, sortBy } from 'lodash';
+import { isString, isObject as isObjectLodash, isPlainObject, sortBy } from 'lodash4';
import moment, { Moment } from 'moment';
import { parseInterval } from '../../../../../../common';
@@ -113,7 +113,7 @@ export class TimeBuckets {
bounds = Array.isArray(input) ? input : [];
}
- const moments: Moment[] = sortBy(bounds, Number);
+ const moments: Moment[] = sortBy(bounds, Number) as Moment[];
const valid = moments.length === 2 && moments.every(isValidMoment);
if (!valid) {
diff --git a/src/plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts b/src/plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts
index 47da7e59af5e060..4524686a1838439 100644
--- a/src/plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts
+++ b/src/plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isString, isObject } from 'lodash';
+import { isString, isObject } from 'lodash4';
import { IBucketAggConfig, BucketAggType, BucketAggParam } from './bucket_agg_type';
import { IAggConfig } from '../agg_config';
@@ -52,7 +52,7 @@ export const migrateIncludeExcludeFormat = {
output.params[this.name] = parsedValue;
}
} else if (isObject(value)) {
- output.params[this.name] = value.pattern;
+ output.params[this.name] = (value as any).pattern;
} else if (value && isStringType(aggConfig)) {
output.params[this.name] = value;
}
diff --git a/src/plugins/data/public/search/aggs/buckets/terms.ts b/src/plugins/data/public/search/aggs/buckets/terms.ts
index 45a76f08ddd13da..291696e1c80c5db 100644
--- a/src/plugins/data/public/search/aggs/buckets/terms.ts
+++ b/src/plugins/data/public/search/aggs/buckets/terms.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { noop } from 'lodash';
+import { noop } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { BucketAggType, IBucketAggConfig } from './bucket_agg_type';
import { BUCKET_TYPES } from './bucket_agg_types';
diff --git a/src/plugins/data/public/search/aggs/metrics/bucket_avg.ts b/src/plugins/data/public/search/aggs/metrics/bucket_avg.ts
index 927e9a7ae445867..a8f271305a9e100 100644
--- a/src/plugins/data/public/search/aggs/metrics/bucket_avg.ts
+++ b/src/plugins/data/public/search/aggs/metrics/bucket_avg.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { MetricAggType } from './metric_agg_type';
import { makeNestedLabel } from './lib/make_nested_label';
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
diff --git a/src/plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts b/src/plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts
index 00d866e6f2b3eda..ad3952c81d0dfbd 100644
--- a/src/plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts
+++ b/src/plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { assign } from 'lodash';
+import { assign } from 'lodash4';
import { IMetricAggConfig } from '../metric_agg_type';
/**
diff --git a/src/plugins/data/public/search/aggs/metrics/lib/make_nested_label.ts b/src/plugins/data/public/search/aggs/metrics/lib/make_nested_label.ts
index 95bcdf6e99fd9e8..ddc5a4ce5354265 100644
--- a/src/plugins/data/public/search/aggs/metrics/lib/make_nested_label.ts
+++ b/src/plugins/data/public/search/aggs/metrics/lib/make_nested_label.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { startCase } from 'lodash';
+import { startCase } from 'lodash4';
import { IMetricAggConfig } from '../metric_agg_type';
export const makeNestedLabel = (aggConfig: IMetricAggConfig, label: string) => {
diff --git a/src/plugins/data/public/search/aggs/metrics/lib/ordinal_suffix.test.ts b/src/plugins/data/public/search/aggs/metrics/lib/ordinal_suffix.test.ts
index 18ee6b4de320445..7f7f1f41006616e 100644
--- a/src/plugins/data/public/search/aggs/metrics/lib/ordinal_suffix.test.ts
+++ b/src/plugins/data/public/search/aggs/metrics/lib/ordinal_suffix.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { forOwn } from 'lodash';
+import { forOwn } from 'lodash4';
import { ordinalSuffix } from './ordinal_suffix';
describe('ordinal suffix util', () => {
diff --git a/src/plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts b/src/plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts
index 947394c97bdcd22..2a44711fe140817 100644
--- a/src/plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts
+++ b/src/plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { noop, identity } from 'lodash';
+import { noop, identity } from 'lodash4';
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
import { IMetricAggConfig, MetricAggParam } from '../metric_agg_type';
diff --git a/src/plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts b/src/plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts
index cee7841a8c3b983..0305901a4ee5a7d 100644
--- a/src/plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts
+++ b/src/plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { identity } from 'lodash';
+import { identity } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { siblingPipelineAggWriter } from './sibling_pipeline_agg_writer';
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
diff --git a/src/plugins/data/public/search/aggs/metrics/std_deviation.ts b/src/plugins/data/public/search/aggs/metrics/std_deviation.ts
index 1733d5476f6679a..56a930a515b0007 100644
--- a/src/plugins/data/public/search/aggs/metrics/std_deviation.ts
+++ b/src/plugins/data/public/search/aggs/metrics/std_deviation.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { i18n } from '@kbn/i18n';
import { MetricAggType } from './metric_agg_type';
import { METRIC_TYPES } from './metric_agg_types';
@@ -116,7 +116,7 @@ export const getStdDeviationMetricAgg = ({
},
getValue(agg, bucket) {
- return get(bucket[agg.parentId], agg.valProp());
+ return get(bucket[agg.parentId], agg.valProp() as any);
},
},
{
diff --git a/src/plugins/data/public/search/aggs/metrics/top_hit.ts b/src/plugins/data/public/search/aggs/metrics/top_hit.ts
index c6890f98b20e429..b94174d94ad9d09 100644
--- a/src/plugins/data/public/search/aggs/metrics/top_hit.ts
+++ b/src/plugins/data/public/search/aggs/metrics/top_hit.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import _ from 'lodash';
+import _ from 'lodash4';
import { i18n } from '@kbn/i18n';
import { IMetricAggConfig, MetricAggType } from './metric_agg_type';
import { METRIC_TYPES } from './metric_agg_types';
diff --git a/src/plugins/data/public/search/aggs/param_types/json.ts b/src/plugins/data/public/search/aggs/param_types/json.ts
index 461f3c300c1d3d9..492d8ce0f8a4b5d 100644
--- a/src/plugins/data/public/search/aggs/param_types/json.ts
+++ b/src/plugins/data/public/search/aggs/param_types/json.ts
@@ -49,7 +49,7 @@ export class JsonParamType extends BaseParamType {
return _(a)
.keys()
.union(_.keys(b))
- .transform(function (dest, key) {
+ .transform(function (dest: any, key) {
const val = compare(a[key], b[key]);
if (val !== undefined) dest[key] = val;
}, {})
diff --git a/src/plugins/data/public/search/aggs/test_helpers/function_wrapper.ts b/src/plugins/data/public/search/aggs/test_helpers/function_wrapper.ts
index aa27bab8f4bd80a..c81dea1d968d380 100644
--- a/src/plugins/data/public/search/aggs/test_helpers/function_wrapper.ts
+++ b/src/plugins/data/public/search/aggs/test_helpers/function_wrapper.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { mapValues } from 'lodash';
+import { mapValues } from 'lodash4';
import {
AnyExpressionFunctionDefinition,
ExpressionFunctionDefinition,
diff --git a/src/plugins/data/public/search/expressions/esaggs.ts b/src/plugins/data/public/search/expressions/esaggs.ts
index 153eb7de6f2de42..3b826fd71ea8d50 100644
--- a/src/plugins/data/public/search/expressions/esaggs.ts
+++ b/src/plugins/data/public/search/expressions/esaggs.ts
@@ -292,7 +292,7 @@ export const esaggs = (): ExpressionFunctionDefinition ({
fetchIndexPatterns: mockFetchIndexPatterns,
}));
-import _ from 'lodash';
+import _ from 'lodash4';
// Using doMock to avoid hoisting so that I can override only the debounce method in lodash
-jest.doMock('lodash', () => ({
+jest.doMock('lodash4', () => ({
..._,
debounce: (func: () => any) => func,
}));
diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx
index 32295745ce21793..d1a2114bcd7df5c 100644
--- a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx
+++ b/src/plugins/data/public/ui/query_string_input/query_string_input.tsx
@@ -32,7 +32,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-import { debounce, compact, isEqual } from 'lodash';
+import { debounce, compact, isEqual } from 'lodash4';
import { Toast } from 'src/core/public';
import { IDataPluginServices, IIndexPattern, Query } from '../..';
import { QuerySuggestion, QuerySuggestionTypes } from '../../autocomplete';
diff --git a/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx b/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx
index c61625dc06c18f1..d76193401c37800 100644
--- a/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx
+++ b/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx
@@ -34,7 +34,7 @@ import {
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { sortBy, isEqual } from 'lodash';
+import { sortBy, isEqual } from 'lodash4';
import { SavedQuery, SavedQueryService } from '../..';
import { SavedQueryAttributes } from '../../query';
diff --git a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
index 6108de028018300..d4add5a0a758d44 100644
--- a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
+++ b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
@@ -34,7 +34,7 @@ import {
import { i18n } from '@kbn/i18n';
import React, { useEffect, useState, Fragment, useRef } from 'react';
-import { sortBy } from 'lodash';
+import { sortBy } from 'lodash4';
import { SavedQuery, SavedQueryService } from '../..';
import { SavedQueryListItem } from './saved_query_list_item';
diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
index 81e84e31980726e..2799c9c39776ba0 100644
--- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
@@ -18,6 +18,7 @@
*/
import React, { useState, useEffect, useRef } from 'react';
+import _ from 'lodash4';
import { CoreStart } from 'src/core/public';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
import { KibanaContextProvider } from '../../../../kibana_react/public';
diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx
index a5ac2275591158a..1d9a38c89cc2b79 100644
--- a/src/plugins/data/public/ui/search_bar/search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx
@@ -17,12 +17,12 @@
* under the License.
*/
-import { compact } from 'lodash';
+import { compact } from 'lodash4';
import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import classNames from 'classnames';
import React, { Component } from 'react';
import ResizeObserver from 'resize-observer-polyfill';
-import { get, isEqual } from 'lodash';
+import { get, isEqual } from 'lodash4';
import { withKibana, KibanaReactContextValue } from '../../../../kibana_react/public';
diff --git a/src/plugins/data/public/ui/typeahead/suggestions_component.tsx b/src/plugins/data/public/ui/typeahead/suggestions_component.tsx
index 77dd7dcec01ee6f..9017ecdd3ac4d7d 100644
--- a/src/plugins/data/public/ui/typeahead/suggestions_component.tsx
+++ b/src/plugins/data/public/ui/typeahead/suggestions_component.tsx
@@ -17,7 +17,7 @@
* under the License.
*/
-import { isEmpty } from 'lodash';
+import { isEmpty } from 'lodash4';
import React, { Component } from 'react';
import { QuerySuggestion } from '../../autocomplete';
import { SuggestionComponent } from './suggestion_component';
diff --git a/src/plugins/data/server/autocomplete/value_suggestions_route.ts b/src/plugins/data/server/autocomplete/value_suggestions_route.ts
index f68d7e1552ccb02..1b2400d5b464069 100644
--- a/src/plugins/data/server/autocomplete/value_suggestions_route.ts
+++ b/src/plugins/data/server/autocomplete/value_suggestions_route.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get, map } from 'lodash';
+import { get, map } from 'lodash4';
import { schema } from '@kbn/config-schema';
import { IRouter, SharedGlobalConfig } from 'kibana/server';
diff --git a/src/plugins/data/server/field_formats/converters/date_server.ts b/src/plugins/data/server/field_formats/converters/date_server.ts
index 85eb65dfc6a8df1..ab34cafbd7aed13 100644
--- a/src/plugins/data/server/field_formats/converters/date_server.ts
+++ b/src/plugins/data/server/field_formats/converters/date_server.ts
@@ -18,7 +18,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { memoize, noop } from 'lodash';
+import { memoize, noop } from 'lodash4';
import moment from 'moment-timezone';
import {
FieldFormat,
diff --git a/src/plugins/data/server/field_formats/field_formats_service.ts b/src/plugins/data/server/field_formats/field_formats_service.ts
index 70584efbee0a0e2..f817f715dab0da3 100644
--- a/src/plugins/data/server/field_formats/field_formats_service.ts
+++ b/src/plugins/data/server/field_formats/field_formats_service.ts
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { has } from 'lodash';
+import { has } from 'lodash4';
import {
FieldFormatsRegistry,
FieldFormatInstanceType,
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/errors.ts b/src/plugins/data/server/index_patterns/fetcher/lib/errors.ts
index e5a96c67c56b589..e6bc914f8331db7 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/errors.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/errors.ts
@@ -18,7 +18,7 @@
*/
import Boom from 'boom';
-import { get } from 'lodash';
+import { get } from 'lodash4';
const ERR_ES_INDEX_NOT_FOUND = 'index_not_found_exception';
const ERR_NO_MATCHING_INDICES = 'no_matching_indices';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.test.js b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.test.js
index a0af7582ac6f3e6..6bf6c3836a6d15f 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.test.js
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.test.js
@@ -19,7 +19,7 @@
/* eslint import/no-duplicates: 0 */
import sinon from 'sinon';
-import { identity, shuffle, sortBy } from 'lodash';
+import { identity, shuffle, sortBy } from 'lodash4';
import { getFieldCapabilities } from '../field_capabilities';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
index d8c94664322049b..b7396e2169ae274 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { defaults, indexBy, sortBy } from 'lodash';
+import { defaults, keyBy, sortBy } from 'lodash4';
import { APICaller } from 'kibana/server';
import { callFieldCapsApi } from '../es_api';
@@ -44,7 +44,7 @@ export async function getFieldCapabilities(
metaFields: string[] = []
) {
const esFieldCaps: FieldCapsResponse = await callFieldCapsApi(callCluster, indices);
- const fieldsFromFieldCapsByName = indexBy(readFieldCapsResponse(esFieldCaps), 'name');
+ const fieldsFromFieldCapsByName = keyBy(readFieldCapsResponse(esFieldCaps), 'name');
const allFieldsUnsorted = Object.keys(fieldsFromFieldCapsByName)
.filter((name) => !name.startsWith('_'))
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.test.js b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.test.js
index 1a4e2b1fe9ee285..0c233fe36ca724f 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.test.js
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.test.js
@@ -18,7 +18,7 @@
*/
/* eslint import/no-duplicates: 0 */
-import { cloneDeep, omit } from 'lodash';
+import { cloneDeep, omit } from 'lodash4';
import sinon from 'sinon';
import * as shouldReadFieldFromDocValuesNS from './should_read_field_from_doc_values';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.ts b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.ts
index cb1ec6a2ebcf3a7..72d763f5c06c164 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { uniq } from 'lodash';
+import { uniq } from 'lodash4';
import { castEsToKbnFieldTypeName } from '../../../../../common';
import { shouldReadFieldFromDocValues } from './should_read_field_from_doc_values';
import { FieldDescriptor } from '../../../fetcher';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/overrides.ts b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/overrides.ts
index 518bfeccac01ab2..fc329f46d2ccc9a 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/overrides.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/overrides.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { merge } from 'lodash';
+import { merge } from 'lodash4';
import { FieldDescriptor } from '../../index_patterns_fetcher';
const OVERRIDES: Record> = {
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.test.js b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.test.js
index 660e9ec30db6a36..bde43f7652f5c9b 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.test.js
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.test.js
@@ -19,7 +19,7 @@
/* eslint import/no-duplicates: 0 */
import sinon from 'sinon';
-import { noop } from 'lodash';
+import { noop } from 'lodash4';
import { callIndexAliasApi } from './es_api';
import * as callIndexAliasApiNS from './es_api';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
index 764307bef0ba643..8f9b0085f8cfb18 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { chain } from 'lodash';
+import { chain } from 'lodash4';
import moment from 'moment';
import { APICaller } from 'kibana/server';
@@ -46,7 +46,7 @@ export async function resolveTimePattern(callCluster: APICaller, timePattern: st
[]
)
.sortBy((indexName: string) => indexName)
- .uniq(true)
+ .sortedUniq()
.map((indexName) => {
const parsed = moment(indexName, timePattern, true);
if (!parsed.isValid()) {
@@ -65,7 +65,7 @@ export async function resolveTimePattern(callCluster: APICaller, timePattern: st
isMatch: indexName === parsed.format(timePattern),
};
})
- .sortByOrder(['valid', 'order'], ['desc', 'desc'])
+ .orderBy(['valid', 'order'], ['desc', 'desc'])
.value();
return {
diff --git a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts
index 157716b38f52347..9e151386a7c8b5e 100644
--- a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts
+++ b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { get } from 'lodash';
+import { get } from 'lodash4';
import { APICaller } from 'kibana/server';
import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../../../common';
diff --git a/src/plugins/data/server/saved_objects/index_pattern_migrations.ts b/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
index 37819a13b651876..9d2bc3f8afbbbb8 100644
--- a/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
+++ b/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { flow, omit } from 'lodash';
+import { flow, omit } from 'lodash4';
import { SavedObjectMigrationFn } from 'kibana/server';
const migrateAttributeTypeAndAttributeTypeMeta: SavedObjectMigrationFn = (doc) => ({
@@ -55,6 +55,6 @@ const migrateSubTypeAndParentFieldProperties: SavedObjectMigrationFn =
};
export const indexPatternSavedObjectTypeMigrations = {
- '6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
- '7.6.0': flow(migrateSubTypeAndParentFieldProperties),
+ '6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
+ '7.6.0': flow(migrateSubTypeAndParentFieldProperties),
};
diff --git a/src/plugins/data/server/saved_objects/search_migrations.ts b/src/plugins/data/server/saved_objects/search_migrations.ts
index 2e37cd1255cee5c..d32328484cc15dc 100644
--- a/src/plugins/data/server/saved_objects/search_migrations.ts
+++ b/src/plugins/data/server/saved_objects/search_migrations.ts
@@ -17,18 +17,21 @@
* under the License.
*/
-import { flow, get } from 'lodash';
+import { flow, get } from 'lodash4';
import { SavedObjectMigrationFn } from 'kibana/server';
import { DEFAULT_QUERY_LANGUAGE } from '../../common';
const migrateMatchAllQuery: SavedObjectMigrationFn = (doc) => {
- const searchSourceJSON = get(doc, 'attributes.kibanaSavedObjectMeta.searchSourceJSON');
+ const searchSourceJSON = get(
+ doc as any,
+ 'attributes.kibanaSavedObjectMeta.searchSourceJSON' as any
+ );
if (searchSourceJSON) {
let searchSource: any;
try {
- searchSource = JSON.parse(searchSourceJSON);
+ searchSource = JSON.parse(searchSourceJSON as any);
} catch (e) {
// Let it go, the data is invalid and we'll leave it as is
}
@@ -122,7 +125,7 @@ const migrateSearchSortToNestedArray: SavedObjectMigrationFn = (doc) =
};
export const searchSavedObjectTypeMigrations = {
- '6.7.2': flow>(migrateMatchAllQuery),
- '7.0.0': flow>(setNewReferences),
- '7.4.0': flow>(migrateSearchSortToNestedArray),
+ '6.7.2': flow(migrateMatchAllQuery),
+ '7.0.0': flow(setNewReferences),
+ '7.4.0': flow(migrateSearchSortToNestedArray),
};