diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.id.md
new file mode 100644
index 0000000000000..88c3a7d3654be
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.id.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md) > [id](./kibana-plugin-plugins-data-public.indexpatternlistitem.id.md)
+
+## IndexPatternListItem.id property
+
+Signature:
+
+```typescript
+id: string;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.md
new file mode 100644
index 0000000000000..609a5e0d9ef2c
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.md
@@ -0,0 +1,21 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md)
+
+## IndexPatternListItem interface
+
+Signature:
+
+```typescript
+export interface IndexPatternListItem
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [id](./kibana-plugin-plugins-data-public.indexpatternlistitem.id.md) | string
| |
+| [title](./kibana-plugin-plugins-data-public.indexpatternlistitem.title.md) | string
| |
+| [type](./kibana-plugin-plugins-data-public.indexpatternlistitem.type.md) | string
| |
+| [typeMeta](./kibana-plugin-plugins-data-public.indexpatternlistitem.typemeta.md) | TypeMeta
| |
+
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.title.md
new file mode 100644
index 0000000000000..26f292bf0d17b
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.title.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md) > [title](./kibana-plugin-plugins-data-public.indexpatternlistitem.title.md)
+
+## IndexPatternListItem.title property
+
+Signature:
+
+```typescript
+title: string;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.type.md
new file mode 100644
index 0000000000000..467e8bb81b159
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.type.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md) > [type](./kibana-plugin-plugins-data-public.indexpatternlistitem.type.md)
+
+## IndexPatternListItem.type property
+
+Signature:
+
+```typescript
+type?: string;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.typemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.typemeta.md
new file mode 100644
index 0000000000000..3b93c5111f8dd
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternlistitem.typemeta.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md) > [typeMeta](./kibana-plugin-plugins-data-public.indexpatternlistitem.typemeta.md)
+
+## IndexPatternListItem.typeMeta property
+
+Signature:
+
+```typescript
+typeMeta?: TypeMeta;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md
index ad2a167bd8c74..1f0148df596af 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-getCache: () => Promise[] | null | undefined>;
+getCache: () => Promise>[] | null | undefined>;
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md
index 7d29ced66afa8..b2dcddce0457c 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md
@@ -9,8 +9,5 @@ Get list of index pattern ids with titles
Signature:
```typescript
-getIdsWithTitle: (refresh?: boolean) => Promise>;
+getIdsWithTitle: (refresh?: boolean) => Promise;
```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
index c64ea296952e4..30e7a6be143e9 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
@@ -25,13 +25,13 @@ export declare class IndexPatternsService
| [fieldArrayToMap](./kibana-plugin-plugins-data-public.indexpatternsservice.fieldarraytomap.md) | | (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record<string, FieldSpec>
| Converts field array to map |
| [find](./kibana-plugin-plugins-data-public.indexpatternsservice.find.md) | | (search: string, size?: number) => Promise<IndexPattern[]>
| Find and load index patterns by title |
| [get](./kibana-plugin-plugins-data-public.indexpatternsservice.get.md) | | (id: string) => Promise<IndexPattern>
| Get an index pattern by id. Cache optimized |
-| [getCache](./kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md) | | () => Promise<SavedObject<IndexPatternSavedObjectAttrs>[] | null | undefined>
| |
+| [getCache](./kibana-plugin-plugins-data-public.indexpatternsservice.getcache.md) | | () => Promise<SavedObject<Pick<IndexPatternAttributes, "type" | "title" | "typeMeta">>[] | null | undefined>
| |
| [getDefault](./kibana-plugin-plugins-data-public.indexpatternsservice.getdefault.md) | | () => Promise<IndexPattern | null>
| Get default index pattern |
| [getDefaultId](./kibana-plugin-plugins-data-public.indexpatternsservice.getdefaultid.md) | | () => Promise<string | null>
| Get default index pattern id |
| [getFieldsForIndexPattern](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md) | | (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise<any>
| Get field list by providing an index patttern (or spec) |
| [getFieldsForWildcard](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md) | | (options: GetFieldsOptions) => Promise<any>
| Get field list by providing { pattern } |
| [getIds](./kibana-plugin-plugins-data-public.indexpatternsservice.getids.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern ids |
-| [getIdsWithTitle](./kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md) | | (refresh?: boolean) => Promise<Array<{
id: string;
title: string;
}>>
| Get list of index pattern ids with titles |
+| [getIdsWithTitle](./kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md) | | (refresh?: boolean) => Promise<IndexPatternListItem[]>
| Get list of index pattern ids with titles |
| [getTitles](./kibana-plugin-plugins-data-public.indexpatternsservice.gettitles.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern titles |
| [refreshFields](./kibana-plugin-plugins-data-public.indexpatternsservice.refreshfields.md) | | (indexPattern: IndexPattern) => Promise<void>
| Refresh field list for a given index pattern |
| [savedObjectToSpec](./kibana-plugin-plugins-data-public.indexpatternsservice.savedobjecttospec.md) | | (savedObject: SavedObject<IndexPatternAttributes>) => IndexPatternSpec
| Converts index pattern saved object to index pattern spec |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md
deleted file mode 100644
index 46cb435fb19bc..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) > [aggs](./kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md)
-
-## IndexPatternTypeMeta.aggs property
-
-Signature:
-
-```typescript
-aggs?: Record;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md
deleted file mode 100644
index 19a884862d460..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md)
-
-## IndexPatternTypeMeta interface
-
-Signature:
-
-```typescript
-export interface TypeMeta
-```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [aggs](./kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md) | Record<string, AggregationRestrictions>
| |
-| [params](./kibana-plugin-plugins-data-public.indexpatterntypemeta.params.md) | {
rollup_index: string;
}
| |
-
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.params.md
deleted file mode 100644
index 12646a39188a0..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.params.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) > [params](./kibana-plugin-plugins-data-public.indexpatterntypemeta.params.md)
-
-## IndexPatternTypeMeta.params property
-
-Signature:
-
-```typescript
-params?: {
- rollup_index: string;
- };
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
index 7c2911875ee05..bf269ea8c3355 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
@@ -73,8 +73,8 @@
| [IKibanaSearchRequest](./kibana-plugin-plugins-data-public.ikibanasearchrequest.md) | |
| [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) | |
| [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) | Interface for an index pattern saved object |
+| [IndexPatternListItem](./kibana-plugin-plugins-data-public.indexpatternlistitem.md) | |
| [IndexPatternSpec](./kibana-plugin-plugins-data-public.indexpatternspec.md) | Static index pattern format Serialized data object, representing index pattern attributes and state |
-| [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) | |
| [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) | |
| [ISearchSetup](./kibana-plugin-plugins-data-public.isearchsetup.md) | The setup contract exposed by the Search plugin exposes the search strategy extension point. |
| [ISearchStart](./kibana-plugin-plugins-data-public.isearchstart.md) | search service |
@@ -96,6 +96,7 @@
| [SearchInterceptorDeps](./kibana-plugin-plugins-data-public.searchinterceptordeps.md) | |
| [SearchSessionInfoProvider](./kibana-plugin-plugins-data-public.searchsessioninfoprovider.md) | Provide info about current search session to be stored in the Search Session saved object |
| [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | search source fields |
+| [TypeMeta](./kibana-plugin-plugins-data-public.typemeta.md) | |
| [WaitUntilNextSessionCompletesOptions](./kibana-plugin-plugins-data-public.waituntilnextsessioncompletesoptions.md) | Options for [waitUntilNextSessionCompletes$()](./kibana-plugin-plugins-data-public.waituntilnextsessioncompletes_.md) |
## Variables
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.aggs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.aggs.md
new file mode 100644
index 0000000000000..d2ab7ef72a4a5
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.aggs.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TypeMeta](./kibana-plugin-plugins-data-public.typemeta.md) > [aggs](./kibana-plugin-plugins-data-public.typemeta.aggs.md)
+
+## TypeMeta.aggs property
+
+Signature:
+
+```typescript
+aggs?: Record;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.md
new file mode 100644
index 0000000000000..dcc6500d54c5e
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.md
@@ -0,0 +1,19 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TypeMeta](./kibana-plugin-plugins-data-public.typemeta.md)
+
+## TypeMeta interface
+
+Signature:
+
+```typescript
+export interface TypeMeta
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [aggs](./kibana-plugin-plugins-data-public.typemeta.aggs.md) | Record<string, AggregationRestrictions>
| |
+| [params](./kibana-plugin-plugins-data-public.typemeta.params.md) | {
rollup_index: string;
}
| |
+
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.params.md
new file mode 100644
index 0000000000000..6646f3c63ecc1
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.typemeta.params.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TypeMeta](./kibana-plugin-plugins-data-public.typemeta.md) > [params](./kibana-plugin-plugins-data-public.typemeta.params.md)
+
+## TypeMeta.params property
+
+Signature:
+
+```typescript
+params?: {
+ rollup_index: string;
+ };
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md
index 821c06984e55e..db765cf54d048 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-getCache: () => Promise[] | null | undefined>;
+getCache: () => Promise>[] | null | undefined>;
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md
index 6433c78483545..a047b056e0ed5 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md
@@ -9,8 +9,5 @@ Get list of index pattern ids with titles
Signature:
```typescript
-getIdsWithTitle: (refresh?: boolean) => Promise>;
+getIdsWithTitle: (refresh?: boolean) => Promise;
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md
index bbc4b5c0f1330..b42325b578f6e 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsservice.md
@@ -25,13 +25,13 @@ export declare class IndexPatternsService
| [fieldArrayToMap](./kibana-plugin-plugins-data-server.indexpatternsservice.fieldarraytomap.md) | | (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record<string, FieldSpec>
| Converts field array to map |
| [find](./kibana-plugin-plugins-data-server.indexpatternsservice.find.md) | | (search: string, size?: number) => Promise<IndexPattern[]>
| Find and load index patterns by title |
| [get](./kibana-plugin-plugins-data-server.indexpatternsservice.get.md) | | (id: string) => Promise<IndexPattern>
| Get an index pattern by id. Cache optimized |
-| [getCache](./kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md) | | () => Promise<SavedObject<IndexPatternSavedObjectAttrs>[] | null | undefined>
| |
+| [getCache](./kibana-plugin-plugins-data-server.indexpatternsservice.getcache.md) | | () => Promise<SavedObject<Pick<IndexPatternAttributes, "type" | "title" | "typeMeta">>[] | null | undefined>
| |
| [getDefault](./kibana-plugin-plugins-data-server.indexpatternsservice.getdefault.md) | | () => Promise<IndexPattern | null>
| Get default index pattern |
| [getDefaultId](./kibana-plugin-plugins-data-server.indexpatternsservice.getdefaultid.md) | | () => Promise<string | null>
| Get default index pattern id |
| [getFieldsForIndexPattern](./kibana-plugin-plugins-data-server.indexpatternsservice.getfieldsforindexpattern.md) | | (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise<any>
| Get field list by providing an index patttern (or spec) |
| [getFieldsForWildcard](./kibana-plugin-plugins-data-server.indexpatternsservice.getfieldsforwildcard.md) | | (options: GetFieldsOptions) => Promise<any>
| Get field list by providing { pattern } |
| [getIds](./kibana-plugin-plugins-data-server.indexpatternsservice.getids.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern ids |
-| [getIdsWithTitle](./kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md) | | (refresh?: boolean) => Promise<Array<{
id: string;
title: string;
}>>
| Get list of index pattern ids with titles |
+| [getIdsWithTitle](./kibana-plugin-plugins-data-server.indexpatternsservice.getidswithtitle.md) | | (refresh?: boolean) => Promise<IndexPatternListItem[]>
| Get list of index pattern ids with titles |
| [getTitles](./kibana-plugin-plugins-data-server.indexpatternsservice.gettitles.md) | | (refresh?: boolean) => Promise<string[]>
| Get list of index pattern titles |
| [refreshFields](./kibana-plugin-plugins-data-server.indexpatternsservice.refreshfields.md) | | (indexPattern: IndexPattern) => Promise<void>
| Refresh field list for a given index pattern |
| [savedObjectToSpec](./kibana-plugin-plugins-data-server.indexpatternsservice.savedobjecttospec.md) | | (savedObject: SavedObject<IndexPatternAttributes>) => IndexPatternSpec
| Converts index pattern saved object to index pattern spec |
diff --git a/src/plugins/data/common/index_patterns/index.ts b/src/plugins/data/common/index_patterns/index.ts
index 7f6249caceb52..6a3f1021c328e 100644
--- a/src/plugins/data/common/index_patterns/index.ts
+++ b/src/plugins/data/common/index_patterns/index.ts
@@ -9,7 +9,7 @@
export * from './fields';
export * from './types';
export { IndexPatternsService, IndexPatternsContract } from './index_patterns';
-export type { IndexPattern } from './index_patterns';
+export type { IndexPattern, IndexPatternListItem } from './index_patterns';
export * from './errors';
export * from './expressions';
export * from './constants';
diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts
index 942b629775c41..b1f062e15b01e 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts
@@ -138,11 +138,11 @@ describe('IndexPatterns', () => {
expect((await indexPatterns.get(id)).fields.length).toBe(1);
});
- test('savedObjectCache pre-fetches only title', async () => {
+ test('savedObjectCache pre-fetches title, type, typeMeta', async () => {
expect(await indexPatterns.getIds()).toEqual(['id']);
expect(savedObjectsClient.find).toHaveBeenCalledWith({
type: 'index-pattern',
- fields: ['title'],
+ fields: ['title', 'type', 'typeMeta'],
perPage: 10000,
});
});
diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
index 0730407165a38..d1af7391d222c 100644
--- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
+++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
@@ -29,6 +29,7 @@ import {
FieldAttrs,
FieldSpec,
IndexPatternFieldMap,
+ TypeMeta,
} from '../types';
import { FieldFormatsStartCommon } from '../../field_formats';
import { UI_SETTINGS, SavedObject } from '../../../common';
@@ -40,8 +41,21 @@ import { castEsToKbnFieldTypeName } from '../../kbn_field_types';
const MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS = 3;
-export interface IndexPatternSavedObjectAttrs {
+export type IndexPatternSavedObjectAttrs = Pick<
+ IndexPatternAttributes,
+ 'title' | 'type' | 'typeMeta'
+>;
+
+export type IndexPatternListSavedObjectAttrs = Pick<
+ IndexPatternAttributes,
+ 'title' | 'type' | 'typeMeta'
+>;
+
+export interface IndexPatternListItem {
+ id: string;
title: string;
+ type?: string;
+ typeMeta?: TypeMeta;
}
interface IndexPatternsServiceDeps {
@@ -98,7 +112,7 @@ export class IndexPatternsService {
private async refreshSavedObjectsCache() {
const so = await this.savedObjectsClient.find({
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
- fields: ['title'],
+ fields: ['title', 'type', 'typeMeta'],
perPage: 10000,
});
this.savedObjectsCache = so;
@@ -156,9 +170,7 @@ export class IndexPatternsService {
* Get list of index pattern ids with titles
* @param refresh Force refresh of index pattern list
*/
- getIdsWithTitle = async (
- refresh: boolean = false
- ): Promise> => {
+ getIdsWithTitle = async (refresh: boolean = false): Promise => {
if (!this.savedObjectsCache || refresh) {
await this.refreshSavedObjectsCache();
}
@@ -168,6 +180,8 @@ export class IndexPatternsService {
return this.savedObjectsCache.map((obj) => ({
id: obj?.id,
title: obj?.attributes?.title,
+ type: obj?.attributes?.type,
+ typeMeta: obj?.attributes?.typeMeta && JSON.parse(obj?.attributes?.typeMeta),
}));
};
@@ -591,7 +605,7 @@ export class IndexPatternsService {
const createdIndexPattern = await this.initFromSavedObject(response);
this.indexPatternCache.set(createdIndexPattern.id!, Promise.resolve(createdIndexPattern));
if (this.savedObjectsCache) {
- this.savedObjectsCache.push(response as SavedObject);
+ this.savedObjectsCache.push(response as SavedObject);
}
return createdIndexPattern;
}
diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts
index 9af1cbf95d94d..0843e4d587503 100644
--- a/src/plugins/data/public/index.ts
+++ b/src/plugins/data/public/index.ts
@@ -253,6 +253,7 @@ export {
IndexPattern,
IIndexPatternFieldList,
IndexPatternField,
+ TypeMeta,
} from './index_patterns';
export {
@@ -270,6 +271,7 @@ export {
fieldList,
INDEX_PATTERN_SAVED_OBJECT_TYPE,
IndexPatternType,
+ IndexPatternListItem,
} from '../common';
export { DuplicateIndexPatternError } from '../common/index_patterns/errors';
diff --git a/src/plugins/data/public/index_patterns/index.ts b/src/plugins/data/public/index_patterns/index.ts
index ed3294c2d03e0..d5b61d83a993c 100644
--- a/src/plugins/data/public/index_patterns/index.ts
+++ b/src/plugins/data/public/index_patterns/index.ts
@@ -21,7 +21,7 @@ export {
onUnsupportedTimePattern,
} from './index_patterns';
-export { IndexPatternField, IIndexPatternFieldList } from '../../common/index_patterns';
+export { IndexPatternField, IIndexPatternFieldList, TypeMeta } from '../../common/index_patterns';
export {
IndexPatternsService,
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index f0dbabbd7ffcc..9edf9823b53ea 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -1471,7 +1471,7 @@ export class IndexPattern implements IIndexPattern {
title: string;
toSpec(): IndexPatternSpec;
type: string | undefined;
- typeMeta?: IndexPatternTypeMeta;
+ typeMeta?: TypeMeta;
version: string | undefined;
}
@@ -1584,6 +1584,20 @@ export class IndexPatternField implements IFieldType {
get visualizable(): boolean;
}
+// Warning: (ae-missing-release-tag) "IndexPatternListItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export interface IndexPatternListItem {
+ // (undocumented)
+ id: string;
+ // (undocumented)
+ title: string;
+ // (undocumented)
+ type?: string;
+ // (undocumented)
+ typeMeta?: TypeMeta;
+}
+
// Warning: (ae-forgotten-export) The symbol "name" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
@@ -1651,7 +1665,7 @@ export interface IndexPatternSpec {
// (undocumented)
type?: string;
// (undocumented)
- typeMeta?: IndexPatternTypeMeta;
+ typeMeta?: TypeMeta;
version?: string;
}
@@ -1673,20 +1687,15 @@ export class IndexPatternsService {
fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record;
find: (search: string, size?: number) => Promise;
get: (id: string) => Promise;
- // Warning: (ae-forgotten-export) The symbol "IndexPatternSavedObjectAttrs" needs to be exported by the entry point index.d.ts
- //
// (undocumented)
- getCache: () => Promise[] | null | undefined>;
+ getCache: () => Promise>[] | null | undefined>;
getDefault: () => Promise;
getDefaultId: () => Promise;
getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise;
// Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts
getFieldsForWildcard: (options: GetFieldsOptions) => Promise;
getIds: (refresh?: boolean) => Promise;
- getIdsWithTitle: (refresh?: boolean) => Promise>;
+ getIdsWithTitle: (refresh?: boolean) => Promise;
getTitles: (refresh?: boolean) => Promise;
// (undocumented)
migrate(indexPattern: IndexPattern, newTitle: string): Promise;
@@ -1706,18 +1715,6 @@ export enum IndexPatternType {
ROLLUP = "rollup"
}
-// Warning: (ae-missing-release-tag) "TypeMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
-//
-// @public (undocumented)
-export interface IndexPatternTypeMeta {
- // (undocumented)
- aggs?: Record;
- // (undocumented)
- params?: {
- rollup_index: string;
- };
-}
-
// Warning: (ae-missing-release-tag) "injectReferences" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -2695,6 +2692,22 @@ export type TimeRange = {
mode?: 'absolute' | 'relative';
};
+// Warning: (ae-missing-release-tag) "TypeMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+interface TypeMeta {
+ // (undocumented)
+ aggs?: Record;
+ // (undocumented)
+ params?: {
+ rollup_index: string;
+ };
+}
+
+export { TypeMeta as IndexPatternTypeMeta }
+
+export { TypeMeta }
+
// Warning: (ae-missing-release-tag) "UI_SETTINGS" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -2791,20 +2804,20 @@ export interface WaitUntilNextSessionCompletesOptions {
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:410:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:413:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:422:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:423:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:425:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:434:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:437:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:412:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:414:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:415:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:425:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:426:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:427:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:435:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:439:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts
diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md
index 8300a83010845..d8472a496ebec 100644
--- a/src/plugins/data/server/server.api.md
+++ b/src/plugins/data/server/server.api.md
@@ -949,20 +949,16 @@ class IndexPatternsService {
fieldArrayToMap: (fields: FieldSpec[], fieldAttrs?: FieldAttrs | undefined) => Record;
find: (search: string, size?: number) => Promise;
get: (id: string) => Promise;
- // Warning: (ae-forgotten-export) The symbol "IndexPatternSavedObjectAttrs" needs to be exported by the entry point index.d.ts
- //
// (undocumented)
- getCache: () => Promise[] | null | undefined>;
+ getCache: () => Promise>[] | null | undefined>;
getDefault: () => Promise;
getDefaultId: () => Promise;
getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise;
// Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts
getFieldsForWildcard: (options: GetFieldsOptions) => Promise;
getIds: (refresh?: boolean) => Promise;
- getIdsWithTitle: (refresh?: boolean) => Promise>;
+ // Warning: (ae-forgotten-export) The symbol "IndexPatternListItem" needs to be exported by the entry point index.d.ts
+ getIdsWithTitle: (refresh?: boolean) => Promise;
getTitles: (refresh?: boolean) => Promise;
// (undocumented)
migrate(indexPattern: IndexPattern, newTitle: string): Promise;
diff --git a/src/plugins/index_pattern_management/public/components/utils.ts b/src/plugins/index_pattern_management/public/components/utils.ts
index 68e78199798b4..0d4c4d0a29c7e 100644
--- a/src/plugins/index_pattern_management/public/components/utils.ts
+++ b/src/plugins/index_pattern_management/public/components/utils.ts
@@ -7,35 +7,50 @@
*/
import { IndexPatternsContract } from 'src/plugins/data/public';
+import { IFieldType, IndexPattern, IndexPatternListItem } from 'src/plugins/data/public';
+import { i18n } from '@kbn/i18n';
import { IndexPatternManagementStart } from '../plugin';
+const defaultIndexPatternListName = i18n.translate(
+ 'indexPatternManagement.editIndexPattern.list.defaultIndexPatternListName',
+ {
+ defaultMessage: 'Default',
+ }
+);
+
+const rollupIndexPatternListName = i18n.translate(
+ 'indexPatternManagement.editIndexPattern.list.rollupIndexPatternListName',
+ {
+ defaultMessage: 'Rollup',
+ }
+);
+
+const isRollup = (indexPatternType: string = '') => {
+ return indexPatternType === 'rollup';
+};
+
export async function getIndexPatterns(
defaultIndex: string,
indexPatternManagementStart: IndexPatternManagementStart,
indexPatternsService: IndexPatternsContract
) {
const existingIndexPatterns = await indexPatternsService.getIdsWithTitle(true);
- const indexPatternsListItems = await Promise.all(
- existingIndexPatterns.map(async ({ id, title }) => {
- const isDefault = defaultIndex === id;
- const pattern = await indexPatternsService.get(id);
- const tags = (indexPatternManagementStart as IndexPatternManagementStart).list.getIndexPatternTags(
- pattern,
- isDefault
- );
-
- return {
- id,
- title,
- default: isDefault,
- tags,
- // the prepending of 0 at the default pattern takes care of prioritization
- // so the sorting will but the default index on top
- // or on bottom of a the table
- sort: `${isDefault ? '0' : '1'}${title}`,
- };
- })
- );
+ const indexPatternsListItems = existingIndexPatterns.map((idxPattern) => {
+ const { id, title } = idxPattern;
+ const isDefault = defaultIndex === id;
+ const tags = getTags(idxPattern, isDefault);
+
+ return {
+ id,
+ title,
+ default: isDefault,
+ tags,
+ // the prepending of 0 at the default pattern takes care of prioritization
+ // so the sorting will but the default index on top
+ // or on bottom of a the table
+ sort: `${isDefault ? '0' : '1'}${title}`,
+ };
+ });
return (
indexPatternsListItems.sort((a, b) => {
@@ -49,3 +64,82 @@ export async function getIndexPatterns(
}) || []
);
}
+
+export const getTags = (indexPattern: IndexPatternListItem | IndexPattern, isDefault: boolean) => {
+ const tags = [];
+ if (isDefault) {
+ tags.push({
+ key: 'default',
+ name: defaultIndexPatternListName,
+ });
+ }
+ if (isRollup(indexPattern.type)) {
+ tags.push({
+ key: 'rollup',
+ name: rollupIndexPatternListName,
+ });
+ }
+ return tags;
+};
+
+export const areScriptedFieldsEnabled = (indexPattern: IndexPatternListItem | IndexPattern) => {
+ return !isRollup(indexPattern.type);
+};
+
+export const getFieldInfo = (
+ indexPattern: IndexPatternListItem | IndexPattern,
+ field: IFieldType
+) => {
+ if (!isRollup(indexPattern.type)) {
+ return [];
+ }
+
+ const allAggs = indexPattern.typeMeta?.aggs;
+ const fieldAggs: string[] | undefined =
+ allAggs && Object.keys(allAggs).filter((agg) => allAggs[agg][field.name]);
+
+ if (!fieldAggs || !fieldAggs.length) {
+ return [];
+ }
+
+ return ['Rollup aggregations:'].concat(
+ fieldAggs.map((aggName) => {
+ const agg = allAggs![aggName][field.name];
+ switch (aggName) {
+ case 'date_histogram':
+ return i18n.translate(
+ 'indexPatternManagement.editIndexPattern.list.dateHistogramSummary',
+ {
+ defaultMessage: '{aggName} (interval: {interval}, {delay} {time_zone})',
+ values: {
+ aggName,
+ interval: agg.fixed_interval,
+ delay: agg.delay
+ ? i18n.translate(
+ 'indexPatternManagement.editIndexPattern.list.DateHistogramDelaySummary',
+ {
+ defaultMessage: 'delay: {delay},',
+ values: {
+ delay: agg.delay,
+ },
+ }
+ )
+ : '',
+ time_zone: agg.time_zone,
+ },
+ }
+ );
+ case 'histogram':
+ return i18n.translate('indexPatternManagement.editIndexPattern.list.histogramSummary', {
+ defaultMessage: '{aggName} (interval: {interval})',
+ values: {
+ aggName,
+ interval: agg.interval,
+ },
+ });
+ default:
+ return aggName;
+ }
+ })
+ );
+};