|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License; |
| 4 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | +import { IIndexPattern } from 'src/plugins/data/public'; |
| 7 | +import { |
| 8 | + IEsSearchRequest, |
| 9 | + IEsSearchResponse, |
| 10 | + IFieldSubType, |
| 11 | +} from '../../../../../../src/plugins/data/common'; |
| 12 | +import { DocValueFields, Maybe } from '../common'; |
| 13 | + |
| 14 | +export type BeatFieldsFactoryQueryType = 'beatFields'; |
| 15 | + |
| 16 | +interface FieldInfo { |
| 17 | + category: string; |
| 18 | + description?: string; |
| 19 | + example?: string | number; |
| 20 | + format?: string; |
| 21 | + name: string; |
| 22 | + type?: string; |
| 23 | +} |
| 24 | + |
| 25 | +export interface IndexField { |
| 26 | + /** Where the field belong */ |
| 27 | + category: string; |
| 28 | + /** Example of field's value */ |
| 29 | + example?: Maybe<string | number>; |
| 30 | + /** whether the field's belong to an alias index */ |
| 31 | + indexes: Array<Maybe<string>>; |
| 32 | + /** The name of the field */ |
| 33 | + name: string; |
| 34 | + /** The type of the field's values as recognized by Kibana */ |
| 35 | + type: string; |
| 36 | + /** Whether the field's values can be efficiently searched for */ |
| 37 | + searchable: boolean; |
| 38 | + /** Whether the field's values can be aggregated */ |
| 39 | + aggregatable: boolean; |
| 40 | + /** Description of the field */ |
| 41 | + description?: Maybe<string>; |
| 42 | + format?: Maybe<string>; |
| 43 | + /** the elastic type as mapped in the index */ |
| 44 | + esTypes?: string[]; |
| 45 | + subType?: IFieldSubType; |
| 46 | + readFromDocValues: boolean; |
| 47 | +} |
| 48 | + |
| 49 | +export type BeatFields = Record<string, FieldInfo>; |
| 50 | + |
| 51 | +export interface IndexFieldsStrategyRequest extends IEsSearchRequest { |
| 52 | + indices: string[]; |
| 53 | + onlyCheckIfIndicesExist: boolean; |
| 54 | +} |
| 55 | + |
| 56 | +export interface IndexFieldsStrategyResponse extends IEsSearchResponse { |
| 57 | + indexFields: IndexField[]; |
| 58 | + indicesExist: string[]; |
| 59 | +} |
| 60 | + |
| 61 | +export interface BrowserField { |
| 62 | + aggregatable: boolean; |
| 63 | + category: string; |
| 64 | + description: string | null; |
| 65 | + example: string | number | null; |
| 66 | + fields: Readonly<Record<string, Partial<BrowserField>>>; |
| 67 | + format: string; |
| 68 | + indexes: string[]; |
| 69 | + name: string; |
| 70 | + searchable: boolean; |
| 71 | + type: string; |
| 72 | +} |
| 73 | + |
| 74 | +export type BrowserFields = Readonly<Record<string, Partial<BrowserField>>>; |
| 75 | + |
| 76 | +export const EMPTY_BROWSER_FIELDS = {}; |
| 77 | +export const EMPTY_DOCVALUE_FIELD: DocValueFields[] = []; |
| 78 | +export const EMPTY_INDEX_PATTERN: IIndexPattern = { |
| 79 | + fields: [], |
| 80 | + title: '', |
| 81 | +}; |
0 commit comments