diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md
index 80c321ce6b320..d06ce1b2ef2bc 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md
@@ -13,11 +13,11 @@ esFilters: {
FILTERS: typeof FILTERS;
FilterStateStore: typeof FilterStateStore;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
- buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
- buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
- buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
+ buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
+ buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
+ buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
- buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
+ buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter;
isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter;
isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter;
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md
deleted file mode 100644
index f99e7ba8b967e..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md)
-
-## IFieldType.lang property
-
-Signature:
-
-```typescript
-lang?: estypes.ScriptLanguage;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md
index 29377ff8fd392..e1acea53ea5e0 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md
@@ -12,7 +12,7 @@
Signature:
```typescript
-export interface IFieldType
+export interface IFieldType extends IndexPatternFieldBase
```
## Properties
@@ -26,15 +26,9 @@ export interface IFieldType
| [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) | string[]
| |
| [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) | boolean
| |
| [format](./kibana-plugin-plugins-data-public.ifieldtype.format.md) | any
| |
-| [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) | estypes.ScriptLanguage
| |
-| [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) | string
| |
| [readFromDocValues](./kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md) | boolean
| |
-| [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) | string
| |
-| [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md) | boolean
| |
| [searchable](./kibana-plugin-plugins-data-public.ifieldtype.searchable.md) | boolean
| |
| [sortable](./kibana-plugin-plugins-data-public.ifieldtype.sortable.md) | boolean
| |
-| [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md) | IFieldSubType
| |
| [toSpec](./kibana-plugin-plugins-data-public.ifieldtype.tospec.md) | (options?: {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec
| |
-| [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md) | string
| |
| [visualizable](./kibana-plugin-plugins-data-public.ifieldtype.visualizable.md) | boolean
| |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md
deleted file mode 100644
index 1c01484372fd3..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md)
-
-## IFieldType.name property
-
-Signature:
-
-```typescript
-name: string;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md
deleted file mode 100644
index 252c2c3822046..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md)
-
-## IFieldType.script property
-
-Signature:
-
-```typescript
-script?: string;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md
deleted file mode 100644
index 33bbd0c2c20cb..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md)
-
-## IFieldType.scripted property
-
-Signature:
-
-```typescript
-scripted?: boolean;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md
deleted file mode 100644
index d0c26186da085..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md)
-
-## IFieldType.subType property
-
-Signature:
-
-```typescript
-subType?: IFieldSubType;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md
deleted file mode 100644
index 26228cbe4bfdb..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md)
-
-## IFieldType.type property
-
-Signature:
-
-```typescript
-type: string;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md
new file mode 100644
index 0000000000000..792bee44f96a8
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md)
+
+## IIndexPattern.fields property
+
+Signature:
+
+```typescript
+fields: IFieldType[];
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md
index ec29ef81a6e69..c441073781169 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md
@@ -20,6 +20,7 @@ export interface IIndexPattern extends IndexPatternBase
| Property | Type | Description |
| --- | --- | --- |
| [fieldFormatMap](./kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md) | Record<string, SerializedFieldFormat<unknown> | undefined>
| |
+| [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md) | IFieldType[]
| |
| [getFormatterForField](./kibana-plugin-plugins-data-public.iindexpattern.getformatterforfield.md) | (field: IndexPatternField | IndexPatternField['spec'] | IFieldType) => FieldFormat
| Look up a formatter for a given field |
| [timeFieldName](./kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md) | string
| |
| [title](./kibana-plugin-plugins-data-public.iindexpattern.title.md) | string
| |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md
index e42980bb53af4..1bbe0b594ecf0 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md
@@ -9,7 +9,9 @@
```typescript
getAggregationRestrictions(): Recordboolean | |
| [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean
| |
| [spec](./kibana-plugin-plugins-data-public.indexpatternfield.spec.md) | | FieldSpec
| |
-| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../types").IFieldSubType | undefined
| |
+| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | import("../..").IFieldSubType | undefined
| |
| [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string
| |
| [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean
| |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md
index 5c3c4d54ad099..6cd5247291602 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-get subType(): import("../types").IFieldSubType | undefined;
+get subType(): import("../..").IFieldSubType | undefined;
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md
index 8882fa05ce0c2..b77f3d1f374fb 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.tojson.md
@@ -19,7 +19,7 @@ toJSON(): {
searchable: boolean;
aggregatable: boolean;
readFromDocValues: boolean;
- subType: import("../types").IFieldSubType | undefined;
+ subType: import("../..").IFieldSubType | undefined;
customLabel: string | undefined;
};
```
@@ -37,7 +37,7 @@ toJSON(): {
searchable: boolean;
aggregatable: boolean;
readFromDocValues: boolean;
- subType: import("../types").IFieldSubType | undefined;
+ subType: import("../..").IFieldSubType | undefined;
customLabel: string | undefined;
}`
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md
index d009cad9ec601..594afcf9ee0dd 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md
@@ -11,11 +11,11 @@ esFilters: {
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
buildCustomFilter: typeof buildCustomFilter;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
- buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
+ buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildFilter: typeof buildFilter;
- buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
- buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
- buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
+ buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
+ buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
+ buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isFilterDisabled: (filter: import("../common").Filter) => boolean;
}
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md
deleted file mode 100644
index 3d5a757cb8f18..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md)
-
-## IFieldType.lang property
-
-Signature:
-
-```typescript
-lang?: estypes.ScriptLanguage;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md
index bbc4cc2135d40..9f14bedf92008 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md
@@ -12,7 +12,7 @@
Signature:
```typescript
-export interface IFieldType
+export interface IFieldType extends IndexPatternFieldBase
```
## Properties
@@ -26,15 +26,9 @@ export interface IFieldType
| [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) | string[]
| |
| [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) | boolean
| |
| [format](./kibana-plugin-plugins-data-server.ifieldtype.format.md) | any
| |
-| [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) | estypes.ScriptLanguage
| |
-| [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) | string
| |
| [readFromDocValues](./kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md) | boolean
| |
-| [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) | string
| |
-| [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md) | boolean
| |
| [searchable](./kibana-plugin-plugins-data-server.ifieldtype.searchable.md) | boolean
| |
| [sortable](./kibana-plugin-plugins-data-server.ifieldtype.sortable.md) | boolean
| |
-| [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md) | IFieldSubType
| |
| [toSpec](./kibana-plugin-plugins-data-server.ifieldtype.tospec.md) | (options?: {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec
| |
-| [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md) | string
| |
| [visualizable](./kibana-plugin-plugins-data-server.ifieldtype.visualizable.md) | boolean
| |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md
deleted file mode 100644
index 8be33a3f56d97..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md)
-
-## IFieldType.name property
-
-Signature:
-
-```typescript
-name: string;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md
deleted file mode 100644
index b54a952a11253..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md)
-
-## IFieldType.script property
-
-Signature:
-
-```typescript
-script?: string;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md
deleted file mode 100644
index f7a8ed9aee0df..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md)
-
-## IFieldType.scripted property
-
-Signature:
-
-```typescript
-scripted?: boolean;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md
deleted file mode 100644
index fa78b23a2b558..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md)
-
-## IFieldType.subType property
-
-Signature:
-
-```typescript
-subType?: IFieldSubType;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md
deleted file mode 100644
index ef6a4dcc167c5..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md)
-
-## IFieldType.type property
-
-Signature:
-
-```typescript
-type: string;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md
index b655e779e4fa4..70a3da86e9fbd 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md
@@ -9,7 +9,9 @@
```typescript
getAggregationRestrictions(): Record field.name === filter.meta.key);
+ return indexPattern.fields.some((field) => field.name === filter.meta.key);
}
diff --git a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts
index d312d034df564..24852ebf33bda 100644
--- a/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts
+++ b/src/plugins/data/common/es_query/es_query/handle_nested_filter.test.ts
@@ -10,7 +10,6 @@ import { handleNestedFilter } from './handle_nested_filter';
import { fields } from '../../index_patterns/mocks';
import { buildPhraseFilter, buildQueryFilter } from '../filters';
import { IndexPatternBase } from './types';
-import { IFieldType } from '../../index_patterns';
describe('handleNestedFilter', function () {
const indexPattern: IndexPatternBase = {
@@ -45,8 +44,12 @@ describe('handleNestedFilter', function () {
});
it('should return filter untouched if it does not target a field from the given index pattern', () => {
- const field = { ...getField('extension'), name: 'notarealfield' };
- const filter = buildPhraseFilter(field as IFieldType, 'jpg', indexPattern);
+ const field = getField('extension');
+ const unrealField = {
+ ...field!,
+ name: 'notarealfield',
+ };
+ const filter = buildPhraseFilter(unrealField, 'jpg', indexPattern);
const result = handleNestedFilter(filter, indexPattern);
expect(result).toBe(filter);
});
diff --git a/src/plugins/data/common/es_query/es_query/index.ts b/src/plugins/data/common/es_query/es_query/index.ts
index c10ea5846ae3f..ecc7c8ba5a9f5 100644
--- a/src/plugins/data/common/es_query/es_query/index.ts
+++ b/src/plugins/data/common/es_query/es_query/index.ts
@@ -11,4 +11,4 @@ export { buildQueryFromFilters } from './from_filters';
export { luceneStringToDsl } from './lucene_string_to_dsl';
export { decorateQuery } from './decorate_query';
export { getEsQueryConfig } from './get_es_query_config';
-export { IndexPatternBase } from './types';
+export { IndexPatternBase, IndexPatternFieldBase, IFieldSubType } from './types';
diff --git a/src/plugins/data/common/es_query/es_query/types.ts b/src/plugins/data/common/es_query/es_query/types.ts
index 2133736516049..9282072cd444d 100644
--- a/src/plugins/data/common/es_query/es_query/types.ts
+++ b/src/plugins/data/common/es_query/es_query/types.ts
@@ -6,9 +6,32 @@
* Side Public License, v 1.
*/
-import { IFieldType } from '../../index_patterns';
+import type { estypes } from '@elastic/elasticsearch';
+
+export interface IFieldSubType {
+ multi?: { parent: string };
+ nested?: { path: string };
+}
+export interface IndexPatternFieldBase {
+ name: string;
+ /**
+ * Kibana field type
+ */
+ type: string;
+ subType?: IFieldSubType;
+ /**
+ * Scripted field painless script
+ */
+ script?: string;
+ /**
+ * Scripted field langauge
+ * Painless is the only valid scripted field language
+ */
+ lang?: estypes.ScriptLanguage;
+ scripted?: boolean;
+}
export interface IndexPatternBase {
- fields: IFieldType[];
+ fields: IndexPatternFieldBase[];
id?: string;
}
diff --git a/src/plugins/data/common/es_query/filters/build_filters.ts b/src/plugins/data/common/es_query/filters/build_filters.ts
index 369f9530fb92b..1d8d67b6e937f 100644
--- a/src/plugins/data/common/es_query/filters/build_filters.ts
+++ b/src/plugins/data/common/es_query/filters/build_filters.ts
@@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
-import { IFieldType, IndexPatternBase } from '../..';
+import { IndexPatternFieldBase, IndexPatternBase } from '../..';
+
import {
Filter,
FILTERS,
@@ -20,7 +21,7 @@ import {
export function buildFilter(
indexPattern: IndexPatternBase,
- field: IFieldType,
+ field: IndexPatternFieldBase,
type: FILTERS,
negate: boolean,
disabled: boolean,
@@ -60,7 +61,7 @@ export function buildCustomFilter(
function buildBaseFilter(
indexPattern: IndexPatternBase,
- field: IFieldType,
+ field: IndexPatternFieldBase,
type: FILTERS,
params: any
): Filter {
diff --git a/src/plugins/data/common/es_query/filters/exists_filter.ts b/src/plugins/data/common/es_query/filters/exists_filter.ts
index 4836950c3bb27..7a09adb7d9ed6 100644
--- a/src/plugins/data/common/es_query/filters/exists_filter.ts
+++ b/src/plugins/data/common/es_query/filters/exists_filter.ts
@@ -7,8 +7,7 @@
*/
import { Filter, FilterMeta } from './meta_filter';
-import { IFieldType } from '../../index_patterns';
-import { IndexPatternBase } from '..';
+import { IndexPatternFieldBase, IndexPatternBase } from '..';
export type ExistsFilterMeta = FilterMeta;
@@ -27,7 +26,7 @@ export const getExistsFilterField = (filter: ExistsFilter) => {
return filter.exists && filter.exists.field;
};
-export const buildExistsFilter = (field: IFieldType, indexPattern: IndexPatternBase) => {
+export const buildExistsFilter = (field: IndexPatternFieldBase, indexPattern: IndexPatternBase) => {
return {
meta: {
index: indexPattern.id,
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 27c1e85562097..68ad16cb31d42 100644
--- a/src/plugins/data/common/es_query/filters/phrase_filter.ts
+++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts
@@ -8,8 +8,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { get, isPlainObject } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
-import { IFieldType } from '../../index_patterns';
-import { IndexPatternBase } from '..';
+import { IndexPatternFieldBase, IndexPatternBase } from '..';
export type PhraseFilterMeta = FilterMeta & {
params?: {
@@ -59,7 +58,7 @@ export const getPhraseFilterValue = (filter: PhraseFilter): PhraseFilterValue =>
};
export const buildPhraseFilter = (
- field: IFieldType,
+ field: IndexPatternFieldBase,
value: any,
indexPattern: IndexPatternBase
): PhraseFilter => {
@@ -82,7 +81,7 @@ export const buildPhraseFilter = (
}
};
-export const getPhraseScript = (field: IFieldType, value: string) => {
+export const getPhraseScript = (field: IndexPatternFieldBase, value: string) => {
const convertedValue = getConvertedValueForField(field, value);
const script = buildInlineScriptForPhraseFilter(field);
@@ -106,7 +105,7 @@ export const getPhraseScript = (field: IFieldType, value: string) => {
* https://github.com/elastic/elasticsearch/issues/20941
* https://github.com/elastic/elasticsearch/pull/22201
**/
-export const getConvertedValueForField = (field: IFieldType, value: any) => {
+export const getConvertedValueForField = (field: IndexPatternFieldBase, value: any) => {
if (typeof value !== 'boolean' && field.type === 'boolean') {
if ([1, 'true'].includes(value)) {
return true;
diff --git a/src/plugins/data/common/es_query/filters/phrases_filter.ts b/src/plugins/data/common/es_query/filters/phrases_filter.ts
index 2694461fc1930..7f7831e1c7978 100644
--- a/src/plugins/data/common/es_query/filters/phrases_filter.ts
+++ b/src/plugins/data/common/es_query/filters/phrases_filter.ts
@@ -9,8 +9,7 @@
import { Filter, FilterMeta } from './meta_filter';
import { getPhraseScript } from './phrase_filter';
import { FILTERS } from './index';
-import { IFieldType } from '../../index_patterns';
-import { IndexPatternBase } from '../es_query';
+import { IndexPatternFieldBase, IndexPatternBase } from '../es_query';
export type PhrasesFilterMeta = FilterMeta & {
params: string[]; // The unformatted values
@@ -33,7 +32,7 @@ export const getPhrasesFilterField = (filter: PhrasesFilter) => {
// Creates a filter where the given field matches one or more of the given values
// params should be an array of values
export const buildPhrasesFilter = (
- field: IFieldType,
+ field: IndexPatternFieldBase,
params: any[],
indexPattern: IndexPatternBase
) => {
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 bb7ecc09ebc34..30e52b21d52b7 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
@@ -9,15 +9,15 @@
import { each } from 'lodash';
import { buildRangeFilter, getRangeFilterField, RangeFilter } from './range_filter';
import { fields, getField } from '../../index_patterns/mocks';
-import { IIndexPattern, IFieldType } from '../../index_patterns';
+import { IndexPatternBase, IndexPatternFieldBase } from '../es_query';
describe('Range filter builder', () => {
- let indexPattern: IIndexPattern;
+ let indexPattern: IndexPatternBase;
beforeEach(() => {
indexPattern = {
id: 'id',
- } as IIndexPattern;
+ } as IndexPatternBase;
});
it('should be a function', () => {
@@ -130,7 +130,7 @@ describe('Range filter builder', () => {
});
describe('when given params where one side is infinite', () => {
- let field: IFieldType;
+ let field: IndexPatternFieldBase;
let filter: RangeFilter;
beforeEach(() => {
@@ -160,7 +160,7 @@ describe('Range filter builder', () => {
});
describe('when given params where both sides are infinite', () => {
- let field: IFieldType;
+ let field: IndexPatternFieldBase;
let filter: RangeFilter;
beforeEach(() => {
@@ -186,9 +186,9 @@ describe('Range filter builder', () => {
});
describe('getRangeFilterField', function () {
- const indexPattern: IIndexPattern = ({
+ const indexPattern: IndexPatternBase = ({
fields,
- } as unknown) as IIndexPattern;
+ } as unknown) as IndexPatternBase;
test('should return the name of the field a range query is targeting', () => {
const field = indexPattern.fields.find((patternField) => patternField.name === 'bytes');
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 9f1d9a5d08926..e44e23f64936e 100644
--- a/src/plugins/data/common/es_query/filters/range_filter.ts
+++ b/src/plugins/data/common/es_query/filters/range_filter.ts
@@ -8,8 +8,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { map, reduce, mapValues, get, keys, pickBy } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
-import { IFieldType } from '../../index_patterns';
-import { IndexPatternBase } from '..';
+import { IndexPatternBase, IndexPatternFieldBase } from '..';
const OPERANDS_IN_RANGE = 2;
@@ -83,13 +82,13 @@ export const getRangeFilterField = (filter: RangeFilter) => {
return filter.range && Object.keys(filter.range)[0];
};
-const formatValue = (field: IFieldType, params: any[]) =>
+const formatValue = (params: any[]) =>
map(params, (val: any, key: string) => get(operators, key) + val).join(' ');
// Creates a filter where the value for the given field is in the given range
// params should be an object containing `lt`, `lte`, `gt`, and/or `gte`
export const buildRangeFilter = (
- field: IFieldType,
+ field: IndexPatternFieldBase,
params: RangeFilterParams,
indexPattern: IndexPatternBase,
formattedValue?: string
@@ -124,7 +123,7 @@ export const buildRangeFilter = (
filter.meta.field = field.name;
} else if (field.scripted) {
filter.script = getRangeScript(field, params);
- filter.script.script.params.value = formatValue(field, filter.script.script.params);
+ filter.script.script.params.value = formatValue(filter.script.script.params);
filter.meta.field = field.name;
} else {
@@ -135,7 +134,7 @@ export const buildRangeFilter = (
return filter as RangeFilter;
};
-export const getRangeScript = (field: IFieldType, params: RangeFilterParams) => {
+export const getRangeScript = (field: IndexPatternFieldBase, params: RangeFilterParams) => {
const knownParams = mapValues(
pickBy(params, (val, key: any) => key in operators),
(value) => (field.type === 'number' && typeof value === 'string' ? parseFloat(value) : value)
diff --git a/src/plugins/data/common/es_query/kuery/functions/exists.ts b/src/plugins/data/common/es_query/kuery/functions/exists.ts
index fa6c37e6ba18f..4df566d874d8b 100644
--- a/src/plugins/data/common/es_query/kuery/functions/exists.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/exists.ts
@@ -6,9 +6,8 @@
* Side Public License, v 1.
*/
-import { get } from 'lodash';
import * as literal from '../node_types/literal';
-import { KueryNode, IFieldType, IndexPatternBase } from '../../..';
+import { KueryNode, IndexPatternFieldBase, IndexPatternBase } from '../../..';
export function buildNodeParams(fieldName: string) {
return {
@@ -30,9 +29,9 @@ export function toElasticsearchQuery(
value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value,
};
const fieldName = literal.toElasticsearchQuery(fullFieldNameArg);
- const field = get(indexPattern, 'fields', []).find((fld: IFieldType) => fld.name === fieldName);
+ const field = indexPattern?.fields?.find((fld: IndexPatternFieldBase) => fld.name === fieldName);
- if (field && (field as IFieldType).scripted) {
+ if (field?.scripted) {
throw new Error(`Exists query does not support scripted fields`);
}
return {
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 38a433b1b80ab..79bef10b14f71 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
@@ -9,7 +9,7 @@
import _ from 'lodash';
import { nodeTypes } from '../node_types';
import * as ast from '../ast';
-import { IndexPatternBase, KueryNode, IFieldType, LatLon } from '../../..';
+import { IndexPatternBase, KueryNode, LatLon } from '../../..';
export function buildNodeParams(fieldName: string, params: any) {
params = _.pick(params, 'topLeft', 'bottomRight');
@@ -36,8 +36,8 @@ export function toElasticsearchQuery(
value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value,
};
const fieldName = nodeTypes.literal.toElasticsearchQuery(fullFieldNameArg) as string;
- const fieldList: IFieldType[] = indexPattern?.fields ?? [];
- const field = fieldList.find((fld: IFieldType) => fld.name === fieldName);
+ const fieldList = indexPattern?.fields ?? [];
+ const field = fieldList.find((fld) => fld.name === fieldName);
const queryParams = args.reduce((acc: any, arg: any) => {
const snakeArgName = _.snakeCase(arg.name);
diff --git a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts
index 69de7248a7b38..2e3280138502a 100644
--- a/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/geo_polygon.ts
@@ -8,7 +8,7 @@
import { nodeTypes } from '../node_types';
import * as ast from '../ast';
-import { IndexPatternBase, KueryNode, IFieldType, LatLon } from '../../..';
+import { IndexPatternBase, KueryNode, LatLon } from '../../..';
import { LiteralTypeBuildNode } from '../node_types/types';
export function buildNodeParams(fieldName: string, points: LatLon[]) {
@@ -35,8 +35,8 @@ export function toElasticsearchQuery(
value: context?.nested ? `${context.nested.path}.${fieldNameArg.value}` : fieldNameArg.value,
};
const fieldName = nodeTypes.literal.toElasticsearchQuery(fullFieldNameArg) as string;
- const fieldList: IFieldType[] = indexPattern?.fields ?? [];
- const field = fieldList.find((fld: IFieldType) => fld.name === fieldName);
+ const fieldList = indexPattern?.fields ?? [];
+ const field = fieldList.find((fld) => fld.name === fieldName);
const queryParams = {
points: points.map((point: LiteralTypeBuildNode) => {
return ast.toElasticsearchQuery(point, indexPattern, config, context);
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 55d036c2156f9..381913670c26a 100644
--- a/src/plugins/data/common/es_query/kuery/functions/is.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/is.ts
@@ -11,7 +11,7 @@ import { getPhraseScript } from '../../filters';
import { getFields } from './utils/get_fields';
import { getTimeZoneFromSettings } from '../../utils';
import { getFullFieldNameNode } from './utils/get_full_field_name_node';
-import { IndexPatternBase, KueryNode, IFieldType } from '../../..';
+import { IndexPatternBase, KueryNode, IndexPatternFieldBase } from '../../..';
import * as ast from '../ast';
@@ -100,7 +100,7 @@ export function toElasticsearchQuery(
return { match_all: {} };
}
- const queries = fields!.reduce((accumulator: any, field: IFieldType) => {
+ const queries = fields!.reduce((accumulator: any, field: IndexPatternFieldBase) => {
const wrapWithNestedQuery = (query: any) => {
// Wildcards can easily include nested and non-nested fields. There isn't a good way to let
// users handle this themselves so we automatically add nested queries in this scenario.
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 caefa7e5373ca..b134434dc182b 100644
--- a/src/plugins/data/common/es_query/kuery/functions/range.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/range.ts
@@ -13,7 +13,7 @@ import { getRangeScript, RangeFilterParams } from '../../filters';
import { getFields } from './utils/get_fields';
import { getTimeZoneFromSettings } from '../../utils';
import { getFullFieldNameNode } from './utils/get_full_field_name_node';
-import { IndexPatternBase, KueryNode, IFieldType } from '../../..';
+import { IndexPatternBase, KueryNode } from '../../..';
export function buildNodeParams(fieldName: string, params: RangeFilterParams) {
const paramsToMap = _.pick(params, 'gt', 'lt', 'gte', 'lte', 'format');
@@ -62,7 +62,7 @@ export function toElasticsearchQuery(
});
}
- const queries = fields!.map((field: IFieldType) => {
+ const queries = fields!.map((field) => {
const wrapWithNestedQuery = (query: any) => {
// Wildcards can easily include nested and non-nested fields. There isn't a good way to let
// users handle this themselves so we automatically add nested queries in this scenario.
diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts b/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts
index 47fe677454cbf..949f94d043553 100644
--- a/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/utils/get_fields.test.ts
@@ -6,21 +6,21 @@
* Side Public License, v 1.
*/
+import { IndexPatternBase } from '../../..';
import { fields } from '../../../../index_patterns/mocks';
import { nodeTypes } from '../../index';
-import { IIndexPattern, IFieldType } from '../../../../index_patterns';
// @ts-ignore
import { getFields } from './get_fields';
describe('getFields', () => {
- let indexPattern: IIndexPattern;
+ let indexPattern: IndexPatternBase;
beforeEach(() => {
indexPattern = ({
fields,
- } as unknown) as IIndexPattern;
+ } as unknown) as IndexPatternBase;
});
describe('field names without a wildcard', () => {
@@ -41,14 +41,14 @@ describe('getFields', () => {
});
test('should not match a wildcard in a literal node', () => {
- const indexPatternWithWildField = {
+ const indexPatternWithWildField: IndexPatternBase = ({
title: 'wildIndex',
fields: [
{
name: 'foo*',
},
],
- } as IIndexPattern;
+ } as unknown) as IndexPatternBase;
const fieldNameNode = nodeTypes.literal.buildNode('foo*');
const results = getFields(fieldNameNode, indexPatternWithWildField);
@@ -76,8 +76,8 @@ describe('getFields', () => {
expect(Array.isArray(results)).toBeTruthy();
expect(results).toHaveLength(2);
- expect(results!.find((field: IFieldType) => field.name === 'machine.os')).toBeDefined();
- expect(results!.find((field: IFieldType) => field.name === 'machine.os.raw')).toBeDefined();
+ expect(results!.find((field) => field.name === 'machine.os')).toBeDefined();
+ expect(results!.find((field) => field.name === 'machine.os.raw')).toBeDefined();
});
});
});
diff --git a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts
index 644791637aa70..2a31ebeee2fab 100644
--- a/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts
+++ b/src/plugins/data/common/es_query/kuery/functions/utils/get_full_field_name_node.ts
@@ -7,7 +7,7 @@
*/
import { getFields } from './get_fields';
-import { IndexPatternBase, IFieldType, KueryNode } from '../../../..';
+import { IndexPatternBase, IndexPatternFieldBase, KueryNode } from '../../../..';
export function getFullFieldNameNode(
rootNameNode: any,
@@ -27,7 +27,7 @@ export function getFullFieldNameNode(
}
const fields = getFields(fullFieldNameNode, indexPattern);
- const errors = fields!.reduce((acc: any, field: IFieldType) => {
+ const errors = fields!.reduce((acc: any, field: IndexPatternFieldBase) => {
const nestedPathFromField =
field.subType && field.subType.nested ? field.subType.nested.path : undefined;
diff --git a/src/plugins/data/common/index_patterns/fields/types.ts b/src/plugins/data/common/index_patterns/fields/types.ts
index 0fb7a46c2cf73..3b2e25d3d80a6 100644
--- a/src/plugins/data/common/index_patterns/fields/types.ts
+++ b/src/plugins/data/common/index_patterns/fields/types.ts
@@ -5,18 +5,13 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
-import type { estypes } from '@elastic/elasticsearch';
-import { FieldSpec, IFieldSubType, IndexPattern } from '../..';
+import { IndexPatternFieldBase, FieldSpec, IndexPattern } from '../..';
/**
* @deprecated
* Use IndexPatternField or FieldSpec instead
*/
-export interface IFieldType {
- name: string;
- type: string;
- script?: string;
- lang?: estypes.ScriptLanguage;
+export interface IFieldType extends IndexPatternFieldBase {
count?: number;
// esTypes might be undefined on old index patterns that have not been refreshed since we added
// this prop. It is also undefined on scripted fields.
@@ -27,8 +22,6 @@ export interface IFieldType {
sortable?: boolean;
visualizable?: boolean;
readFromDocValues?: boolean;
- scripted?: boolean;
- subType?: IFieldSubType;
displayName?: string;
customLabel?: string;
format?: any;
diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts
index a88f029c0c7cd..b03e745df74a6 100644
--- a/src/plugins/data/common/index_patterns/types.ts
+++ b/src/plugins/data/common/index_patterns/types.ts
@@ -9,7 +9,7 @@ import type { estypes } from '@elastic/elasticsearch';
import { ToastInputFields, ErrorToastOptions } from 'src/core/public/notifications';
// eslint-disable-next-line
import type { SavedObject } from 'src/core/server';
-import type { IndexPatternBase } from '../es_query';
+import type { IndexPatternFieldBase, IFieldSubType, IndexPatternBase } from '../es_query';
import { IFieldType } from './fields';
import { RUNTIME_FIELD_TYPES } from './constants';
import { SerializedFieldFormat } from '../../../expressions/common';
@@ -32,6 +32,7 @@ export interface RuntimeField {
*/
export interface IIndexPattern extends IndexPatternBase {
title: string;
+ fields: IFieldType[];
/**
* Type is used for identifying rollup indices, otherwise left undefined
*/
@@ -149,12 +150,6 @@ export type AggregationRestrictions = Record<
time_zone?: string;
}
>;
-
-export interface IFieldSubType {
- multi?: { parent: string };
- nested?: { path: string };
-}
-
export interface TypeMeta {
aggs?: Record;
[key: string]: any;
@@ -183,30 +178,17 @@ export interface FieldSpecExportFmt {
/**
* Serialized version of IndexPatternField
*/
-export interface FieldSpec {
+export interface FieldSpec extends IndexPatternFieldBase {
/**
* Popularity count is used by discover
*/
count?: number;
- /**
- * Scripted field painless script
- */
- script?: string;
- /**
- * Scripted field langauge
- * Painless is the only valid scripted field language
- */
- lang?: estypes.ScriptLanguage;
conflictDescriptions?: Record;
format?: SerializedFieldFormat;
- name: string;
- type: string;
esTypes?: string[];
- scripted?: boolean;
searchable: boolean;
aggregatable: boolean;
readFromDocValues?: boolean;
- subType?: IFieldSubType;
indexed?: boolean;
customLabel?: string;
runtimeField?: RuntimeField;
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index 6a49fab0e33ff..35094fac1cc0f 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -808,11 +808,11 @@ export const esFilters: {
FILTERS: typeof FILTERS;
FilterStateStore: typeof FilterStateStore;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
- buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
- buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
- buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
+ buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
+ buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
+ buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
- buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
+ buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter;
isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter;
isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter;
@@ -1242,10 +1242,11 @@ export interface IFieldSubType {
};
}
+// Warning: (ae-forgotten-export) The symbol "IndexPatternFieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
-export interface IFieldType {
+export interface IFieldType extends IndexPatternFieldBase {
// (undocumented)
aggregatable?: boolean;
// (undocumented)
@@ -1261,28 +1262,16 @@ export interface IFieldType {
// (undocumented)
format?: any;
// (undocumented)
- lang?: estypes.ScriptLanguage;
- // (undocumented)
- name: string;
- // (undocumented)
readFromDocValues?: boolean;
// (undocumented)
- script?: string;
- // (undocumented)
- scripted?: boolean;
- // (undocumented)
searchable?: boolean;
// (undocumented)
sortable?: boolean;
// (undocumented)
- subType?: IFieldSubType;
- // (undocumented)
toSpec?: (options?: {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec;
// (undocumented)
- type: string;
- // (undocumented)
visualizable?: boolean;
}
@@ -1295,6 +1284,8 @@ export interface IIndexPattern extends IndexPatternBase {
//
// (undocumented)
fieldFormatMap?: Record | undefined>;
+ // (undocumented)
+ fields: IFieldType[];
getFormatterForField?: (field: IndexPatternField | IndexPatternField['spec'] | IFieldType) => FieldFormat;
// (undocumented)
getTimeField?(): IFieldType | undefined;
@@ -1394,7 +1385,9 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
getAggregationRestrictions(): Record import("../common").QueryStringFilter;
buildCustomFilter: typeof buildCustomFilter;
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
- buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
+ buildExistsFilter: (field: import("../common").IndexPatternFieldBase, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
buildFilter: typeof buildFilter;
- buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
- buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
- buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
+ buildPhraseFilter: (field: import("../common").IndexPatternFieldBase, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
+ buildPhrasesFilter: (field: import("../common").IndexPatternFieldBase, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
+ buildRangeFilter: (field: import("../common").IndexPatternFieldBase, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
isFilterDisabled: (filter: import("../common").Filter) => boolean;
};
@@ -693,10 +693,11 @@ export interface IFieldSubType {
};
}
+// Warning: (ae-forgotten-export) The symbol "IndexPatternFieldBase" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
-export interface IFieldType {
+export interface IFieldType extends IndexPatternFieldBase {
// (undocumented)
aggregatable?: boolean;
// (undocumented)
@@ -712,21 +713,11 @@ export interface IFieldType {
// (undocumented)
format?: any;
// (undocumented)
- lang?: estypes.ScriptLanguage;
- // (undocumented)
- name: string;
- // (undocumented)
readFromDocValues?: boolean;
// (undocumented)
- script?: string;
- // (undocumented)
- scripted?: boolean;
- // (undocumented)
searchable?: boolean;
// (undocumented)
sortable?: boolean;
- // (undocumented)
- subType?: IFieldSubType;
// Warning: (ae-forgotten-export) The symbol "FieldSpec" needs to be exported by the entry point index.d.ts
//
// (undocumented)
@@ -734,8 +725,6 @@ export interface IFieldType {
getFormatterForField?: IndexPattern['getFormatterForField'];
}) => FieldSpec;
// (undocumented)
- type: string;
- // (undocumented)
visualizable?: boolean;
}
@@ -780,7 +769,9 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
getAggregationRestrictions(): Record