Skip to content

Commit e7951eb

Browse files
authored
remove force refresh on index pattern class init (#76248)
1 parent dc37cca commit e7951eb

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.init.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@
77
<b>Signature:</b>
88

99
```typescript
10-
init(forceFieldRefresh?: boolean): Promise<this>;
10+
init(): Promise<this>;
1111
```
12-
13-
## Parameters
14-
15-
| Parameter | Type | Description |
16-
| --- | --- | --- |
17-
| forceFieldRefresh | <code>boolean</code> | |
18-
1912
<b>Returns:</b>
2013

2114
`Promise<this>`

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export declare class IndexPattern implements IIndexPattern
5050
| [getScriptedFields()](./kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md) | | |
5151
| [getSourceFiltering()](./kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md) | | |
5252
| [getTimeField()](./kibana-plugin-plugins-data-public.indexpattern.gettimefield.md) | | |
53-
| [init(forceFieldRefresh)](./kibana-plugin-plugins-data-public.indexpattern.init.md) | | |
53+
| [init()](./kibana-plugin-plugins-data-public.indexpattern.init.md) | | |
5454
| [initFromSpec(spec)](./kibana-plugin-plugins-data-public.indexpattern.initfromspec.md) | | |
5555
| [isTimeBased()](./kibana-plugin-plugins-data-public.indexpattern.istimebased.md) | | |
5656
| [isTimeBasedWildcard()](./kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md) | | |

src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ export class IndexPattern implements IIndexPattern {
172172
});
173173
}
174174

175-
private async indexFields(forceFieldRefresh: boolean = false, specs?: FieldSpec[]) {
175+
private async indexFields(specs?: FieldSpec[]) {
176176
if (!this.id) {
177177
return;
178178
}
179179

180-
if (forceFieldRefresh || this.isFieldRefreshRequired(specs)) {
180+
if (this.isFieldRefreshRequired(specs)) {
181181
await this.refreshFields();
182182
} else {
183183
if (specs) {
@@ -213,7 +213,7 @@ export class IndexPattern implements IIndexPattern {
213213
return this;
214214
}
215215

216-
private updateFromElasticSearch(response: any, forceFieldRefresh: boolean = false) {
216+
private updateFromElasticSearch(response: any) {
217217
if (!response.found) {
218218
throw new SavedObjectNotFound(savedObjectType, this.id, 'management/kibana/indexPatterns');
219219
}
@@ -239,7 +239,7 @@ export class IndexPattern implements IIndexPattern {
239239
}
240240
this.version = response.version;
241241

242-
return this.indexFields(forceFieldRefresh, response.fields);
242+
return this.indexFields(response.fields);
243243
}
244244

245245
getComputedFields() {
@@ -283,7 +283,7 @@ export class IndexPattern implements IIndexPattern {
283283
};
284284
}
285285

286-
async init(forceFieldRefresh = false) {
286+
async init() {
287287
if (!this.id) {
288288
return this; // no id === no elasticsearch document
289289
}
@@ -307,7 +307,7 @@ export class IndexPattern implements IIndexPattern {
307307
};
308308
// Do this before we attempt to update from ES since that call can potentially perform a save
309309
this.originalBody = this.prepBody();
310-
await this.updateFromElasticSearch(response, forceFieldRefresh);
310+
await this.updateFromElasticSearch(response);
311311
// Do it after to ensure we have the most up to date information
312312
this.originalBody = this.prepBody();
313313

src/plugins/data/public/public.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ export class IndexPattern implements IIndexPattern {
10061006
// (undocumented)
10071007
id?: string;
10081008
// (undocumented)
1009-
init(forceFieldRefresh?: boolean): Promise<this>;
1009+
init(): Promise<this>;
10101010
// Warning: (ae-forgotten-export) The symbol "IndexPatternSpec" needs to be exported by the entry point index.d.ts
10111011
//
10121012
// (undocumented)

src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const EditIndexPattern = withRouter(
121121
const refreshFields = () => {
122122
overlays.openConfirm(confirmMessage, confirmModalOptionsRefresh).then(async (isConfirmed) => {
123123
if (isConfirmed) {
124-
await indexPattern.init(true);
124+
await indexPattern.refreshFields();
125125
setFields(indexPattern.getNonScriptedFields());
126126
}
127127
});

0 commit comments

Comments
 (0)