[7.x] [Index patterns] Deprecate scripted field API functions (#100907) (#101301)

* [Index patterns] Deprecate scripted field API functions (#100907)

* deprecate scripted field functions in index patterns api

* merge
This commit is contained in:
Matthew Kime 2021-06-03 13:24:40 -05:00 committed by GitHub
parent 1609e136a3
commit 725d413131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 54 additions and 4 deletions

View file

@ -4,6 +4,11 @@
## IndexPattern.addScriptedField() method
> Warning: This API is now obsolete.
>
> use runtime field instead
>
Add scripted field to field list
<b>Signature:</b>

View file

@ -4,6 +4,11 @@
## IndexPattern.getNonScriptedFields() method
> Warning: This API is now obsolete.
>
> use runtime field instead
>
<b>Signature:</b>
```typescript

View file

@ -4,6 +4,11 @@
## IndexPattern.getScriptedFields() method
> Warning: This API is now obsolete.
>
> use runtime field instead
>
<b>Signature:</b>
```typescript

View file

@ -4,6 +4,11 @@
## IndexPattern.removeScriptedField() method
> Warning: This API is now obsolete.
>
> use runtime field instead
>
Remove scripted field from field list
<b>Signature:</b>

View file

@ -4,6 +4,10 @@
## IndexPattern.addScriptedField() method
> Warning: This API is now obsolete.
>
>
Add scripted field to field list
<b>Signature:</b>

View file

@ -4,6 +4,10 @@
## IndexPattern.getNonScriptedFields() method
> Warning: This API is now obsolete.
>
>
<b>Signature:</b>
```typescript

View file

@ -4,6 +4,10 @@
## IndexPattern.getScriptedFields() method
> Warning: This API is now obsolete.
>
>
<b>Signature:</b>
```typescript

View file

@ -4,6 +4,10 @@
## IndexPattern.removeScriptedField() method
> Warning: This API is now obsolete.
>
>
Remove scripted field from field list
<b>Signature:</b>

View file

@ -240,6 +240,7 @@ export class IndexPattern implements IIndexPattern {
* @param script script code
* @param fieldType
* @param lang
* @deprecated use runtime field instead
*/
async addScriptedField(name: string, script: string, fieldType: string = 'string') {
const scriptedFields = this.getScriptedFields();
@ -265,6 +266,7 @@ export class IndexPattern implements IIndexPattern {
/**
* Remove scripted field from field list
* @param fieldName
* @deprecated use runtime field instead
*/
removeScriptedField(fieldName: string) {
@ -274,10 +276,18 @@ export class IndexPattern implements IIndexPattern {
}
}
/**
*
* @deprecated use runtime field instead
*/
getNonScriptedFields() {
return [...this.fields.getAll().filter((field) => !field.scripted)];
}
/**
*
* @deprecated use runtime field instead
*/
getScriptedFields() {
return [...this.fields.getAll().filter((field) => field.scripted)];
}

View file

@ -1356,6 +1356,7 @@ export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addRuntimeField(name: string, runtimeField: RuntimeField): void;
// @deprecated
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
readonly allowNoIndex: boolean;
// (undocumented)
@ -1409,7 +1410,7 @@ export class IndexPattern implements IIndexPattern {
getFormatterForFieldNoDefault(fieldname: string): FieldFormat | undefined;
// (undocumented)
getIndex(): string;
// (undocumented)
// @deprecated (undocumented)
getNonScriptedFields(): IndexPatternField[];
getOriginalSavedObjectBody: () => {
fieldAttrs?: string | undefined;
@ -1422,7 +1423,7 @@ export class IndexPattern implements IIndexPattern {
typeMeta?: string | undefined;
type?: string | undefined;
};
// (undocumented)
// @deprecated (undocumented)
getScriptedFields(): IndexPatternField[];
getSourceFiltering(): {
excludes: any[];
@ -1442,6 +1443,7 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
metaFields: string[];
removeRuntimeField(name: string): void;
// @deprecated
removeScriptedField(fieldName: string): void;
resetOriginalSavedObjectBody: () => void;
// (undocumented)

View file

@ -753,6 +753,7 @@ export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addRuntimeField(name: string, runtimeField: RuntimeField): void;
// @deprecated
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
readonly allowNoIndex: boolean;
// (undocumented)
@ -810,7 +811,7 @@ export class IndexPattern implements IIndexPattern {
getIndex(): string;
// Warning: (ae-forgotten-export) The symbol "IndexPatternField" needs to be exported by the entry point index.d.ts
//
// (undocumented)
// @deprecated (undocumented)
getNonScriptedFields(): IndexPatternField[];
getOriginalSavedObjectBody: () => {
fieldAttrs?: string | undefined;
@ -823,7 +824,7 @@ export class IndexPattern implements IIndexPattern {
typeMeta?: string | undefined;
type?: string | undefined;
};
// (undocumented)
// @deprecated (undocumented)
getScriptedFields(): IndexPatternField[];
getSourceFiltering(): {
excludes: any[];
@ -843,6 +844,7 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
metaFields: string[];
removeRuntimeField(name: string): void;
// @deprecated
removeScriptedField(fieldName: string): void;
resetOriginalSavedObjectBody: () => void;
// (undocumented)