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U,IACVA,GAAUqG,EAAI,KACdrG,GAAU,KACDqG,EAAI,OACbrG,GAAU,IACVA,GAAUqG,EAAI,KACdrG,GAAU,KAEVA,GAAUqG,EAAI,KAGZA,EAAI,WAAa,OACnBrG,GAAU,IAAMqG,EAAI,WAGlBA,EAAI,OAAS,OACfrG,GAAU,IAAMqG,EAAI,QAIpBA,EAAI,WACFA,EAAI,YAAc,QAAUA,EAAI,YAAc,OAChDrG,GAAU,IAEVA,GAAU,IAGZA,GAAUqG,EAAI,SACdrG,GAAU,OACVA,GAAUqG,EAAI,SAEVA,EAAI,YAAc,QAAUA,EAAI,YAAc,QAChDrG,GAAU,IAEVA,GAAU,KAIVqG,EAAI,aACNrG,GAAU,IAENqG,EAAI,aAAe,KACrBrG,GAAUqG,EAAI,aAIXrG,CACT,C","sources":["webpack://grafana/./node_modules/@grafana/experimental/dist/esm/ConfigEditor/AdvancedSettings/AdvancedHttpSettings.js","webpack://grafana/./public/app/plugins/datasource/elasticsearch/hooks/useStatelessReducer.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/BucketScriptSettingsEditor/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/aggregations.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/queryDef.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/state.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/reducer.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/reducer.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/hooks/useNextId.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/QueryEditorRow.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/aggregations.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/hooks/useFields.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/styles.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/SettingsEditorContainer.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/QueryBuilder.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/hooks/useCreatableSelectPersistedBehaviour.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/DateHistogramSettingsEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/state/actions.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/state/reducer.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/useDescription.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/BucketAggregationEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/MetricPicker.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/SettingField.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/BucketScriptSettingsEditor/state/actions.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/BucketScriptSettingsEditor/state/reducer.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/BucketScriptSettingsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/MovingAverageSettingsEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/TopMetricsSettingsEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/useDescription.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/SettingsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/QueryEditorSpecialMetricRow.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/styles.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/MetricEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/QueryTypeSelector.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/index.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/DataLink.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/DataLinks.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/ElasticDetails.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/LogsConfig.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/utils.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/configuration/ConfigEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/IndexPattern.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/LanguageProvider.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/ElasticResponse.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/tracking.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/LegacyQueryRunner.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/components/QueryEditor/AnnotationQueryEditor.tsx","webpack://grafana/./public/app/plugins/datasource/elasticsearch/guards.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/modifyQuery.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/datasource.ts","webpack://grafana/./public/app/plugins/datasource/elasticsearch/module.ts","webpack://grafana/./node_modules/lucene/lib/escaping.js","webpack://grafana/./node_modules/lucene/lib/lucene.js","webpack://grafana/./node_modules/lucene/lib/queryParser.js","webpack://grafana/./node_modules/lucene/lib/toString.js"],"sourcesContent":["import React__default from 'react';\nimport { css, cx } from '@emotion/css';\nimport { InlineField, TagsInput, Input } from '@grafana/ui';\nimport { ConfigSubSection } from '../ConfigSection/ConfigSubSection.js';\n\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nconst AdvancedHttpSettings = ({\n config,\n onChange,\n className\n}) => {\n const onCookiesChange = (cookies) => {\n onChange(__spreadProps(__spreadValues({}, config), {\n jsonData: __spreadProps(__spreadValues({}, config.jsonData), {\n keepCookies: cookies\n })\n }));\n };\n const onTimeoutChange = (event) => {\n onChange(__spreadProps(__spreadValues({}, config), {\n jsonData: __spreadProps(__spreadValues({}, config.jsonData), {\n timeout: parseInt(event.currentTarget.value, 10)\n })\n }));\n };\n const styles = {\n container: css({\n maxWidth: 578\n })\n };\n return /* @__PURE__ */ React__default.createElement(ConfigSubSection, { title: \"Advanced HTTP settings\", className: cx(styles.container, className) }, /* @__PURE__ */ React__default.createElement(\n InlineField,\n {\n htmlFor: \"advanced-http-cookies\",\n label: \"Allowed cookies\",\n labelWidth: 24,\n tooltip: \"Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.\",\n disabled: config.readOnly,\n grow: true\n },\n /* @__PURE__ */ React__default.createElement(\n TagsInput,\n {\n id: \"advanced-http-cookies\",\n placeholder: \"New cookie (hit enter to add)\",\n tags: config.jsonData.keepCookies,\n onChange: onCookiesChange\n }\n )\n ), /* @__PURE__ */ React__default.createElement(\n InlineField,\n {\n htmlFor: \"advanced-http-timeout\",\n label: \"Timeout\",\n labelWidth: 24,\n tooltip: \"HTTP request timeout in seconds\",\n disabled: config.readOnly,\n grow: true\n },\n /* @__PURE__ */ React__default.createElement(\n Input,\n {\n id: \"advanced-http-timeout\",\n type: \"number\",\n min: 0,\n placeholder: \"Timeout in seconds\",\n \"aria-label\": \"Timeout in seconds\",\n value: config.jsonData.timeout,\n onChange: onTimeoutChange\n }\n )\n ));\n};\n\nexport { AdvancedHttpSettings };\n//# sourceMappingURL=AdvancedHttpSettings.js.map\n","import { Action } from '@reduxjs/toolkit';\nimport { createContext, useCallback, useContext } from 'react';\n\nexport type Reducer<S, A extends Action> = (state: S, action: A) => S;\n\nexport const combineReducers =\n <S, A extends Action = Action>(reducers: { [P in keyof S]: Reducer<S[P], A> }) =>\n (state: S, action: A): Partial<S> => {\n const newState = {} as S;\n for (const key in reducers) {\n newState[key] = reducers[key](state[key], action);\n }\n return newState;\n };\n\nexport const useStatelessReducer = <State, A = Action>(\n onChange: (value: State) => void,\n state: State,\n reducer: (state: State, action: A) => State\n) => {\n const dispatch = useCallback(\n (action: A) => {\n onChange(reducer(state, action));\n },\n [onChange, state, reducer]\n );\n\n return dispatch;\n};\n\nexport const DispatchContext = createContext<((action: Action) => void) | undefined>(undefined);\n\nexport const useDispatch = <T extends Action = Action>(): ((action: T) => void) => {\n const dispatch = useContext(DispatchContext);\n\n if (!dispatch) {\n throw new Error('Use DispatchContext first.');\n }\n\n return dispatch;\n};\n","import { PipelineVariable } from '../../../../../types';\n\nexport const defaultPipelineVariable = (name: string): PipelineVariable => ({ name, pipelineAgg: '' });\n\n/**\n * Given an array of pipeline variables generates a new unique pipeline variable name in the form of `var{n}`.\n * The value for `n` is calculated based on the variables names in pipelineVars matching `var{n}`.\n */\nexport const generatePipelineVariableName = (pipelineVars: PipelineVariable[]): string =>\n `var${Math.max(0, ...pipelineVars.map((v) => parseInt(v.name.match('^var(\\\\d+)$')?.[1] || '0', 10))) + 1}`;\n","import {\n PipelineMetricAggregationWithMultipleBucketPaths,\n MetricAggregationWithMeta,\n MovingAverage,\n MetricAggregationType,\n BaseMetricAggregation,\n MetricAggregationWithField,\n MetricAggregationWithMissingSupport,\n MetricAggregationWithInlineScript,\n PipelineMetricAggregation,\n MetricAggregationWithSettings,\n} from '../../../types';\n\nimport { metricAggregationConfig } from './utils';\n\nexport const isEWMAMovingAverage = (metric: MovingAverage | MovingAverage<'ewma'>): metric is MovingAverage<'ewma'> =>\n metric.settings?.model === 'ewma';\n\nexport const isHoltMovingAverage = (metric: MovingAverage | MovingAverage<'holt'>): metric is MovingAverage<'holt'> =>\n metric.settings?.model === 'holt';\n\nexport const isHoltWintersMovingAverage = (\n metric: MovingAverage | MovingAverage<'holt_winters'>\n): metric is MovingAverage<'holt_winters'> => metric.settings?.model === 'holt_winters';\n\nexport const isMovingAverageWithModelSettings = (\n metric: MovingAverage\n): metric is MovingAverage<'ewma'> | MovingAverage<'holt'> | MovingAverage<'holt_winters'> =>\n ['holt', 'ewma', 'holt_winters'].includes(metric.settings?.model || '');\n\n// Guards\n// Given the structure of the aggregations (ie. `settings` field being always optional) we cannot\n// determine types based solely on objects' properties, therefore we use `metricAggregationConfig` as the\n// source of truth.\n\n/**\n * Checks if `metric` requires a field (either referring to a document or another aggregation)\n * @param metric\n */\nexport const isMetricAggregationWithField = (\n metric: BaseMetricAggregation | MetricAggregationWithField\n): metric is MetricAggregationWithField => metricAggregationConfig[metric.type].requiresField;\n\nexport const isPipelineAggregation = (\n metric: BaseMetricAggregation | PipelineMetricAggregation\n): metric is PipelineMetricAggregation => metricAggregationConfig[metric.type].isPipelineAgg;\n\nexport const isPipelineAggregationWithMultipleBucketPaths = (\n metric: BaseMetricAggregation | PipelineMetricAggregationWithMultipleBucketPaths\n): metric is PipelineMetricAggregationWithMultipleBucketPaths =>\n metricAggregationConfig[metric.type].supportsMultipleBucketPaths;\n\nexport const isMetricAggregationWithMissingSupport = (\n metric: BaseMetricAggregation | MetricAggregationWithMissingSupport\n): metric is MetricAggregationWithMissingSupport => metricAggregationConfig[metric.type].supportsMissing;\n\nexport const isMetricAggregationWithSettings = (\n metric: BaseMetricAggregation | MetricAggregationWithSettings\n): metric is MetricAggregationWithSettings => metricAggregationConfig[metric.type].hasSettings;\n\nexport const isMetricAggregationWithMeta = (\n metric: BaseMetricAggregation | MetricAggregationWithMeta\n): metric is MetricAggregationWithMeta => metricAggregationConfig[metric.type].hasMeta;\n\nexport const isMetricAggregationWithInlineScript = (\n metric: BaseMetricAggregation | MetricAggregationWithInlineScript\n): metric is MetricAggregationWithInlineScript => metricAggregationConfig[metric.type].supportsInlineScript;\n\nexport const METRIC_AGGREGATION_TYPES: MetricAggregationType[] = [\n 'count',\n 'avg',\n 'sum',\n 'min',\n 'max',\n 'extended_stats',\n 'percentiles',\n 'cardinality',\n 'raw_document',\n 'raw_data',\n 'logs',\n 'moving_avg',\n 'moving_fn',\n 'derivative',\n 'serial_diff',\n 'cumulative_sum',\n 'bucket_script',\n 'rate',\n 'top_metrics',\n];\n\nexport const isMetricAggregationType = (s: MetricAggregationType | string): s is MetricAggregationType =>\n METRIC_AGGREGATION_TYPES.includes(s as MetricAggregationType);\n","import { MetricsConfiguration, MetricAggregation, PipelineMetricAggregationType } from '../../../types';\n\nimport {\n defaultPipelineVariable,\n generatePipelineVariableName,\n} from './SettingsEditor/BucketScriptSettingsEditor/utils';\nimport { isMetricAggregationWithField, isPipelineAggregationWithMultipleBucketPaths } from './aggregations';\n\nexport const metricAggregationConfig: MetricsConfiguration = {\n count: {\n label: 'Count',\n impliedQueryType: 'metrics',\n requiresField: false,\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: false,\n hasMeta: false,\n supportsInlineScript: false,\n defaults: {},\n },\n avg: {\n label: 'Average',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsInlineScript: true,\n supportsMissing: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: false,\n defaults: {},\n },\n sum: {\n label: 'Sum',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsInlineScript: true,\n supportsMissing: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: false,\n defaults: {},\n },\n max: {\n label: 'Max',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsInlineScript: true,\n supportsMissing: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: false,\n defaults: {},\n },\n min: {\n label: 'Min',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsInlineScript: true,\n supportsMissing: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: false,\n defaults: {},\n },\n extended_stats: {\n label: 'Extended Stats',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsMissing: true,\n supportsInlineScript: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: true,\n defaults: {\n meta: {\n std_deviation_bounds_lower: true,\n std_deviation_bounds_upper: true,\n },\n },\n },\n percentiles: {\n label: 'Percentiles',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsMissing: true,\n supportsInlineScript: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n hasMeta: false,\n defaults: {\n settings: {\n percents: ['25', '50', '75', '95', '99'],\n },\n },\n },\n cardinality: {\n label: 'Unique Count',\n impliedQueryType: 'metrics',\n requiresField: true,\n supportsMissing: true,\n isPipelineAgg: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {},\n },\n moving_avg: {\n // deprecated in 6.4.0, removed in 8.0.0,\n // recommended replacement is moving_fn\n label: 'Moving Average',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: true,\n versionRange: '<8.0.0',\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n model: 'simple',\n window: '5',\n },\n },\n },\n moving_fn: {\n // TODO: Check this\n label: 'Moving Function',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: true,\n supportsMultipleBucketPaths: false,\n supportsInlineScript: false,\n supportsMissing: false,\n hasMeta: false,\n hasSettings: true,\n defaults: {},\n },\n derivative: {\n label: 'Derivative',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: true,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {},\n },\n serial_diff: {\n label: 'Serial Difference',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: true,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n lag: '1',\n },\n },\n },\n cumulative_sum: {\n label: 'Cumulative Sum',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: true,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {},\n },\n bucket_script: {\n label: 'Bucket Script',\n impliedQueryType: 'metrics',\n requiresField: false,\n isPipelineAgg: true,\n supportsMissing: false,\n supportsMultipleBucketPaths: true,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n pipelineVariables: [defaultPipelineVariable(generatePipelineVariableName([]))],\n },\n },\n raw_document: {\n label: 'Raw Document (deprecated)',\n requiresField: false,\n impliedQueryType: 'raw_document',\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n size: '500',\n },\n },\n },\n raw_data: {\n label: 'Raw Data',\n requiresField: false,\n impliedQueryType: 'raw_data',\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n size: '500',\n },\n },\n },\n logs: {\n label: 'Logs',\n requiresField: false,\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n impliedQueryType: 'logs',\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n limit: '500',\n },\n },\n },\n top_metrics: {\n label: 'Top Metrics',\n impliedQueryType: 'metrics',\n requiresField: false,\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: false,\n hasMeta: false,\n defaults: {\n settings: {\n order: 'desc',\n },\n },\n },\n rate: {\n label: 'Rate',\n impliedQueryType: 'metrics',\n requiresField: true,\n isPipelineAgg: false,\n supportsMissing: false,\n supportsMultipleBucketPaths: false,\n hasSettings: true,\n supportsInlineScript: true,\n hasMeta: false,\n defaults: {},\n },\n};\n\ninterface PipelineOption {\n label: string;\n default?: string | number | boolean;\n}\n\ntype PipelineOptions = {\n [K in PipelineMetricAggregationType]: PipelineOption[];\n};\n\nexport const pipelineOptions: PipelineOptions = {\n moving_avg: [\n { label: 'window', default: 5 },\n { label: 'model', default: 'simple' },\n { label: 'predict' },\n { label: 'minimize', default: false },\n ],\n moving_fn: [{ label: 'window', default: 5 }, { label: 'script' }],\n derivative: [{ label: 'unit' }],\n serial_diff: [{ label: 'lag' }],\n cumulative_sum: [{ label: 'format' }],\n bucket_script: [],\n};\n\n/**\n * Given a metric `MetricA` and an array of metrics, returns all children of `MetricA`.\n * `MetricB` is considered a child of `MetricA` if `MetricA` is referenced by `MetricB` in its `field` attribute\n * (`MetricA.id === MetricB.field`) or in its pipeline aggregation variables (for bucket_scripts).\n * @param metric\n * @param metrics\n */\nexport const getChildren = (metric: MetricAggregation, metrics: MetricAggregation[]): MetricAggregation[] => {\n const children = metrics.filter((m) => {\n // TODO: Check this.\n if (isPipelineAggregationWithMultipleBucketPaths(m)) {\n return m.pipelineVariables?.some((pv) => pv.pipelineAgg === metric.id);\n }\n\n return isMetricAggregationWithField(m) && metric.id === m.field;\n });\n\n return [...children, ...children.flatMap((child) => getChildren(child, metrics))];\n};\n","import { metricAggregationConfig, pipelineOptions } from './components/QueryEditor/MetricAggregationsEditor/utils';\nimport {\n ElasticsearchQuery,\n ExtendedStat,\n MetricAggregation,\n MovingAverageModelOption,\n MetricAggregationType,\n DateHistogram,\n} from './types';\n\nexport const extendedStats: ExtendedStat[] = [\n { label: 'Avg', value: 'avg' },\n { label: 'Min', value: 'min' },\n { label: 'Max', value: 'max' },\n { label: 'Sum', value: 'sum' },\n { label: 'Count', value: 'count' },\n { label: 'Std Dev', value: 'std_deviation' },\n { label: 'Std Dev Upper', value: 'std_deviation_bounds_upper' },\n { label: 'Std Dev Lower', value: 'std_deviation_bounds_lower' },\n];\n\nexport const movingAvgModelOptions: MovingAverageModelOption[] = [\n { label: 'Simple', value: 'simple' },\n { label: 'Linear', value: 'linear' },\n { label: 'Exponentially Weighted', value: 'ewma' },\n { label: 'Holt Linear', value: 'holt' },\n { label: 'Holt Winters', value: 'holt_winters' },\n];\n\nexport const highlightTags = {\n pre: '@HIGHLIGHT@',\n post: '@/HIGHLIGHT@',\n};\n\nexport const defaultGeoHashPrecisionString = '3';\n\nexport function defaultMetricAgg(id = '1'): MetricAggregation {\n return { type: 'count', id };\n}\n\nexport function defaultBucketAgg(id = '1'): DateHistogram {\n return { type: 'date_histogram', id, settings: { interval: 'auto' } };\n}\n\nexport const findMetricById = (metrics: MetricAggregation[], id: MetricAggregation['id']) =>\n metrics.find((metric) => metric.id === id);\n\nexport function hasMetricOfType(target: ElasticsearchQuery, type: MetricAggregationType): boolean {\n return !!target?.metrics?.some((m) => m.type === type);\n}\n\n// Even if we have type guards when building a query, we currently have no way of getting this information from the response.\n// We should try to find a better (type safe) way of doing the following 2.\nexport function isPipelineAgg(metricType: MetricAggregationType) {\n return metricType in pipelineOptions;\n}\n\nexport function isPipelineAggWithMultipleBucketPaths(metricType: MetricAggregationType) {\n return !!metricAggregationConfig[metricType].supportsMultipleBucketPaths;\n}\n","import { gte, SemVer } from 'semver';\n\nimport { isMetricAggregationWithField } from './components/QueryEditor/MetricAggregationsEditor/aggregations';\nimport { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils';\nimport { ElasticsearchQuery, MetricAggregation, MetricAggregationWithInlineScript } from './types';\n\nexport const describeMetric = (metric: MetricAggregation) => {\n if (!isMetricAggregationWithField(metric)) {\n return metricAggregationConfig[metric.type].label;\n }\n\n // TODO: field might be undefined\n return `${metricAggregationConfig[metric.type].label} ${metric.field}`;\n};\n\n/**\n * Utility function to clean up aggregations settings objects.\n * It removes nullish values and empty strings, array and objects\n * recursing over nested objects (not arrays).\n * @param obj\n */\nexport const removeEmpty = <T extends {}>(obj: T): Partial<T> =>\n Object.entries(obj).reduce((acc, [key, value]) => {\n // Removing nullish values (null & undefined)\n if (value == null) {\n return { ...acc };\n }\n\n // Removing empty arrays (This won't recurse the array)\n if (Array.isArray(value) && value.length === 0) {\n return { ...acc };\n }\n\n // Removing empty strings\n if (typeof value === 'string' && value.length === 0) {\n return { ...acc };\n }\n\n // Recursing over nested objects\n if (!Array.isArray(value) && typeof value === 'object') {\n const cleanObj = removeEmpty(value);\n\n if (Object.keys(cleanObj).length === 0) {\n return { ...acc };\n }\n\n return { ...acc, [key]: cleanObj };\n }\n\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n\n/**\n * This function converts an order by string to the correct metric id For example,\n * if the user uses the standard deviation extended stat for the order by,\n * the value would be \"1[std_deviation]\" and this would return \"1\"\n */\nexport const convertOrderByToMetricId = (orderBy: string): string | undefined => {\n const metricIdMatches = orderBy.match(/^(\\d+)/);\n return metricIdMatches ? metricIdMatches[1] : void 0;\n};\n\n/** Gets the actual script value for metrics that support inline scripts.\n *\n * This is needed because the `script` is a bit polymorphic.\n * when creating a query with Grafana < 7.4 it was stored as:\n * ```json\n * {\n * \"settings\": {\n * \"script\": {\n * \"inline\": \"value\"\n * }\n * }\n * }\n * ```\n *\n * while from 7.4 it's stored as\n * ```json\n * {\n * \"settings\": {\n * \"script\": \"value\"\n * }\n * }\n * ```\n *\n * This allows us to access both formats and support both queries created before 7.4 and after.\n */\nexport const getScriptValue = (metric: MetricAggregationWithInlineScript) =>\n (typeof metric.settings?.script === 'object' ? metric.settings?.script?.inline : metric.settings?.script) || '';\n\nexport const isSupportedVersion = (version: SemVer): boolean => {\n if (gte(version, '7.16.0')) {\n return true;\n }\n\n return false;\n};\n\nexport const unsupportedVersionMessage =\n 'Support for Elasticsearch versions after their end-of-life (currently versions < 7.16) was removed. Using unsupported version of Elasticsearch may lead to unexpected and incorrect results.';\n\n// To be considered a time series query, the last bucked aggregation must be a Date Histogram\nexport const isTimeSeriesQuery = (query: ElasticsearchQuery): boolean => {\n return query?.bucketAggs?.slice(-1)[0]?.type === 'date_histogram';\n};\n\n/*\n * This regex matches 3 types of variable reference with an optional format specifier\n * There are 6 capture groups that replace will return\n * \\$(\\w+) $var1\n * \\[\\[(\\w+?)(?::(\\w+))?\\]\\] [[var2]] or [[var2:fmt2]]\n * \\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?} ${var3} or ${var3.fieldPath} or ${var3:fmt3} (or ${var3.fieldPath:fmt3} but that is not a separate capture group)\n */\nexport const variableRegex = /\\$(\\w+)|\\[\\[(\\w+?)(?::(\\w+))?\\]\\]|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/g;\n\n// Copyright (c) 2014, Hugh Kennedy\n// Based on code from https://github.com/hughsk/flat/blob/master/index.js\n//\nexport function flattenObject(\n target: Record<string, unknown>,\n opts?: { delimiter?: string; maxDepth?: number; safe?: boolean }\n): Record<string, unknown> {\n opts = opts || {};\n\n const delimiter = opts.delimiter || '.';\n let maxDepth = opts.maxDepth || 3;\n let currentDepth = 1;\n const output: Record<string, unknown> = {};\n\n function step(object: Record<string, unknown>, prev: string | null) {\n Object.keys(object).forEach((key) => {\n const value = object[key];\n const isarray = opts?.safe && Array.isArray(value);\n const type = Object.prototype.toString.call(value);\n const isobject = type === '[object Object]';\n\n const newKey = prev ? prev + delimiter + key : key;\n\n if (!opts?.maxDepth) {\n maxDepth = currentDepth + 1;\n }\n\n if (!isarray && isobject && value && Object.keys(value).length && currentDepth < maxDepth) {\n ++currentDepth;\n return step({ ...value }, newKey);\n }\n\n output[newKey] = value;\n });\n }\n\n step(target, null);\n\n return output;\n}\n","import { createAction } from '@reduxjs/toolkit';\n\nimport { MetricAggregationWithMeta, MetricAggregation, MetricAggregationWithSettings } from '../../../../types';\n\nexport const addMetric = createAction<MetricAggregation['id']>('@metrics/add');\nexport const removeMetric = createAction<MetricAggregation['id']>('@metrics/remove');\nexport const toggleMetricVisibility = createAction<MetricAggregation['id']>('@metrics/toggle_visibility');\nexport const changeMetricField = createAction<{ id: MetricAggregation['id']; field: string }>('@metrics/change_field');\nexport const changeMetricType = createAction<{ id: MetricAggregation['id']; type: MetricAggregation['type'] }>(\n '@metrics/change_type'\n);\nexport const changeMetricAttribute = createAction<{ metric: MetricAggregation; attribute: string; newValue: unknown }>(\n '@metrics/change_attr'\n);\nexport const changeMetricSetting = createAction<{\n metric: MetricAggregationWithSettings;\n settingName: string;\n newValue: unknown;\n}>('@metrics/change_setting');\nexport const changeMetricMeta = createAction<{\n metric: MetricAggregationWithMeta;\n meta: string;\n newValue: unknown;\n}>('@metrics/change_meta');\n","import { Action, createAction } from '@reduxjs/toolkit';\n\nimport { ElasticsearchQuery } from '../../types';\n\n/**\n * When the `initQuery` Action is dispatched, the query gets populated with default values where values are not present.\n * This means it won't override any existing value in place, but just ensure the query is in a \"runnable\" state.\n */\nexport const initQuery = createAction('init');\n\nexport const changeQuery = createAction<ElasticsearchQuery['query']>('change_query');\n\nexport const changeAliasPattern = createAction<ElasticsearchQuery['alias']>('change_alias_pattern');\n\nexport const queryReducer = (prevQuery: ElasticsearchQuery['query'], action: Action) => {\n if (changeQuery.match(action)) {\n return action.payload;\n }\n\n if (initQuery.match(action)) {\n return prevQuery || '';\n }\n\n return prevQuery;\n};\n\nexport const aliasPatternReducer = (prevAliasPattern: ElasticsearchQuery['alias'], action: Action) => {\n if (changeAliasPattern.match(action)) {\n return action.payload;\n }\n\n if (initQuery.match(action)) {\n return prevAliasPattern || '';\n }\n\n return prevAliasPattern;\n};\n","import { Filter } from '../../../../../types';\n\nexport const defaultFilter = (): Filter => ({ label: '', query: '*' });\n","import { InternalTimeZones, SelectableValue } from '@grafana/data';\n\nimport { defaultGeoHashPrecisionString } from '../../../queryDef';\nimport { BucketsConfiguration } from '../../../types';\n\nimport { defaultFilter } from './SettingsEditor/FiltersSettingsEditor/utils';\n\nexport const bucketAggregationConfig: BucketsConfiguration = {\n terms: {\n label: 'Terms',\n requiresField: true,\n defaultSettings: {\n min_doc_count: '1',\n size: '10',\n order: 'desc',\n orderBy: '_term',\n },\n },\n filters: {\n label: 'Filters',\n requiresField: false,\n defaultSettings: {\n filters: [defaultFilter()],\n },\n },\n geohash_grid: {\n label: 'Geo Hash Grid',\n requiresField: true,\n defaultSettings: {\n precision: defaultGeoHashPrecisionString,\n },\n },\n date_histogram: {\n label: 'Date Histogram',\n requiresField: true,\n defaultSettings: {\n interval: 'auto',\n min_doc_count: '0',\n trimEdges: '0',\n timeZone: InternalTimeZones.utc,\n },\n },\n histogram: {\n label: 'Histogram',\n requiresField: true,\n defaultSettings: {\n interval: '1000',\n min_doc_count: '0',\n },\n },\n nested: {\n label: 'Nested (experimental)',\n requiresField: true,\n defaultSettings: {},\n },\n};\n\nexport const orderByOptions: Array<SelectableValue<string>> = [\n { label: 'Term value', value: '_term' },\n { label: 'Doc Count', value: '_count' },\n];\n\nexport const orderOptions: Array<SelectableValue<string>> = [\n { label: 'Top', value: 'desc' },\n { label: 'Bottom', value: 'asc' },\n];\n\nexport const sizeOptions = [\n { label: 'No limit', value: '0' },\n { label: '1', value: '1' },\n { label: '2', value: '2' },\n { label: '3', value: '3' },\n { label: '5', value: '5' },\n { label: '10', value: '10' },\n { label: '15', value: '15' },\n { label: '20', value: '20' },\n];\n","import { createAction } from '@reduxjs/toolkit';\n\nimport { BucketAggregation, BucketAggregationType, BucketAggregationWithField } from '../../../../types';\n\nexport const addBucketAggregation = createAction<BucketAggregation['id']>('@bucketAggs/add');\nexport const removeBucketAggregation = createAction<BucketAggregation['id']>('@bucketAggs/remove');\nexport const changeBucketAggregationType = createAction<{\n id: BucketAggregation['id'];\n newType: BucketAggregationType;\n}>('@bucketAggs/change_type');\nexport const changeBucketAggregationField = createAction<{\n id: BucketAggregation['id'];\n newField: BucketAggregationWithField['field'];\n}>('@bucketAggs/change_field');\nexport const changeBucketAggregationSetting = createAction<{\n bucketAgg: BucketAggregation;\n settingName: string;\n newValue: unknown;\n}>('@bucketAggs/change_setting');\n","import { Action } from '@reduxjs/toolkit';\n\nimport { defaultBucketAgg } from '../../../../queryDef';\nimport { ElasticsearchQuery, Terms, BucketAggregation } from '../../../../types';\nimport { removeEmpty } from '../../../../utils';\nimport { changeMetricType } from '../../MetricAggregationsEditor/state/actions';\nimport { metricAggregationConfig } from '../../MetricAggregationsEditor/utils';\nimport { initQuery } from '../../state';\nimport { bucketAggregationConfig } from '../utils';\n\nimport {\n addBucketAggregation,\n changeBucketAggregationField,\n changeBucketAggregationSetting,\n changeBucketAggregationType,\n removeBucketAggregation,\n} from './actions';\n\nexport const createReducer =\n (defaultTimeField: string) =>\n (state: ElasticsearchQuery['bucketAggs'], action: Action): ElasticsearchQuery['bucketAggs'] => {\n if (addBucketAggregation.match(action)) {\n const newAgg: Terms = {\n id: action.payload,\n type: 'terms',\n settings: bucketAggregationConfig['terms'].defaultSettings,\n };\n\n // If the last bucket aggregation is a `date_histogram` we add the new one before it.\n const lastAgg = state![state!.length - 1];\n if (lastAgg?.type === 'date_histogram') {\n return [...state!.slice(0, state!.length - 1), newAgg, lastAgg];\n }\n\n return [...state!, newAgg];\n }\n\n if (removeBucketAggregation.match(action)) {\n return state!.filter((bucketAgg) => bucketAgg.id !== action.payload);\n }\n\n if (changeBucketAggregationType.match(action)) {\n return state!.map((bucketAgg) => {\n if (bucketAgg.id !== action.payload.id) {\n return bucketAgg;\n }\n\n /*\n TODO: The previous version of the query editor was keeping some of the old bucket aggregation's configurations\n in the new selected one (such as field or some settings).\n It the future would be nice to have the same behavior but it's hard without a proper definition,\n as Elasticsearch will error sometimes if some settings are not compatible.\n */\n return {\n id: bucketAgg.id,\n type: action.payload.newType,\n settings: bucketAggregationConfig[action.payload.newType].defaultSettings,\n } as BucketAggregation;\n });\n }\n\n if (changeBucketAggregationField.match(action)) {\n return state!.map((bucketAgg) => {\n if (bucketAgg.id !== action.payload.id) {\n return bucketAgg;\n }\n\n return {\n ...bucketAgg,\n field: action.payload.newField,\n };\n });\n }\n\n if (changeMetricType.match(action)) {\n // If we are switching to a metric which requires the absence of bucket aggregations\n // we remove all of them.\n if (metricAggregationConfig[action.payload.type].impliedQueryType !== 'metrics') {\n return [];\n } else if (state!.length === 0) {\n // Else, if there are no bucket aggregations we restore a default one.\n // This happens when switching from a metric that requires the absence of bucket aggregations to\n // one that requires it.\n return [{ ...defaultBucketAgg('2'), field: defaultTimeField }];\n }\n return state;\n }\n\n if (changeBucketAggregationSetting.match(action)) {\n return state!.map((bucketAgg) => {\n if (bucketAgg.id !== action.payload.bucketAgg.id) {\n return bucketAgg;\n }\n\n const newSettings = removeEmpty({\n ...bucketAgg.settings,\n [action.payload.settingName]: action.payload.newValue,\n });\n\n return {\n ...bucketAgg,\n settings: {\n ...newSettings,\n },\n };\n });\n }\n\n if (initQuery.match(action)) {\n if (state && state.length > 0) {\n return state;\n }\n return [{ ...defaultBucketAgg('2'), field: defaultTimeField }];\n }\n\n return state;\n };\n","import { Action } from '@reduxjs/toolkit';\n\nimport { defaultMetricAgg } from '../../../../queryDef';\nimport { ElasticsearchQuery, MetricAggregation } from '../../../../types';\nimport { removeEmpty } from '../../../../utils';\nimport { initQuery } from '../../state';\nimport { isMetricAggregationWithMeta, isMetricAggregationWithSettings, isPipelineAggregation } from '../aggregations';\nimport { getChildren, metricAggregationConfig } from '../utils';\n\nimport {\n addMetric,\n changeMetricAttribute,\n changeMetricField,\n changeMetricMeta,\n changeMetricSetting,\n changeMetricType,\n removeMetric,\n toggleMetricVisibility,\n} from './actions';\n\nexport const reducer = (state: ElasticsearchQuery['metrics'], action: Action): ElasticsearchQuery['metrics'] => {\n if (addMetric.match(action)) {\n return [...state!, defaultMetricAgg(action.payload)];\n }\n\n if (removeMetric.match(action)) {\n const metricToRemove = state!.find((m) => m.id === action.payload)!;\n const metricsToRemove = [metricToRemove, ...getChildren(metricToRemove, state!)];\n const resultingMetrics = state!.filter((metric) => !metricsToRemove.some((toRemove) => toRemove.id === metric.id));\n if (resultingMetrics.length === 0) {\n return [defaultMetricAgg('1')];\n }\n return resultingMetrics;\n }\n\n if (changeMetricType.match(action)) {\n return state!\n .filter((metric) =>\n // When the new query type is not `metrics` we remove all other metrics from the query\n // leaving only the current one.\n metricAggregationConfig[action.payload.type].impliedQueryType === 'metrics'\n ? true\n : metric.id === action.payload.id\n )\n .map((metric) => {\n if (metric.id !== action.payload.id) {\n return metric;\n }\n\n /*\n TODO: The previous version of the query editor was keeping some of the old metric's configurations\n in the new selected one (such as field or some settings).\n It the future would be nice to have the same behavior but it's hard without a proper definition,\n as Elasticsearch will error sometimes if some settings are not compatible.\n */\n return {\n id: metric.id,\n type: action.payload.type,\n ...metricAggregationConfig[action.payload.type].defaults,\n } as MetricAggregation;\n });\n }\n\n if (changeMetricField.match(action)) {\n return state!.map((metric) => {\n if (metric.id !== action.payload.id) {\n return metric;\n }\n\n const newMetric = {\n ...metric,\n field: action.payload.field,\n };\n\n if (isPipelineAggregation(metric)) {\n return { ...newMetric, pipelineAgg: action.payload.field };\n }\n\n return newMetric;\n });\n }\n\n if (toggleMetricVisibility.match(action)) {\n return state!.map((metric) => {\n if (metric.id !== action.payload) {\n return metric;\n }\n\n return {\n ...metric,\n hide: !metric.hide,\n };\n });\n }\n\n if (changeMetricSetting.match(action)) {\n return state!.map((metric) => {\n if (metric.id !== action.payload.metric.id) {\n return metric;\n }\n\n // TODO: Here, instead of this if statement, we should assert that metric is MetricAggregationWithSettings\n if (isMetricAggregationWithSettings(metric)) {\n const newSettings = removeEmpty({\n ...metric.settings,\n [action.payload.settingName]: action.payload.newValue,\n });\n\n return {\n ...metric,\n settings: {\n ...newSettings,\n },\n };\n }\n\n // This should never happen.\n return metric;\n });\n }\n\n if (changeMetricMeta.match(action)) {\n return state!.map((metric) => {\n if (metric.id !== action.payload.metric.id) {\n return metric;\n }\n\n // TODO: Here, instead of this if statement, we should assert that metric is MetricAggregationWithMeta\n if (isMetricAggregationWithMeta(metric)) {\n return {\n ...metric,\n meta: {\n ...metric.meta,\n [action.payload.meta]: action.payload.newValue,\n },\n };\n }\n\n // This should never happen.\n return metric;\n });\n }\n\n if (changeMetricAttribute.match(action)) {\n return state!.map((metric) => {\n if (metric.id !== action.payload.metric.id) {\n return metric;\n }\n\n return {\n ...metric,\n [action.payload.attribute]: action.payload.newValue,\n };\n });\n }\n\n if (initQuery.match(action)) {\n if (state && state.length > 0) {\n return state;\n }\n return [defaultMetricAgg('1')];\n }\n\n return state;\n};\n","import React, { Context, createContext, PropsWithChildren, useCallback, useContext, useEffect, useState } from 'react';\n\nimport { TimeRange } from '@grafana/data';\n\nimport { ElasticDatasource } from '../../datasource';\nimport { combineReducers, useStatelessReducer, DispatchContext } from '../../hooks/useStatelessReducer';\nimport { ElasticsearchQuery } from '../../types';\n\nimport { createReducer as createBucketAggsReducer } from './BucketAggregationsEditor/state/reducer';\nimport { reducer as metricsReducer } from './MetricAggregationsEditor/state/reducer';\nimport { aliasPatternReducer, queryReducer, initQuery } from './state';\n\nconst DatasourceContext = createContext<ElasticDatasource | undefined>(undefined);\nconst QueryContext = createContext<ElasticsearchQuery | undefined>(undefined);\nconst RangeContext = createContext<TimeRange | undefined>(undefined);\n\ninterface Props {\n query: ElasticsearchQuery;\n onChange: (query: ElasticsearchQuery) => void;\n onRunQuery: () => void;\n datasource: ElasticDatasource;\n range: TimeRange;\n}\n\nexport const ElasticsearchProvider = ({\n children,\n onChange,\n onRunQuery,\n query,\n datasource,\n range,\n}: PropsWithChildren<Props>) => {\n const onStateChange = useCallback(\n (query: ElasticsearchQuery) => {\n onChange(query);\n onRunQuery();\n },\n [onChange, onRunQuery]\n );\n\n const reducer = combineReducers<Pick<ElasticsearchQuery, 'query' | 'alias' | 'metrics' | 'bucketAggs'>>({\n query: queryReducer,\n alias: aliasPatternReducer,\n metrics: metricsReducer,\n bucketAggs: createBucketAggsReducer(datasource.timeField),\n });\n\n const dispatch = useStatelessReducer(\n // timeField is part of the query model, but its value is always set to be the one from datasource settings.\n (newState) => onStateChange({ ...query, ...newState, timeField: datasource.timeField }),\n query,\n reducer\n );\n\n const isUninitialized = !query.metrics || !query.bucketAggs || query.query === undefined;\n\n const [shouldRunInit, setShouldRunInit] = useState(isUninitialized);\n\n // This initializes the query by dispatching an init action to each reducer.\n // useStatelessReducer will then call `onChange` with the newly generated query\n useEffect(() => {\n if (shouldRunInit && isUninitialized) {\n dispatch(initQuery());\n setShouldRunInit(false);\n }\n }, [shouldRunInit, dispatch, isUninitialized]);\n\n if (isUninitialized) {\n return null;\n }\n\n return (\n <DatasourceContext.Provider value={datasource}>\n <QueryContext.Provider value={query}>\n <RangeContext.Provider value={range}>\n <DispatchContext.Provider value={dispatch}>{children}</DispatchContext.Provider>\n </RangeContext.Provider>\n </QueryContext.Provider>\n </DatasourceContext.Provider>\n );\n};\n\ninterface GetHook {\n <T>(context: Context<T>): () => NonNullable<T>;\n}\n\nconst getHook: GetHook = (c) => () => {\n const contextValue = useContext(c);\n\n if (!contextValue) {\n throw new Error('use ElasticsearchProvider first.');\n }\n\n return contextValue;\n};\n\nexport const useQuery = getHook(QueryContext);\nexport const useDatasource = getHook(DatasourceContext);\nexport const useRange = getHook(RangeContext);\n","import { useMemo } from 'react';\n\nimport { useQuery } from '../components/QueryEditor/ElasticsearchQueryContext';\nimport { MetricAggregation, BucketAggregation } from '../types';\n\nconst toId = <T extends { id: unknown }>(e: T): T['id'] => e.id;\n\nconst toInt = (idString: string) => parseInt(idString, 10);\n\nexport const useNextId = (): MetricAggregation['id'] | BucketAggregation['id'] => {\n const { metrics, bucketAggs } = useQuery();\n\n return useMemo(\n () =>\n (Math.max(...[...(metrics?.map(toId) || ['0']), ...(bucketAggs?.map(toId) || ['0'])].map(toInt)) + 1).toString(),\n [metrics, bucketAggs]\n );\n};\n","import { css } from '@emotion/css';\nimport { noop } from 'lodash';\nimport React, { PropsWithChildren } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { IconButton, InlineFieldRow, InlineLabel, InlineSegmentGroup, useStyles2 } from '@grafana/ui';\n\ninterface Props {\n label: string;\n onRemoveClick?: false | (() => void);\n onHideClick?: false | (() => void);\n hidden?: boolean;\n}\n\nexport const QueryEditorRow = ({\n children,\n label,\n onRemoveClick,\n onHideClick,\n hidden = false,\n}: PropsWithChildren<Props>) => {\n const styles = useStyles2(getStyles);\n\n return (\n <InlineFieldRow>\n <InlineSegmentGroup>\n <InlineLabel width={17} as=\"div\">\n <span>{label}</span>\n <span className={styles.iconWrapper}>\n {onHideClick && (\n <IconButton\n name={hidden ? 'eye-slash' : 'eye'}\n onClick={onHideClick}\n size=\"sm\"\n aria-pressed={hidden}\n className={styles.icon}\n tooltip=\"Hide row\"\n />\n )}\n <IconButton\n name=\"trash-alt\"\n size=\"sm\"\n className={styles.icon}\n onClick={onRemoveClick || noop}\n disabled={!onRemoveClick}\n tooltip=\"Remove row\"\n />\n </span>\n </InlineLabel>\n </InlineSegmentGroup>\n {children}\n </InlineFieldRow>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n iconWrapper: css`\n display: flex;\n `,\n icon: css`\n color: ${theme.colors.text.secondary};\n margin-left: ${theme.spacing(0.25)};\n `,\n };\n};\n","import { BucketAggregationType, BucketAggregationWithField, BucketAggregation } from '../../../types';\n\nimport { bucketAggregationConfig } from './utils';\n\nexport const isBucketAggregationWithField = (\n bucketAgg: BucketAggregation | BucketAggregationWithField\n): bucketAgg is BucketAggregationWithField => bucketAggregationConfig[bucketAgg.type].requiresField;\n\nexport const BUCKET_AGGREGATION_TYPES: BucketAggregationType[] = [\n 'date_histogram',\n 'histogram',\n 'terms',\n 'filters',\n 'geohash_grid',\n 'nested',\n];\n\nexport const isBucketAggregationType = (s: BucketAggregationType | string): s is BucketAggregationType =>\n BUCKET_AGGREGATION_TYPES.includes(s as BucketAggregationType);\n","import { lastValueFrom } from 'rxjs';\n\nimport { MetricFindValue, SelectableValue } from '@grafana/data';\n\nimport { isBucketAggregationType } from '../components/QueryEditor/BucketAggregationsEditor/aggregations';\nimport { useDatasource, useRange } from '../components/QueryEditor/ElasticsearchQueryContext';\nimport { isMetricAggregationType } from '../components/QueryEditor/MetricAggregationsEditor/aggregations';\nimport { MetricAggregationType, BucketAggregationType } from '../types';\n\ntype AggregationType = BucketAggregationType | MetricAggregationType;\n\nconst getFilter = (type: AggregationType) => {\n if (isMetricAggregationType(type)) {\n switch (type) {\n case 'cardinality':\n return [];\n case 'top_metrics':\n // top_metrics was introduced in 7.7 where `metrics` only supported number:\n // https://www.elastic.co/guide/en/elasticsearch/reference/7.7/search-aggregations-metrics-top-metrics.html#_metrics\n // TODO: starting from 7.11 it supports ips and keywords as well:\n // https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-aggregations-metrics-top-metrics.html#_metrics\n return ['number'];\n default:\n return ['number'];\n }\n }\n\n if (isBucketAggregationType(type)) {\n switch (type) {\n case 'date_histogram':\n return ['date'];\n case 'geohash_grid':\n return ['geo_point'];\n case 'histogram':\n return ['number'];\n default:\n return [];\n }\n }\n\n return [];\n};\n\nconst toSelectableValue = ({ text }: MetricFindValue): SelectableValue<string> => ({\n label: text,\n value: text,\n});\n\n/**\n * Returns a function to query the configured datasource for autocomplete values for the specified aggregation type or data types.\n * Each aggregation can be run on different types, for example avg only operates on numeric fields, geohash_grid only on geo_point fields.\n * If an aggregation type is provided, the promise will resolve with all fields suitable to be used as a field for the given aggregation.\n * If an array of types is providem the promise will resolve with all the fields matching the provided types.\n * @param aggregationType the type of aggregation to get fields for\n */\nexport const useFields = (type: AggregationType | string[]) => {\n const datasource = useDatasource();\n const range = useRange();\n const filter = Array.isArray(type) ? type : getFilter(type);\n let rawFields: MetricFindValue[];\n\n return async (q?: string) => {\n // _mapping doesn't support filtering, we avoid sending a request everytime q changes\n if (!rawFields) {\n rawFields = await lastValueFrom(datasource.getFields(filter, range));\n }\n\n return rawFields.filter(({ text }) => q === undefined || text.includes(q)).map(toSelectableValue);\n };\n};\n","import { css } from '@emotion/css';\n\nexport const segmentStyles = css`\n min-width: 150px;\n`;\n","import { css, cx } from '@emotion/css';\nimport React, { PropsWithChildren, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Icon, InlineSegmentGroup, useTheme2 } from '@grafana/ui';\n\nimport { segmentStyles } from './styles';\n\nconst getStyles = (theme: GrafanaTheme2, hidden: boolean) => {\n return {\n wrapper: css`\n max-width: 500px;\n display: flex;\n flex-direction: column;\n `,\n settingsWrapper: css`\n padding-top: ${theme.spacing(0.5)};\n `,\n icon: css`\n margin-right: ${theme.spacing(0.5)};\n `,\n button: css`\n justify-content: start;\n ${hidden &&\n css`\n color: ${theme.colors.text.disabled};\n `}\n `,\n };\n};\n\ninterface Props {\n label: string;\n hidden?: boolean;\n}\n\nexport const SettingsEditorContainer = ({ label, children, hidden = false }: PropsWithChildren<Props>) => {\n const [open, setOpen] = useState(false);\n\n const theme = useTheme2();\n const styles = getStyles(theme, hidden);\n\n return (\n <InlineSegmentGroup>\n <div className={cx(styles.wrapper)}>\n <button\n className={cx('gf-form-label query-part', styles.button, segmentStyles)}\n onClick={() => setOpen(!open)}\n aria-expanded={open}\n type=\"button\"\n >\n <Icon name={open ? 'angle-down' : 'angle-right'} aria-hidden=\"true\" className={styles.icon} />\n {label}\n </button>\n\n {open && <div className={styles.settingsWrapper}>{children}</div>}\n </div>\n </InlineSegmentGroup>\n );\n};\n","import { InternalTimeZones } from '@grafana/data';\n\nimport {\n isMetricAggregationWithField,\n isMetricAggregationWithSettings,\n isMovingAverageWithModelSettings,\n isPipelineAggregation,\n isPipelineAggregationWithMultipleBucketPaths,\n} from './components/QueryEditor/MetricAggregationsEditor/aggregations';\nimport {\n defaultBucketAgg,\n defaultMetricAgg,\n findMetricById,\n highlightTags,\n defaultGeoHashPrecisionString,\n} from './queryDef';\nimport {\n ElasticsearchQuery,\n TermsQuery,\n Filters,\n Terms,\n MetricAggregation,\n MetricAggregationWithInlineScript,\n Histogram,\n DateHistogram,\n} from './types';\nimport { convertOrderByToMetricId, getScriptValue } from './utils';\n\n// Omitting 1m, 1h, 1d for now, as these cover the main use cases for calendar_interval\nexport const calendarIntervals: string[] = ['1w', '1M', '1q', '1y'];\n\nexport class ElasticQueryBuilder {\n timeField: string;\n\n constructor(options: { timeField: string }) {\n this.timeField = options.timeField;\n }\n\n getRangeFilter() {\n const filter = {\n [this.timeField]: {\n gte: '$timeFrom',\n lte: '$timeTo',\n format: 'epoch_millis',\n },\n };\n\n return filter;\n }\n\n buildTermsAgg(aggDef: Terms, queryNode: { terms?: any; aggs?: Record<string, unknown> }, target: ElasticsearchQuery) {\n queryNode.terms = { field: aggDef.field };\n\n if (!aggDef.settings) {\n return queryNode;\n }\n\n // TODO: This default should be somewhere else together with the one used in the UI\n const size = aggDef.settings?.size ? parseInt(aggDef.settings.size, 10) : 500;\n queryNode.terms.size = size === 0 ? 500 : size;\n\n if (aggDef.settings.orderBy !== void 0) {\n queryNode.terms.order = {};\n if (aggDef.settings.orderBy === '_term') {\n queryNode.terms.order['_key'] = aggDef.settings.order;\n } else {\n queryNode.terms.order[aggDef.settings.orderBy] = aggDef.settings.order;\n }\n\n // if metric ref, look it up and add it to this agg level\n const metricId = convertOrderByToMetricId(aggDef.settings.orderBy);\n if (metricId) {\n for (let metric of target.metrics || []) {\n if (metric.id === metricId) {\n if (metric.type === 'count') {\n queryNode.terms.order = { _count: aggDef.settings.order };\n } else if (isMetricAggregationWithField(metric)) {\n queryNode.aggs = {};\n queryNode.aggs[metric.id] = {\n [metric.type]: { field: metric.field },\n };\n }\n break;\n }\n }\n }\n }\n\n if (aggDef.settings.min_doc_count !== void 0) {\n queryNode.terms.min_doc_count = parseInt(aggDef.settings.min_doc_count, 10);\n\n if (isNaN(queryNode.terms.min_doc_count)) {\n queryNode.terms.min_doc_count = aggDef.settings.min_doc_count;\n }\n }\n\n if (aggDef.settings.missing) {\n queryNode.terms.missing = aggDef.settings.missing;\n }\n\n return queryNode;\n }\n\n getDateHistogramAgg(aggDef: DateHistogram) {\n const esAgg: Record<string, unknown> = {};\n const settings = aggDef.settings || {};\n\n esAgg.field = aggDef.field || this.timeField;\n esAgg.min_doc_count = settings.min_doc_count || 0;\n esAgg.extended_bounds = { min: '$timeFrom', max: '$timeTo' };\n esAgg.format = 'epoch_millis';\n if (settings.timeZone && settings.timeZone !== InternalTimeZones.utc) {\n esAgg.time_zone = settings.timeZone;\n }\n\n if (settings.offset !== '') {\n esAgg.offset = settings.offset;\n }\n\n const interval = settings.interval === 'auto' ? '${__interval_ms}ms' : settings.interval;\n\n if (interval !== undefined && calendarIntervals.includes(interval)) {\n esAgg.calendar_interval = interval;\n } else {\n esAgg.fixed_interval = interval;\n }\n\n return esAgg;\n }\n\n getHistogramAgg(aggDef: Histogram) {\n const esAgg = {\n interval: aggDef.settings?.interval,\n field: aggDef.field,\n min_doc_count: aggDef.settings?.min_doc_count || 0,\n };\n\n return esAgg;\n }\n\n getFiltersAgg(aggDef: Filters) {\n const filterObj: Record<string, { query_string: { query: string; analyze_wildcard: boolean } }> = {};\n\n for (let { query, label } of aggDef.settings?.filters || []) {\n filterObj[label || query] = {\n query_string: {\n query: query,\n analyze_wildcard: true,\n },\n };\n }\n\n return filterObj;\n }\n\n documentQuery(query: any, size: number) {\n query.size = size;\n query.sort = [\n {\n [this.timeField]: { order: 'desc', unmapped_type: 'boolean' },\n },\n {\n _doc: { order: 'desc' },\n },\n ];\n\n query.script_fields = {};\n return query;\n }\n\n build(target: ElasticsearchQuery) {\n // make sure query has defaults;\n target.metrics = target.metrics || [defaultMetricAgg()];\n target.bucketAggs = target.bucketAggs || [defaultBucketAgg()];\n target.timeField = this.timeField;\n let metric: MetricAggregation;\n\n let i, j, pv, nestedAggs;\n const query: any = {\n size: 0,\n query: {\n bool: {\n filter: [{ range: this.getRangeFilter() }],\n },\n },\n };\n\n if (target.query && target.query !== '') {\n query.query.bool.filter = [\n ...query.query.bool.filter,\n {\n query_string: {\n analyze_wildcard: true,\n query: target.query,\n },\n },\n ];\n }\n\n // If target doesn't have bucketAggs and type is not raw_document, it is invalid query.\n if (target.bucketAggs.length === 0) {\n metric = target.metrics[0];\n\n if (!metric || !(metric.type === 'raw_document' || metric.type === 'raw_data')) {\n throw { message: 'Invalid query' };\n }\n }\n\n /* Handle document query:\n * Check if metric type is raw_document. If metric doesn't have size (or size is 0), update size to 500.\n * Otherwise it will not be a valid query and error will be thrown.\n */\n if (target.metrics?.[0]?.type === 'raw_document' || target.metrics?.[0]?.type === 'raw_data') {\n metric = target.metrics[0];\n\n // TODO: This default should be somewhere else together with the one used in the UI\n const size = metric.settings?.size ? parseInt(metric.settings.size, 10) : 500;\n\n return this.documentQuery(query, size || 500);\n }\n\n nestedAggs = query;\n\n for (i = 0; i < target.bucketAggs.length; i++) {\n const aggDef = target.bucketAggs[i];\n const esAgg: any = {};\n\n switch (aggDef.type) {\n case 'date_histogram': {\n esAgg['date_histogram'] = this.getDateHistogramAgg(aggDef);\n break;\n }\n case 'histogram': {\n esAgg['histogram'] = this.getHistogramAgg(aggDef);\n break;\n }\n case 'filters': {\n esAgg['filters'] = { filters: this.getFiltersAgg(aggDef) };\n break;\n }\n case 'terms': {\n this.buildTermsAgg(aggDef, esAgg, target);\n break;\n }\n case 'geohash_grid': {\n esAgg['geohash_grid'] = {\n field: aggDef.field,\n precision: aggDef.settings?.precision || defaultGeoHashPrecisionString,\n };\n break;\n }\n case 'nested': {\n esAgg['nested'] = { path: aggDef.field };\n break;\n }\n }\n\n nestedAggs.aggs = nestedAggs.aggs || {};\n nestedAggs.aggs[aggDef.id] = esAgg;\n nestedAggs = esAgg;\n }\n\n nestedAggs.aggs = {};\n\n for (i = 0; i < target.metrics.length; i++) {\n metric = target.metrics[i];\n if (metric.type === 'count') {\n continue;\n }\n\n const aggField: any = {};\n let metricAgg: any = {};\n\n if (isPipelineAggregation(metric)) {\n if (isPipelineAggregationWithMultipleBucketPaths(metric)) {\n if (metric.pipelineVariables) {\n metricAgg = {\n buckets_path: {},\n };\n\n for (j = 0; j < metric.pipelineVariables.length; j++) {\n pv = metric.pipelineVariables[j];\n\n if (pv.name && pv.pipelineAgg && /^\\d*$/.test(pv.pipelineAgg)) {\n const appliedAgg = findMetricById(target.metrics, pv.pipelineAgg);\n if (appliedAgg) {\n if (appliedAgg.type === 'count') {\n metricAgg.buckets_path[pv.name] = '_count';\n } else {\n metricAgg.buckets_path[pv.name] = pv.pipelineAgg;\n }\n }\n }\n }\n } else {\n continue;\n }\n } else {\n if (metric.field && /^\\d*$/.test(metric.field)) {\n const appliedAgg = findMetricById(target.metrics, metric.field);\n if (appliedAgg) {\n if (appliedAgg.type === 'count') {\n metricAgg = { buckets_path: '_count' };\n } else {\n metricAgg = { buckets_path: metric.field };\n }\n }\n } else {\n continue;\n }\n }\n } else if (isMetricAggregationWithField(metric)) {\n metricAgg = { field: metric.field };\n }\n\n if (isMetricAggregationWithSettings(metric)) {\n Object.entries(metric.settings || {})\n .filter(([_, v]) => v !== null)\n .forEach(([k, v]) => {\n metricAgg[k] =\n k === 'script' ? this.buildScript(getScriptValue(metric as MetricAggregationWithInlineScript)) : v;\n });\n\n // Elasticsearch isn't generally too picky about the data types in the request body,\n // however some fields are required to be numeric.\n // Users might have already created some of those with before, where the values were numbers.\n switch (metric.type) {\n case 'moving_avg':\n metricAgg = {\n ...metricAgg,\n ...(metricAgg?.window !== undefined && { window: this.toNumber(metricAgg.window) }),\n ...(metricAgg?.predict !== undefined && { predict: this.toNumber(metricAgg.predict) }),\n ...(isMovingAverageWithModelSettings(metric) && {\n settings: {\n ...metricAgg.settings,\n ...Object.fromEntries(\n Object.entries(metricAgg.settings || {})\n // Only format properties that are required to be numbers\n .filter(([settingName]) => ['alpha', 'beta', 'gamma', 'period'].includes(settingName))\n // omitting undefined\n .filter(([_, stringValue]) => stringValue !== undefined)\n .map(([_, stringValue]) => [_, this.toNumber(stringValue)])\n ),\n },\n }),\n };\n break;\n\n case 'serial_diff':\n metricAgg = {\n ...metricAgg,\n ...(metricAgg.lag !== undefined && {\n lag: this.toNumber(metricAgg.lag),\n }),\n };\n break;\n\n case 'top_metrics':\n metricAgg = {\n metrics: metric.settings?.metrics?.map((field) => ({ field })),\n size: 1,\n };\n\n if (metric.settings?.orderBy) {\n metricAgg.sort = [{ [metric.settings?.orderBy]: metric.settings?.order }];\n }\n break;\n }\n }\n\n aggField[metric.type] = metricAgg;\n nestedAggs.aggs[metric.id] = aggField;\n }\n\n return query;\n }\n\n private buildScript(script: string) {\n return script;\n }\n\n private toNumber(stringValue: unknown): unknown | number {\n const parsedValue = parseFloat(`${stringValue}`);\n if (isNaN(parsedValue)) {\n return stringValue;\n }\n\n return parsedValue;\n }\n\n getTermsQuery(queryDef: TermsQuery) {\n const query: any = {\n size: 0,\n query: {\n bool: {\n filter: [{ range: this.getRangeFilter() }],\n },\n },\n };\n\n if (queryDef.query) {\n query.query.bool.filter.push({\n query_string: {\n analyze_wildcard: true,\n query: queryDef.query,\n },\n });\n }\n\n let size = 500;\n if (queryDef.size) {\n size = queryDef.size;\n }\n\n query.aggs = {\n '1': {\n terms: {\n field: queryDef.field,\n size: size,\n order: {},\n },\n },\n };\n\n // Default behaviour is to order results by { _key: asc }\n // queryDef.order allows selection of asc/desc\n // queryDef.orderBy allows selection of doc_count ordering (defaults desc)\n\n const { orderBy = 'key', order = orderBy === 'doc_count' ? 'desc' : 'asc' } = queryDef;\n\n if (['asc', 'desc'].indexOf(order) < 0) {\n throw { message: `Invalid query sort order ${order}` };\n }\n\n switch (orderBy) {\n case 'key':\n case 'term':\n const keyname = '_key';\n query.aggs['1'].terms.order[keyname] = order;\n break;\n case 'doc_count':\n query.aggs['1'].terms.order['_count'] = order;\n break;\n default:\n throw { message: `Invalid query sort type ${orderBy}` };\n }\n\n return query;\n }\n\n getLogsQuery(target: ElasticsearchQuery, limit: number) {\n let query: any = {\n size: 0,\n query: {\n bool: {\n filter: [{ range: this.getRangeFilter() }],\n },\n },\n };\n\n if (target.query) {\n query.query.bool.filter.push({\n query_string: {\n analyze_wildcard: true,\n query: target.query,\n },\n });\n }\n\n query = this.documentQuery(query, limit);\n\n return {\n ...query,\n aggs: this.build(target).aggs,\n highlight: {\n fields: {\n '*': {},\n },\n pre_tags: [highlightTags.pre],\n post_tags: [highlightTags.post],\n fragment_size: 2147483647,\n },\n };\n }\n}\n","import { useState } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\n\nconst hasValue =\n <T extends SelectableValue>(searchValue: T['value']) =>\n ({ value }: T) =>\n value === searchValue;\n\nconst getInitialState = (initialOptions: SelectableValue[], initialValue?: string): SelectableValue[] => {\n if (initialValue === undefined || initialOptions.some(hasValue(initialValue))) {\n return initialOptions;\n }\n\n return [\n ...initialOptions,\n {\n value: initialValue,\n label: initialValue,\n },\n ];\n};\n\ninterface Params {\n options: SelectableValue[];\n value?: string;\n onChange: (s: SelectableValue<string>) => void;\n}\n\n/**\n * Creates the Props needed by Select to handle custom values and handles custom value creation\n * and the initial value when it is not present in the option array.\n */\nexport const useCreatableSelectPersistedBehaviour = ({ options: initialOptions, value, onChange }: Params) => {\n const [options, setOptions] = useState(getInitialState(initialOptions, value));\n\n const addOption = (newValue: string) => setOptions([...options, { value: newValue, label: newValue }]);\n\n return {\n onCreateOption: (value: string) => {\n addOption(value);\n onChange({ value });\n },\n onChange,\n allowCustomValue: true,\n options,\n value,\n };\n};\n","import { uniqueId } from 'lodash';\nimport React, { useCallback, useRef } from 'react';\nimport { GroupBase, OptionsOrGroups } from 'react-select';\n\nimport { InternalTimeZones, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select, TimeZonePicker } from '@grafana/ui';\n\nimport { calendarIntervals } from '../../../../QueryBuilder';\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { DateHistogram } from '../../../../types';\nimport { useCreatableSelectPersistedBehaviour } from '../../../hooks/useCreatableSelectPersistedBehaviour';\nimport { changeBucketAggregationSetting } from '../state/actions';\nimport { bucketAggregationConfig } from '../utils';\n\nimport { inlineFieldProps } from '.';\n\nconst defaultIntervalOptions: Array<SelectableValue<string>> = [\n { label: 'auto', value: 'auto' },\n { label: '10s', value: '10s' },\n { label: '1m', value: '1m' },\n { label: '5m', value: '5m' },\n { label: '10m', value: '10m' },\n { label: '20m', value: '20m' },\n { label: '1h', value: '1h' },\n { label: '1d', value: '1d' },\n { label: '1w', value: '1w' },\n { label: '1M', value: '1M' },\n { label: '1q', value: '1q' },\n { label: '1y', value: '1y' },\n];\n\nconst hasValue =\n (searchValue: string) =>\n ({ value }: SelectableValue<string>) =>\n value === searchValue;\n\nconst isValidNewOption = (\n inputValue: string,\n _: SelectableValue<string> | null,\n options: OptionsOrGroups<unknown, GroupBase<unknown>>\n) => {\n // TODO: would be extremely nice here to allow only template variables and values that are\n // valid date histogram's Interval options\n const valueExists = (options as Array<SelectableValue<string>>).some(hasValue(inputValue));\n // we also don't want users to create \"empty\" values\n return !valueExists && inputValue.trim().length > 0;\n};\n\nconst optionStartsWithValue = (option: SelectableValue<string>, value: string) =>\n option.value?.startsWith(value) || false;\n\ninterface Props {\n bucketAgg: DateHistogram;\n}\n\nconst getIntervalType = (interval: string | undefined): 'calendar' | 'fixed' => {\n return interval && calendarIntervals.includes(interval) ? 'calendar' : 'fixed';\n};\n\nexport const DateHistogramSettingsEditor = ({ bucketAgg }: Props) => {\n const dispatch = useDispatch();\n const { current: baseId } = useRef(uniqueId('es-date_histogram-'));\n\n const handleIntervalChange = useCallback(\n ({ value }: SelectableValue<string>) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'interval', newValue: value })),\n [bucketAgg, dispatch]\n );\n\n const intervalType = getIntervalType(\n bucketAgg.settings?.interval || bucketAggregationConfig.date_histogram.defaultSettings?.interval\n );\n\n return (\n <>\n <InlineField\n label={intervalType === 'calendar' ? 'Calendar interval' : 'Fixed interval'}\n tooltip={\n intervalType === 'calendar'\n ? 'Calendar-aware intervals adapt to varying day lengths, month durations, and leap seconds, considering the calendar context.'\n : 'Fixed intervals remain constant, always being multiples of SI units, independent of calendar changes.'\n }\n {...inlineFieldProps}\n >\n <Select\n inputId={uniqueId('es-date_histogram-interval')}\n isValidNewOption={isValidNewOption}\n filterOption={optionStartsWithValue}\n {...useCreatableSelectPersistedBehaviour({\n options: defaultIntervalOptions,\n value: bucketAgg.settings?.interval || bucketAggregationConfig.date_histogram.defaultSettings?.interval,\n onChange: handleIntervalChange,\n })}\n />\n </InlineField>\n <InlineField label=\"Min Doc Count\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-min_doc_count`}\n onBlur={(e) =>\n dispatch(\n changeBucketAggregationSetting({ bucketAgg, settingName: 'min_doc_count', newValue: e.target.value })\n )\n }\n defaultValue={\n bucketAgg.settings?.min_doc_count || bucketAggregationConfig.date_histogram.defaultSettings?.min_doc_count\n }\n />\n </InlineField>\n\n <InlineField label=\"Trim Edges\" {...inlineFieldProps} tooltip=\"Trim the edges on the timeseries datapoints\">\n <Input\n id={`${baseId}-trime_edges`}\n onBlur={(e) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'trimEdges', newValue: e.target.value }))\n }\n defaultValue={\n bucketAgg.settings?.trimEdges || bucketAggregationConfig.date_histogram.defaultSettings?.trimEdges\n }\n />\n </InlineField>\n\n <InlineField\n label=\"Offset\"\n {...inlineFieldProps}\n tooltip=\"Change the start value of each bucket by the specified positive (+) or negative offset (-) duration, such as 1h for an hour, or 1d for a day\"\n >\n <Input\n id={`${baseId}-offset`}\n onBlur={(e) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'offset', newValue: e.target.value }))\n }\n defaultValue={bucketAgg.settings?.offset || bucketAggregationConfig.date_histogram.defaultSettings?.offset}\n />\n </InlineField>\n\n <InlineField label=\"Timezone\" {...inlineFieldProps}>\n <TimeZonePicker\n value={bucketAgg.settings?.timeZone || bucketAggregationConfig.date_histogram.defaultSettings?.timeZone}\n includeInternal={[InternalTimeZones.utc]}\n onChange={(timeZone) => {\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'timeZone', newValue: timeZone }));\n }}\n />\n </InlineField>\n </>\n );\n};\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { Button } from '@grafana/ui';\n\ninterface Props {\n index: number;\n elements: unknown[];\n onAdd: () => void;\n onRemove: () => void;\n}\n\n/**\n * A component used to show add & remove buttons for mutable lists of values. Wether to show or not the add or the remove buttons\n * depends on the `index` and `elements` props. This enforces a consistent experience whenever this pattern is used.\n */\nexport const AddRemove = ({ index, onAdd, onRemove, elements }: Props) => {\n return (\n <div\n className={css`\n display: flex;\n `}\n >\n {index === 0 && (\n <Button variant=\"secondary\" fill=\"text\" icon=\"plus\" onClick={onAdd} tooltip=\"Add\" aria-label=\"Add\" />\n )}\n\n {elements.length >= 2 && (\n <Button variant=\"secondary\" fill=\"text\" icon=\"minus\" onClick={onRemove} tooltip=\"Remove\" aria-label=\"Remove\" />\n )}\n </div>\n );\n};\n","import { createAction } from '@reduxjs/toolkit';\n\nimport { Filter } from '../../../../../../types';\n\nexport const addFilter = createAction('@bucketAggregations/filter/add');\nexport const removeFilter = createAction<number>('@bucketAggregations/filter/remove');\nexport const changeFilter = createAction<{ index: number; filter: Filter }>('@bucketAggregations/filter/change');\n","import { Action } from 'redux';\n\nimport { Filter } from '../../../../../../types';\nimport { defaultFilter } from '../utils';\n\nimport { addFilter, changeFilter, removeFilter } from './actions';\n\nexport const reducer = (state: Filter[] = [], action: Action) => {\n if (addFilter.match(action)) {\n return [...state, defaultFilter()];\n }\n\n if (removeFilter.match(action)) {\n return state.slice(0, action.payload).concat(state.slice(action.payload + 1));\n }\n\n if (changeFilter.match(action)) {\n return state.map((filter, index) => {\n if (index !== action.payload.index) {\n return filter;\n }\n\n return action.payload.filter;\n });\n }\n\n return state;\n};\n","import { css } from '@emotion/css';\nimport { uniqueId } from 'lodash';\nimport React, { useEffect, useRef } from 'react';\n\nimport { InlineField, Input, QueryField } from '@grafana/ui';\n\nimport { useDispatch, useStatelessReducer } from '../../../../../hooks/useStatelessReducer';\nimport { Filters } from '../../../../../types';\nimport { AddRemove } from '../../../../AddRemove';\nimport { changeBucketAggregationSetting } from '../../state/actions';\n\nimport { addFilter, changeFilter, removeFilter } from './state/actions';\nimport { reducer as filtersReducer } from './state/reducer';\n\ninterface Props {\n bucketAgg: Filters;\n}\n\nexport const FiltersSettingsEditor = ({ bucketAgg }: Props) => {\n const { current: baseId } = useRef(uniqueId('es-filters-'));\n\n const upperStateDispatch = useDispatch();\n\n const dispatch = useStatelessReducer(\n (newValue) => upperStateDispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'filters', newValue })),\n bucketAgg.settings?.filters,\n filtersReducer\n );\n\n // The model might not have filters (or an empty array of filters) in it because of the way it was built in previous versions of the datasource.\n // If this is the case we add a default one.\n useEffect(() => {\n if (!bucketAgg.settings?.filters?.length) {\n dispatch(addFilter());\n }\n }, [dispatch, bucketAgg.settings?.filters?.length]);\n\n return (\n <>\n <div\n className={css`\n display: flex;\n flex-direction: column;\n `}\n >\n {bucketAgg.settings?.filters!.map((filter, index) => (\n <div\n key={index}\n className={css`\n display: flex;\n `}\n >\n <InlineField label=\"Query\" labelWidth={8}>\n <div\n className={css`\n width: 150px;\n `}\n >\n <QueryField\n placeholder=\"Lucene Query\"\n portalOrigin=\"elasticsearch\"\n onChange={(query) => dispatch(changeFilter({ index, filter: { ...filter, query } }))}\n query={filter.query}\n />\n </div>\n </InlineField>\n <InlineField label=\"Label\" labelWidth={8}>\n <Input\n width={16}\n id={`${baseId}-label-${index}`}\n placeholder=\"Label\"\n onBlur={(e) => dispatch(changeFilter({ index, filter: { ...filter, label: e.target.value } }))}\n defaultValue={filter.label}\n />\n </InlineField>\n <AddRemove\n index={index}\n elements={bucketAgg.settings?.filters || []}\n onAdd={() => dispatch(addFilter())}\n onRemove={() => dispatch(removeFilter(index))}\n />\n </div>\n ))}\n </div>\n </>\n );\n};\n","import { uniqueId } from 'lodash';\nimport React, { useRef } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { InlineField, Select, Input } from '@grafana/ui';\n\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { MetricAggregation, Percentiles, ExtendedStatMetaType, ExtendedStats, Terms } from '../../../../types';\nimport { describeMetric } from '../../../../utils';\nimport { useCreatableSelectPersistedBehaviour } from '../../../hooks/useCreatableSelectPersistedBehaviour';\nimport { useQuery } from '../../ElasticsearchQueryContext';\nimport { isPipelineAggregation } from '../../MetricAggregationsEditor/aggregations';\nimport { changeBucketAggregationSetting } from '../state/actions';\nimport { bucketAggregationConfig, orderByOptions, orderOptions, sizeOptions } from '../utils';\n\nimport { inlineFieldProps } from '.';\n\ninterface Props {\n bucketAgg: Terms;\n}\n\nexport const TermsSettingsEditor = ({ bucketAgg }: Props) => {\n const { metrics } = useQuery();\n const orderBy = createOrderByOptions(metrics);\n const { current: baseId } = useRef(uniqueId('es-terms-'));\n\n const dispatch = useDispatch();\n\n return (\n <>\n <InlineField label=\"Order\" {...inlineFieldProps}>\n <Select\n inputId={`${baseId}-order`}\n onChange={(e) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'order', newValue: e.value }))\n }\n options={orderOptions}\n value={bucketAgg.settings?.order || bucketAggregationConfig.terms.defaultSettings?.order}\n />\n </InlineField>\n\n <InlineField label=\"Size\" {...inlineFieldProps}>\n <Select\n inputId={`${baseId}-size`}\n // TODO: isValidNewOption should only allow numbers & template variables\n {...useCreatableSelectPersistedBehaviour({\n options: sizeOptions,\n value: bucketAgg.settings?.size || bucketAggregationConfig.terms.defaultSettings?.size,\n onChange({ value }) {\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'size', newValue: value }));\n },\n })}\n />\n </InlineField>\n\n <InlineField label=\"Min Doc Count\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-min_doc_count`}\n onBlur={(e) =>\n dispatch(\n changeBucketAggregationSetting({ bucketAgg, settingName: 'min_doc_count', newValue: e.target.value })\n )\n }\n defaultValue={\n bucketAgg.settings?.min_doc_count || bucketAggregationConfig.terms.defaultSettings?.min_doc_count\n }\n />\n </InlineField>\n\n <InlineField label=\"Order By\" {...inlineFieldProps}>\n <Select\n inputId={`${baseId}-order_by`}\n onChange={(e) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'orderBy', newValue: e.value }))\n }\n options={orderBy}\n value={bucketAgg.settings?.orderBy || bucketAggregationConfig.terms.defaultSettings?.orderBy}\n />\n </InlineField>\n\n <InlineField label=\"Missing\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-missing`}\n onBlur={(e) =>\n dispatch(changeBucketAggregationSetting({ bucketAgg, settingName: 'missing', newValue: e.target.value }))\n }\n defaultValue={bucketAgg.settings?.missing || bucketAggregationConfig.terms.defaultSettings?.missing}\n />\n </InlineField>\n </>\n );\n};\n\n/**\n * This returns the valid options for each of the enabled extended stat\n */\nfunction createOrderByOptionsForExtendedStats(metric: ExtendedStats): SelectableValue<string> {\n if (!metric.meta) {\n return [];\n }\n const metaKeys = Object.keys(metric.meta) as ExtendedStatMetaType[];\n return metaKeys\n .filter((key) => metric.meta?.[key])\n .map((key) => {\n let method: string = key;\n // The bucket path for std_deviation_bounds.lower and std_deviation_bounds.upper\n // is accessed via std_lower and std_upper, respectively.\n if (key === 'std_deviation_bounds_lower') {\n method = 'std_lower';\n }\n if (key === 'std_deviation_bounds_upper') {\n method = 'std_upper';\n }\n return { label: `${describeMetric(metric)} (${method})`, value: `${metric.id}[${method}]` };\n });\n}\n\n/**\n * This returns the valid options for each of the percents listed in the percentile settings\n */\nfunction createOrderByOptionsForPercentiles(metric: Percentiles): Array<SelectableValue<string>> {\n if (!metric.settings?.percents) {\n return [];\n }\n return metric.settings.percents.map((percent) => {\n // The bucket path for percentile numbers is appended with a `.0` if the number is whole\n // otherwise you have to use the actual value.\n const percentString = /^\\d+\\.\\d+/.test(`${percent}`) ? percent : `${percent}.0`;\n return { label: `${describeMetric(metric)} (${percent})`, value: `${metric.id}[${percentString}]` };\n });\n}\n\nfunction isValidOrderTarget(metric: MetricAggregation) {\n return (\n // top metrics can't be used for ordering\n metric.type !== 'top_metrics' &&\n // pipeline aggregations can't be used for ordering: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-order\n !isPipelineAggregation(metric)\n );\n}\n\n/**\n * This creates all the valid order by options based on the metrics\n */\nexport const createOrderByOptions = (metrics: MetricAggregation[] = []): Array<SelectableValue<string>> => {\n const metricOptions = metrics.filter(isValidOrderTarget).flatMap((metric) => {\n if (metric.type === 'extended_stats') {\n return createOrderByOptionsForExtendedStats(metric);\n } else if (metric.type === 'percentiles') {\n return createOrderByOptionsForPercentiles(metric);\n } else {\n return { label: describeMetric(metric), value: metric.id };\n }\n });\n return [...orderByOptions, ...metricOptions];\n};\n","import { defaultGeoHashPrecisionString } from '../../../../queryDef';\nimport { BucketAggregation } from '../../../../types';\nimport { describeMetric, convertOrderByToMetricId } from '../../../../utils';\nimport { useQuery } from '../../ElasticsearchQueryContext';\nimport { bucketAggregationConfig, orderByOptions, orderOptions } from '../utils';\n\nconst hasValue = (value: string) => (object: { value?: string }) => object.value === value;\n\n// FIXME: We should apply the same defaults we have in bucketAggregationsConfig here instead of \"custom\" values\n// as they might get out of sync.\n// The reason we need them is that even though after the refactoring each setting is created with its default value,\n// queries created with the old version might not have them.\nexport const useDescription = (bucketAgg: BucketAggregation): string => {\n const { metrics } = useQuery();\n\n switch (bucketAgg.type) {\n case 'terms': {\n const order = bucketAgg.settings?.order || 'desc';\n const size = bucketAgg.settings?.size || '10';\n const minDocCount = parseInt(bucketAgg.settings?.min_doc_count || '0', 10);\n const orderBy = bucketAgg.settings?.orderBy || '_term';\n let description = '';\n\n if (size !== '0') {\n const orderLabel = orderOptions.find(hasValue(order))?.label!;\n description = `${orderLabel} ${size}, `;\n }\n\n if (minDocCount > 0) {\n description += `Min Doc Count: ${minDocCount}, `;\n }\n\n description += 'Order by: ';\n const orderByOption = orderByOptions.find(hasValue(orderBy));\n if (orderByOption) {\n description += orderByOption.label;\n } else {\n const metric = metrics?.find((m) => m.id === convertOrderByToMetricId(orderBy));\n if (metric) {\n description += describeMetric(metric);\n } else {\n description += 'metric not found';\n }\n }\n\n if (size === '0') {\n description += ` (${order})`;\n }\n return description;\n }\n\n case 'histogram': {\n const interval = bucketAgg.settings?.interval || '1000';\n const minDocCount = parseInt(bucketAgg.settings?.min_doc_count || '1', 10);\n\n return `Interval: ${interval}${minDocCount > 0 ? `, Min Doc Count: ${minDocCount}` : ''}`;\n }\n\n case 'filters': {\n const filters = bucketAgg.settings?.filters || bucketAggregationConfig['filters'].defaultSettings?.filters;\n return `Filter Queries (${filters!.length})`;\n }\n\n case 'geohash_grid': {\n const precision = parseInt(bucketAgg.settings?.precision || defaultGeoHashPrecisionString, 10);\n\n return `Precision: ${precision}`;\n }\n\n case 'date_histogram': {\n const interval = bucketAgg.settings?.interval || 'auto';\n const minDocCount = parseInt(bucketAgg.settings?.min_doc_count || '0', 10);\n const trimEdges = parseInt(bucketAgg.settings?.trimEdges || '0', 10);\n\n let description = `Interval: ${interval}`;\n\n if (minDocCount > 0) {\n description += `, Min Doc Count: ${minDocCount}`;\n }\n\n if (trimEdges > 0) {\n description += `, Trim edges: ${trimEdges}`;\n }\n\n return description;\n }\n\n default:\n return 'Settings';\n }\n};\n","import { uniqueId } from 'lodash';\nimport React, { ComponentProps, useRef } from 'react';\n\nimport { InlineField, Input } from '@grafana/ui';\n\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { BucketAggregation } from '../../../../types';\nimport { SettingsEditorContainer } from '../../SettingsEditorContainer';\nimport { changeBucketAggregationSetting } from '../state/actions';\nimport { bucketAggregationConfig } from '../utils';\n\nimport { DateHistogramSettingsEditor } from './DateHistogramSettingsEditor';\nimport { FiltersSettingsEditor } from './FiltersSettingsEditor';\nimport { TermsSettingsEditor } from './TermsSettingsEditor';\nimport { useDescription } from './useDescription';\n\nexport const inlineFieldProps: Partial<ComponentProps<typeof InlineField>> = {\n labelWidth: 18,\n};\n\ninterface Props {\n bucketAgg: BucketAggregation;\n}\n\nexport const SettingsEditor = ({ bucketAgg }: Props) => {\n const { current: baseId } = useRef(uniqueId('es-setting-'));\n\n const dispatch = useDispatch();\n\n const settingsDescription = useDescription(bucketAgg);\n\n return (\n <SettingsEditorContainer label={settingsDescription}>\n {bucketAgg.type === 'terms' && <TermsSettingsEditor bucketAgg={bucketAgg} />}\n {bucketAgg.type === 'date_histogram' && <DateHistogramSettingsEditor bucketAgg={bucketAgg} />}\n {bucketAgg.type === 'filters' && <FiltersSettingsEditor bucketAgg={bucketAgg} />}\n\n {bucketAgg.type === 'geohash_grid' && (\n <InlineField label=\"Precision\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-geohash_grid-precision`}\n onBlur={(e) =>\n dispatch(\n changeBucketAggregationSetting({ bucketAgg, settingName: 'precision', newValue: e.target.value })\n )\n }\n defaultValue={\n bucketAgg.settings?.precision || bucketAggregationConfig[bucketAgg.type].defaultSettings?.precision\n }\n />\n </InlineField>\n )}\n\n {bucketAgg.type === 'histogram' && (\n <>\n <InlineField label=\"Interval\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-histogram-interval`}\n onBlur={(e) =>\n dispatch(\n changeBucketAggregationSetting({ bucketAgg, settingName: 'interval', newValue: e.target.value })\n )\n }\n defaultValue={\n bucketAgg.settings?.interval || bucketAggregationConfig[bucketAgg.type].defaultSettings?.interval\n }\n />\n </InlineField>\n\n <InlineField label=\"Min Doc Count\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-histogram-min_doc_count`}\n onBlur={(e) =>\n dispatch(\n changeBucketAggregationSetting({ bucketAgg, settingName: 'min_doc_count', newValue: e.target.value })\n )\n }\n defaultValue={\n bucketAgg.settings?.min_doc_count ||\n bucketAggregationConfig[bucketAgg.type].defaultSettings?.min_doc_count\n }\n />\n </InlineField>\n </>\n )}\n </SettingsEditorContainer>\n );\n};\n","import React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { InlineSegmentGroup, Segment, SegmentAsync } from '@grafana/ui';\n\nimport { useFields } from '../../../hooks/useFields';\nimport { useDispatch } from '../../../hooks/useStatelessReducer';\nimport { segmentStyles } from '../styles';\n\nimport { BucketAggregation, BucketAggregationType } from './../../../types';\nimport { SettingsEditor } from './SettingsEditor';\nimport { isBucketAggregationWithField } from './aggregations';\nimport { changeBucketAggregationField, changeBucketAggregationType } from './state/actions';\nimport { bucketAggregationConfig } from './utils';\n\nconst bucketAggOptions: Array<SelectableValue<BucketAggregationType>> = Object.entries(bucketAggregationConfig).map(\n ([key, { label }]) => ({\n label,\n value: key as BucketAggregationType,\n })\n);\n\nconst toOption = (bucketAgg: BucketAggregation) => ({\n label: bucketAggregationConfig[bucketAgg.type].label,\n value: bucketAgg.type,\n});\n\ninterface QueryMetricEditorProps {\n value: BucketAggregation;\n}\n\nexport const BucketAggregationEditor = ({ value }: QueryMetricEditorProps) => {\n const dispatch = useDispatch();\n const getFields = useFields(value.type);\n\n return (\n <>\n <InlineSegmentGroup>\n <Segment\n className={segmentStyles}\n options={bucketAggOptions}\n onChange={(e) => dispatch(changeBucketAggregationType({ id: value.id, newType: e.value! }))}\n value={toOption(value)}\n />\n\n {isBucketAggregationWithField(value) && (\n <SegmentAsync\n className={segmentStyles}\n loadOptions={getFields}\n onChange={(e) => dispatch(changeBucketAggregationField({ id: value.id, newField: e.value }))}\n placeholder=\"Select Field\"\n value={value.field}\n />\n )}\n </InlineSegmentGroup>\n\n <SettingsEditor bucketAgg={value} />\n </>\n );\n};\n","import React from 'react';\n\nimport { Button } from '@grafana/ui';\n\nimport { useDispatch } from '../../../hooks/useStatelessReducer';\nimport { useQuery } from '../ElasticsearchQueryContext';\nimport { QueryEditorRow } from '../QueryEditorRow';\n\nimport { BucketAggregation } from './../../../types';\nimport { BucketAggregationEditor } from './BucketAggregationEditor';\nimport { addBucketAggregation, removeBucketAggregation } from './state/actions';\n\ninterface Props {\n nextId: BucketAggregation['id'];\n}\n\nexport const BucketAggregationsEditor = ({ nextId }: Props) => {\n const dispatch = useDispatch();\n const { bucketAggs } = useQuery();\n const totalBucketAggs = bucketAggs?.length || 0;\n\n return (\n <>\n {bucketAggs!.map((bucketAgg, index) => (\n <QueryEditorRow\n key={`${bucketAgg.type}-${bucketAgg.id}`}\n label={index === 0 ? 'Group By' : 'Then By'}\n onRemoveClick={totalBucketAggs > 1 && (() => dispatch(removeBucketAggregation(bucketAgg.id)))}\n >\n <BucketAggregationEditor value={bucketAgg} />\n\n {index === 0 && (\n <Button\n variant=\"secondary\"\n fill=\"text\"\n icon=\"plus\"\n onClick={() => dispatch(addBucketAggregation(nextId))}\n tooltip=\"Add grouping condition\"\n aria-label=\"Add grouping condition\"\n />\n )}\n </QueryEditorRow>\n ))}\n </>\n );\n};\n","import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Segment } from '@grafana/ui';\n\nimport { MetricAggregation } from '../types';\nimport { describeMetric } from '../utils';\n\nconst noWrap = css`\n white-space: nowrap;\n`;\n\nconst toOption = (metric: MetricAggregation) => ({\n label: describeMetric(metric),\n value: metric,\n});\n\nconst toOptions = (metrics: MetricAggregation[]): Array<SelectableValue<MetricAggregation>> => metrics.map(toOption);\n\ninterface Props {\n options: MetricAggregation[];\n onChange: (e: SelectableValue<MetricAggregation>) => void;\n className?: string;\n value?: string;\n}\n\nexport const MetricPicker = ({ options, onChange, className, value }: Props) => {\n const selectedOption = options.find((option) => option.id === value);\n\n return (\n <Segment\n className={cx(className, noWrap)}\n options={toOptions(options)}\n onChange={onChange}\n placeholder=\"Select Metric\"\n value={!!selectedOption ? toOption(selectedOption) : undefined}\n />\n );\n};\n","import { uniqueId } from 'lodash';\nimport React, { ComponentProps, useState } from 'react';\n\nimport { InlineField, Input } from '@grafana/ui';\n\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { MetricAggregationWithInlineScript, MetricAggregationWithSettings } from '../../../../types';\nimport { getScriptValue } from '../../../../utils';\nimport { SettingKeyOf } from '../../../types';\nimport { changeMetricSetting } from '../state/actions';\n\ninterface Props<T extends MetricAggregationWithSettings, K extends SettingKeyOf<T>> {\n label: string;\n settingName: K;\n metric: T;\n placeholder?: ComponentProps<typeof Input>['placeholder'];\n tooltip?: ComponentProps<typeof InlineField>['tooltip'];\n}\n\nexport function SettingField<T extends MetricAggregationWithSettings, K extends SettingKeyOf<T>>({\n label,\n settingName,\n metric,\n placeholder,\n tooltip,\n}: Props<T, K>) {\n const dispatch = useDispatch();\n const [id] = useState(uniqueId(`es-field-id-`));\n const settings = metric.settings;\n\n let defaultValue = settings?.[settingName as keyof typeof settings] || '';\n\n if (settingName === 'script') {\n defaultValue = getScriptValue(metric as MetricAggregationWithInlineScript);\n }\n\n return (\n <InlineField label={label} labelWidth={16} tooltip={tooltip}>\n <Input\n id={id}\n placeholder={placeholder}\n onBlur={(e) => dispatch(changeMetricSetting({ metric, settingName, newValue: e.target.value }))}\n defaultValue={defaultValue}\n />\n </InlineField>\n );\n}\n","import { createAction } from '@reduxjs/toolkit';\n\nexport const addPipelineVariable = createAction('@pipelineVariables/add');\nexport const removePipelineVariable = createAction<number>('@pipelineVariables/remove');\n\nexport const renamePipelineVariable = createAction<{ index: number; newName: string }>('@pipelineVariables/rename');\n\nexport const changePipelineVariableMetric = createAction<{ index: number; newMetric: string }>(\n '@pipelineVariables/change_metric'\n);\n","import { Action } from '@reduxjs/toolkit';\n\nimport { PipelineVariable } from '../../../../../../types';\nimport { defaultPipelineVariable, generatePipelineVariableName } from '../utils';\n\nimport {\n addPipelineVariable,\n changePipelineVariableMetric,\n removePipelineVariable,\n renamePipelineVariable,\n} from './actions';\n\nexport const reducer = (state: PipelineVariable[] = [], action: Action) => {\n if (addPipelineVariable.match(action)) {\n return [...state, defaultPipelineVariable(generatePipelineVariableName(state))];\n }\n\n if (removePipelineVariable.match(action)) {\n return state.slice(0, action.payload).concat(state.slice(action.payload + 1));\n }\n\n if (renamePipelineVariable.match(action)) {\n return state.map((pipelineVariable, index) => {\n if (index !== action.payload.index) {\n return pipelineVariable;\n }\n\n return {\n ...pipelineVariable,\n name: action.payload.newName,\n };\n });\n }\n\n if (changePipelineVariableMetric.match(action)) {\n return state.map((pipelineVariable, index) => {\n if (index !== action.payload.index) {\n return pipelineVariable;\n }\n\n return {\n ...pipelineVariable,\n pipelineAgg: action.payload.newMetric,\n };\n });\n }\n\n return state;\n};\n","import { css } from '@emotion/css';\nimport { uniqueId } from 'lodash';\nimport React, { Fragment, useEffect } from 'react';\n\nimport { Input, InlineLabel } from '@grafana/ui';\n\nimport { useStatelessReducer, useDispatch } from '../../../../../hooks/useStatelessReducer';\nimport { BucketScript, MetricAggregation } from '../../../../../types';\nimport { AddRemove } from '../../../../AddRemove';\nimport { MetricPicker } from '../../../../MetricPicker';\nimport { changeMetricAttribute } from '../../state/actions';\nimport { SettingField } from '../SettingField';\n\nimport {\n addPipelineVariable,\n removePipelineVariable,\n renamePipelineVariable,\n changePipelineVariableMetric,\n} from './state/actions';\nimport { reducer } from './state/reducer';\n\ninterface Props {\n value: BucketScript;\n previousMetrics: MetricAggregation[];\n}\n\nexport const BucketScriptSettingsEditor = ({ value, previousMetrics }: Props) => {\n const upperStateDispatch = useDispatch();\n\n const dispatch = useStatelessReducer(\n (newValue) =>\n upperStateDispatch(changeMetricAttribute({ metric: value, attribute: 'pipelineVariables', newValue })),\n value.pipelineVariables,\n reducer\n );\n\n // The model might not have pipeline variables (or an empty array of pipeline vars) in it because of the way it was built in previous versions of the datasource.\n // If this is the case we add a default one.\n useEffect(() => {\n if (!value.pipelineVariables?.length) {\n dispatch(addPipelineVariable());\n }\n }, [dispatch, value.pipelineVariables?.length]);\n\n return (\n <>\n <div\n className={css`\n display: flex;\n `}\n >\n <InlineLabel width={16}>Variables</InlineLabel>\n <div\n className={css`\n display: grid;\n grid-template-columns: 1fr auto;\n row-gap: 4px;\n margin-bottom: 4px;\n `}\n >\n {value.pipelineVariables!.map((pipelineVar, index) => (\n // index as a key doesn't work here since removing an element\n // in the middle of the list, will cause the next element to obtain the same key as the removed one.\n // this will cause react to \"drop\" the last element of the list instead of the just removed one,\n // and the default value for the input won't match the model as the DOM won't get updated.\n // using pipelineVar.name is not an option since it might be duplicated by the user.\n // generating a unique key on every render, while is probably not the best solution in terms of performance\n // ensures the UI is in a correct state. We might want to optimize this if we see perf issue in the future.\n <Fragment key={uniqueId('es-bs-')}>\n <div\n className={css`\n display: grid;\n column-gap: 4px;\n grid-template-columns: auto auto;\n `}\n >\n <Input\n aria-label=\"Variable name\"\n defaultValue={pipelineVar.name}\n placeholder=\"Variable Name\"\n onBlur={(e) => dispatch(renamePipelineVariable({ newName: e.target.value, index }))}\n />\n <MetricPicker\n onChange={(e) => dispatch(changePipelineVariableMetric({ newMetric: e.value!.id, index }))}\n options={previousMetrics}\n value={pipelineVar.pipelineAgg}\n />\n </div>\n\n <AddRemove\n index={index}\n elements={value.pipelineVariables || []}\n onAdd={() => dispatch(addPipelineVariable())}\n onRemove={() => dispatch(removePipelineVariable(index))}\n />\n </Fragment>\n ))}\n </div>\n </div>\n\n <SettingField\n label=\"Script\"\n metric={value}\n settingName=\"script\"\n tooltip=\"Elasticsearch v5.0 and above: Scripting language is Painless. Use params.<var> to reference a variable. Elasticsearch pre-v5.0: Scripting language is per default Groovy if not changed. For Groovy use <var> to reference a variable.\"\n placeholder=\"params.var1 / params.var2\"\n />\n </>\n );\n};\n","import { uniqueId } from 'lodash';\nimport React, { useRef } from 'react';\n\nimport { Input, InlineField, Select, InlineSwitch } from '@grafana/ui';\n\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { movingAvgModelOptions } from '../../../../queryDef';\nimport { MovingAverage } from '../../../../types';\nimport { isEWMAMovingAverage, isHoltMovingAverage, isHoltWintersMovingAverage } from '../aggregations';\nimport { changeMetricSetting } from '../state/actions';\n\nimport { SettingField } from './SettingField';\n\ninterface Props {\n metric: MovingAverage;\n}\n\n// The way we handle changes for those settings is not ideal compared to the other components in the editor\n// FIXME: using `changeMetricSetting` will cause an error when switching from models that have different options\n// as they might be incompatible. We should clear all other options on model change.\nexport const MovingAverageSettingsEditor = ({ metric }: Props) => {\n const dispatch = useDispatch();\n const { current: baseId } = useRef(uniqueId('es-moving-avg-'));\n\n return (\n <>\n <InlineField label=\"Model\" labelWidth={16}>\n <Select\n inputId={`${baseId}-model`}\n onChange={(value) => dispatch(changeMetricSetting({ metric, settingName: 'model', newValue: value.value }))}\n options={movingAvgModelOptions}\n value={metric.settings?.model}\n />\n </InlineField>\n\n <SettingField label=\"Window\" settingName=\"window\" metric={metric} placeholder=\"5\" />\n\n <SettingField label=\"Predict\" settingName=\"predict\" metric={metric} />\n\n {(isEWMAMovingAverage(metric) || isHoltMovingAverage(metric) || isHoltWintersMovingAverage(metric)) && (\n <InlineField label=\"Alpha\" labelWidth={16}>\n <Input\n id={`${baseId}-alpha`}\n onBlur={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'settings',\n newValue: {\n ...metric.settings?.settings,\n alpha: e.target.value,\n },\n })\n )\n }\n defaultValue={metric.settings?.settings?.alpha}\n />\n </InlineField>\n )}\n\n {(isHoltMovingAverage(metric) || isHoltWintersMovingAverage(metric)) && (\n <InlineField label=\"Beta\" labelWidth={16}>\n <Input\n id={`${baseId}-beta`}\n onBlur={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'settings',\n newValue: {\n ...metric.settings?.settings,\n beta: e.target.value,\n },\n })\n )\n }\n defaultValue={metric.settings?.settings?.beta}\n />\n </InlineField>\n )}\n\n {isHoltWintersMovingAverage(metric) && (\n <>\n <InlineField label=\"Gamma\" labelWidth={16}>\n <Input\n id={`${baseId}-gamma`}\n onBlur={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'settings',\n newValue: {\n ...metric.settings?.settings,\n gamma: e.target.value,\n },\n })\n )\n }\n defaultValue={metric.settings?.settings?.gamma}\n />\n </InlineField>\n <InlineField label=\"Period\" labelWidth={16}>\n <Input\n id={`${baseId}-period`}\n onBlur={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'settings',\n newValue: {\n ...metric.settings?.settings,\n period: e.target.value!,\n },\n })\n )\n }\n defaultValue={metric.settings?.settings?.period}\n />\n </InlineField>\n\n <InlineField label=\"Pad\" labelWidth={16}>\n <InlineSwitch\n id={`${baseId}-pad`}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'settings',\n newValue: { ...metric.settings?.settings, pad: e.target.checked },\n })\n )\n }\n checked={!!metric.settings?.settings?.pad}\n />\n </InlineField>\n </>\n )}\n\n {(isEWMAMovingAverage(metric) || isHoltMovingAverage(metric) || isHoltWintersMovingAverage(metric)) && (\n <InlineField label=\"Minimize\" labelWidth={16}>\n <InlineSwitch\n id={`${baseId}-minimize`}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n dispatch(changeMetricSetting({ metric, settingName: 'minimize', newValue: e.target.checked }))\n }\n checked={!!metric.settings?.minimize}\n />\n </InlineField>\n )}\n </>\n );\n};\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { AsyncMultiSelect, InlineField, SegmentAsync, Select } from '@grafana/ui';\n\nimport { useFields } from '../../../../hooks/useFields';\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { TopMetrics } from '../../../../types';\nimport { orderOptions } from '../../BucketAggregationsEditor/utils';\nimport { changeMetricSetting } from '../state/actions';\n\ninterface Props {\n metric: TopMetrics;\n}\n\nconst toMultiSelectValue = (value: string): SelectableValue<string> => ({ value, label: value });\n\nexport const TopMetricsSettingsEditor = ({ metric }: Props) => {\n const dispatch = useDispatch();\n const getOrderByOptions = useFields(['number', 'date']);\n const getMetricsOptions = useFields(metric.type);\n\n return (\n <>\n <InlineField label=\"Metrics\" labelWidth={16}>\n <AsyncMultiSelect\n onChange={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'metrics',\n newValue: e.map((v) => v.value!),\n })\n )\n }\n loadOptions={getMetricsOptions}\n value={metric.settings?.metrics?.map(toMultiSelectValue)}\n closeMenuOnSelect={false}\n defaultOptions\n />\n </InlineField>\n <InlineField label=\"Order\" labelWidth={16}>\n <Select\n onChange={(e) => dispatch(changeMetricSetting({ metric, settingName: 'order', newValue: e.value }))}\n options={orderOptions}\n value={metric.settings?.order}\n />\n </InlineField>\n <InlineField\n label=\"Order By\"\n labelWidth={16}\n className={css`\n & > div {\n width: 100%;\n }\n `}\n >\n <SegmentAsync\n className={css`\n margin-right: 0;\n `}\n loadOptions={getOrderByOptions}\n onChange={(e) => dispatch(changeMetricSetting({ metric, settingName: 'orderBy', newValue: e.value }))}\n placeholder=\"Select Field\"\n value={metric.settings?.orderBy}\n />\n </InlineField>\n </>\n );\n};\n","import { extendedStats } from '../../../../queryDef';\nimport { MetricAggregation } from '../../../../types';\n\nconst hasValue = (value: string) => (object: { value: string }) => object.value === value;\n\n// FIXME: All the defaults and validations down here should be defined somewhere else\n// as they are also the defaults that are gonna be applied to the query.\n// In the previous version, the same method was taking care of describing the settings and setting defaults.\nexport const useDescription = (metric: MetricAggregation): string => {\n switch (metric.type) {\n case 'cardinality': {\n const precisionThreshold = metric.settings?.precision_threshold || '';\n return `Precision threshold: ${precisionThreshold}`;\n }\n\n case 'percentiles':\n if (metric.settings?.percents && metric.settings?.percents?.length >= 1) {\n return `Values: ${metric.settings?.percents}`;\n }\n\n return 'Percents: Default';\n\n case 'extended_stats': {\n const selectedStats = Object.entries(metric.meta || {})\n .map(([key, value]) => value && extendedStats.find(hasValue(key))?.label)\n .filter(Boolean);\n\n return `Stats: ${selectedStats.length > 0 ? selectedStats.join(', ') : 'None selected'}`;\n }\n\n case 'raw_document':\n case 'raw_data': {\n const size = metric.settings?.size || 500;\n return `Size: ${size}`;\n }\n\n default:\n return 'Options';\n }\n};\n","import { uniqueId } from 'lodash';\nimport React, { ComponentProps, useId, useRef, useState } from 'react';\n\nimport { InlineField, Input, InlineSwitch, Select } from '@grafana/ui';\n\nimport { useDispatch } from '../../../../hooks/useStatelessReducer';\nimport { extendedStats } from '../../../../queryDef';\nimport { MetricAggregation, ExtendedStat } from '../../../../types';\nimport { SettingsEditorContainer } from '../../SettingsEditorContainer';\nimport { isMetricAggregationWithInlineScript, isMetricAggregationWithMissingSupport } from '../aggregations';\nimport { changeMetricMeta, changeMetricSetting } from '../state/actions';\nimport { metricAggregationConfig } from '../utils';\n\nimport { BucketScriptSettingsEditor } from './BucketScriptSettingsEditor';\nimport { MovingAverageSettingsEditor } from './MovingAverageSettingsEditor';\nimport { SettingField } from './SettingField';\nimport { TopMetricsSettingsEditor } from './TopMetricsSettingsEditor';\nimport { useDescription } from './useDescription';\n\n// TODO: Move this somewhere and share it with BucketsAggregation Editor\nconst inlineFieldProps: Partial<ComponentProps<typeof InlineField>> = {\n labelWidth: 16,\n};\n\ninterface Props {\n metric: MetricAggregation;\n previousMetrics: MetricAggregation[];\n}\n\nexport const SettingsEditor = ({ metric, previousMetrics }: Props) => {\n const { current: baseId } = useRef(uniqueId('es-setting-'));\n\n const dispatch = useDispatch();\n const description = useDescription(metric);\n\n const sizeFieldId = useId();\n const unitFieldId = useId();\n const modeFieldId = useId();\n\n const rateAggUnitOptions = [\n { value: 'second', label: 'Second' },\n { value: 'minute', label: 'Minute' },\n { value: 'hour', label: 'Hour' },\n { value: 'day', label: 'Day' },\n { value: 'week', label: 'Week' },\n { value: 'month', label: 'Month' },\n { value: 'quarter', label: 'Quarter' },\n { value: 'Year', label: 'Year' },\n ];\n\n const rateAggModeOptions = [\n { value: 'sum', label: 'Sum' },\n { value: 'value_count', label: 'Value count' },\n ];\n\n return (\n <SettingsEditorContainer label={description} hidden={metric.hide}>\n {metric.type === 'derivative' && <SettingField label=\"Unit\" metric={metric} settingName=\"unit\" />}\n\n {metric.type === 'serial_diff' && <SettingField label=\"Lag\" metric={metric} settingName=\"lag\" placeholder=\"1\" />}\n\n {metric.type === 'cumulative_sum' && <SettingField label=\"Format\" metric={metric} settingName=\"format\" />}\n\n {metric.type === 'moving_avg' && <MovingAverageSettingsEditor metric={metric} />}\n\n {metric.type === 'moving_fn' && (\n <>\n <SettingField label=\"Window\" metric={metric} settingName=\"window\" />\n <SettingField label=\"Script\" metric={metric} settingName=\"script\" />\n <SettingField label=\"Shift\" metric={metric} settingName=\"shift\" />\n </>\n )}\n\n {metric.type === 'top_metrics' && <TopMetricsSettingsEditor metric={metric} />}\n\n {metric.type === 'bucket_script' && (\n <BucketScriptSettingsEditor value={metric} previousMetrics={previousMetrics} />\n )}\n\n {(metric.type === 'raw_data' || metric.type === 'raw_document') && (\n <InlineField label=\"Size\" {...inlineFieldProps} htmlFor={sizeFieldId}>\n <Input\n id={sizeFieldId}\n onBlur={(e) => dispatch(changeMetricSetting({ metric, settingName: 'size', newValue: e.target.value }))}\n defaultValue={metric.settings?.size ?? metricAggregationConfig['raw_data'].defaults.settings?.size}\n />\n </InlineField>\n )}\n\n {metric.type === 'logs' && <SettingField label=\"Limit\" metric={metric} settingName=\"limit\" placeholder=\"500\" />}\n\n {metric.type === 'cardinality' && (\n <SettingField label=\"Precision Threshold\" metric={metric} settingName=\"precision_threshold\" />\n )}\n\n {metric.type === 'extended_stats' && (\n <>\n {extendedStats.map((stat) => (\n <ExtendedStatSetting\n key={stat.value}\n stat={stat}\n onChange={(newValue) => dispatch(changeMetricMeta({ metric, meta: stat.value, newValue }))}\n value={\n metric.meta?.[stat.value] !== undefined\n ? !!metric.meta?.[stat.value]\n : !!metricAggregationConfig['extended_stats'].defaults.meta?.[stat.value]\n }\n />\n ))}\n\n <SettingField label=\"Sigma\" metric={metric} settingName=\"sigma\" placeholder=\"3\" />\n </>\n )}\n\n {metric.type === 'percentiles' && (\n <InlineField label=\"Percentiles\" {...inlineFieldProps}>\n <Input\n id={`${baseId}-percentiles-percents`}\n onBlur={(e) =>\n dispatch(\n changeMetricSetting({\n metric,\n settingName: 'percents',\n newValue: e.target.value.split(',').filter(Boolean),\n })\n )\n }\n defaultValue={\n metric.settings?.percents || metricAggregationConfig['percentiles'].defaults.settings?.percents\n }\n placeholder=\"1,5,25,50,75,95,99\"\n />\n </InlineField>\n )}\n\n {metric.type === 'rate' && (\n <>\n <InlineField label=\"Unit\" {...inlineFieldProps} data-testid=\"unit-select\" htmlFor={unitFieldId}>\n <Select\n id={unitFieldId}\n onChange={(e) => dispatch(changeMetricSetting({ metric, settingName: 'unit', newValue: e.value }))}\n options={rateAggUnitOptions}\n value={metric.settings?.unit}\n />\n </InlineField>\n\n <InlineField label=\"Mode\" {...inlineFieldProps} data-testid=\"mode-select\" htmlFor={modeFieldId}>\n <Select\n id={modeFieldId}\n onChange={(e) => dispatch(changeMetricSetting({ metric, settingName: 'mode', newValue: e.value }))}\n options={rateAggModeOptions}\n value={metric.settings?.unit}\n />\n </InlineField>\n </>\n )}\n\n {isMetricAggregationWithInlineScript(metric) && (\n <SettingField label=\"Script\" metric={metric} settingName=\"script\" placeholder=\"_value * 1\" />\n )}\n\n {isMetricAggregationWithMissingSupport(metric) && (\n <SettingField\n label=\"Missing\"\n metric={metric}\n settingName=\"missing\"\n tooltip=\"The missing parameter defines how documents that are missing a value should be treated. By default\n they will be ignored but it is also possible to treat them as if they had a value\"\n />\n )}\n </SettingsEditorContainer>\n );\n};\n\ninterface ExtendedStatSettingProps {\n stat: ExtendedStat;\n onChange: (checked: boolean) => void;\n value: boolean;\n}\nconst ExtendedStatSetting = ({ stat, onChange, value }: ExtendedStatSettingProps) => {\n // this is needed for the htmlFor prop in the label so that clicking the label will toggle the switch state.\n const [id] = useState(uniqueId(`es-field-id-`));\n\n return (\n <InlineField label={stat.label} {...inlineFieldProps} key={stat.value}>\n <InlineSwitch\n id={id}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => onChange(e.target.checked)}\n value={value}\n />\n </InlineField>\n );\n};\n","import React from 'react';\n\nimport { InlineFieldRow, InlineLabel, InlineSegmentGroup } from '@grafana/ui';\n\nimport { MetricAggregation } from '../../types';\n\nimport { SettingsEditor } from './MetricAggregationsEditor/SettingsEditor';\n\ntype Props = {\n name: string;\n metric: MetricAggregation;\n};\n\nexport const QueryEditorSpecialMetricRow = ({ name, metric }: Props) => {\n // this widget is only used in scenarios when there is only a single\n // metric, so the array of \"previousMetrics\" (meaning all the metrics\n // before the current metric), is an ampty-array\n const previousMetrics: MetricAggregation[] = [];\n\n return (\n <InlineFieldRow>\n <InlineSegmentGroup>\n <InlineLabel width={17} as=\"div\">\n <span>{name}</span>\n </InlineLabel>\n </InlineSegmentGroup>\n <SettingsEditor metric={metric} previousMetrics={previousMetrics} />\n </InlineFieldRow>\n );\n};\n","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport const getStyles = (theme: GrafanaTheme2, hidden: boolean) => {\n return {\n color:\n hidden &&\n css`\n &,\n &:hover,\n label,\n a {\n color: ${hidden ? theme.colors.text.disabled : theme.colors.text.primary};\n }\n `,\n };\n};\n","import { cx } from '@emotion/css';\nimport React, { useCallback } from 'react';\nimport { satisfies, SemVer } from 'semver';\n\nimport { SelectableValue } from '@grafana/data';\nimport { InlineSegmentGroup, SegmentAsync, useTheme2 } from '@grafana/ui';\n\nimport { useFields } from '../../../hooks/useFields';\nimport { useDispatch } from '../../../hooks/useStatelessReducer';\nimport { MetricAggregation, MetricAggregationType } from '../../../types';\nimport { MetricPicker } from '../../MetricPicker';\nimport { useDatasource, useQuery } from '../ElasticsearchQueryContext';\nimport { segmentStyles } from '../styles';\n\nimport { SettingsEditor } from './SettingsEditor';\nimport {\n isMetricAggregationWithField,\n isMetricAggregationWithInlineScript,\n isMetricAggregationWithSettings,\n isPipelineAggregation,\n isPipelineAggregationWithMultipleBucketPaths,\n} from './aggregations';\nimport { changeMetricField, changeMetricType } from './state/actions';\nimport { getStyles } from './styles';\nimport { metricAggregationConfig } from './utils';\n\nconst toOption = (metric: MetricAggregation) => ({\n label: metricAggregationConfig[metric.type].label,\n value: metric.type,\n});\n\ninterface Props {\n value: MetricAggregation;\n}\n\n// If a metric is a Pipeline Aggregation (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html)\n// it doesn't make sense to show it in the type picker when there is no non-pipeline-aggregation previously selected\n// as they work on the outputs produced from other aggregations rather than from documents or fields.\n// This means we should filter them out from the type picker if there's no other \"basic\" aggregation before the current one.\nconst isBasicAggregation = (metric: MetricAggregation) => !metricAggregationConfig[metric.type].isPipelineAgg;\n\nconst getTypeOptions = (\n previousMetrics: MetricAggregation[],\n esVersion: SemVer | null\n): Array<SelectableValue<MetricAggregationType>> => {\n // we'll include Pipeline Aggregations only if at least one previous metric is a \"Basic\" one\n const includePipelineAggregations = previousMetrics.some(isBasicAggregation);\n\n return (\n Object.entries(metricAggregationConfig)\n .filter(([_, config]) => config.impliedQueryType === 'metrics')\n // Only showing metrics type supported by the version of ES.\n // if we cannot determine the version, we assume it is suitable.\n .filter(([_, { versionRange = '*' }]) => (esVersion != null ? satisfies(esVersion, versionRange) : true))\n // Filtering out Pipeline Aggregations if there's no basic metric selected before\n .filter(([_, config]) => includePipelineAggregations || !config.isPipelineAgg)\n .map(([key, { label }]) => ({\n label,\n value: key as MetricAggregationType,\n }))\n );\n};\n\nexport const MetricEditor = ({ value }: Props) => {\n const styles = getStyles(useTheme2(), !!value.hide);\n const datasource = useDatasource();\n const query = useQuery();\n const dispatch = useDispatch();\n const getFields = useFields(value.type);\n\n const getTypeOptionsAsync = async (previousMetrics: MetricAggregation[]) => {\n const dbVersion = await datasource.getDatabaseVersion();\n return getTypeOptions(previousMetrics, dbVersion);\n };\n\n const loadOptions = useCallback(async () => {\n const remoteFields = await getFields();\n\n // Metric aggregations that have inline script support don't require a field to be set.\n if (isMetricAggregationWithInlineScript(value)) {\n return [{ label: 'None' }, ...remoteFields];\n }\n\n return remoteFields;\n }, [getFields, value]);\n\n const previousMetrics = query.metrics!.slice(\n 0,\n query.metrics!.findIndex((m) => m.id === value.id)\n );\n\n return (\n <>\n <InlineSegmentGroup>\n <SegmentAsync\n className={cx(styles.color, segmentStyles)}\n loadOptions={() => getTypeOptionsAsync(previousMetrics)}\n onChange={(e) => dispatch(changeMetricType({ id: value.id, type: e.value! }))}\n value={toOption(value)}\n />\n\n {isMetricAggregationWithField(value) && !isPipelineAggregation(value) && (\n <SegmentAsync\n className={cx(styles.color, segmentStyles)}\n loadOptions={loadOptions}\n onChange={(e) => dispatch(changeMetricField({ id: value.id, field: e.value! }))}\n placeholder=\"Select Field\"\n value={value.field}\n />\n )}\n\n {isPipelineAggregation(value) && !isPipelineAggregationWithMultipleBucketPaths(value) && (\n <MetricPicker\n className={cx(styles.color, segmentStyles)}\n onChange={(e) => dispatch(changeMetricField({ id: value.id, field: e.value?.id! }))}\n options={previousMetrics}\n value={value.field}\n />\n )}\n </InlineSegmentGroup>\n\n {isMetricAggregationWithSettings(value) && <SettingsEditor metric={value} previousMetrics={previousMetrics} />}\n </>\n );\n};\n","import React from 'react';\n\nimport { Alert, Button } from '@grafana/ui';\n\nimport { useDispatch } from '../../../hooks/useStatelessReducer';\nimport { useQuery } from '../ElasticsearchQueryContext';\nimport { QueryEditorRow } from '../QueryEditorRow';\nimport { QueryEditorSpecialMetricRow } from '../QueryEditorSpecialMetricRow';\n\nimport { MetricAggregation } from './../../../types';\nimport { MetricEditor } from './MetricEditor';\nimport { addMetric, removeMetric, toggleMetricVisibility } from './state/actions';\nimport { metricAggregationConfig } from './utils';\n\ninterface Props {\n nextId: MetricAggregation['id'];\n}\n\nexport const MetricAggregationsEditor = ({ nextId }: Props) => {\n const dispatch = useDispatch();\n const { metrics } = useQuery();\n const totalMetrics = metrics?.length || 0;\n\n return (\n <>\n {metrics?.map((metric, index) => {\n switch (metric.type) {\n case 'logs':\n return <QueryEditorSpecialMetricRow key={`${metric.type}-${metric.id}`} name=\"Logs\" metric={metric} />;\n case 'raw_data':\n return <QueryEditorSpecialMetricRow key={`${metric.type}-${metric.id}`} name=\"Raw Data\" metric={metric} />;\n case 'raw_document':\n return (\n <>\n <QueryEditorSpecialMetricRow key={`${metric.type}-${metric.id}`} name=\"Raw Document\" metric={metric} />\n <Alert severity=\"warning\" title=\"The 'Raw Document' query type is deprecated.\" />\n </>\n );\n default:\n return (\n <QueryEditorRow\n key={`${metric.type}-${metric.id}`}\n label={`Metric (${metric.id})`}\n hidden={metric.hide}\n onHideClick={() => dispatch(toggleMetricVisibility(metric.id))}\n onRemoveClick={totalMetrics > 1 && (() => dispatch(removeMetric(metric.id)))}\n >\n <MetricEditor value={metric} />\n\n {metricAggregationConfig[metric.type].impliedQueryType === 'metrics' && index === 0 && (\n <Button\n variant=\"secondary\"\n fill=\"text\"\n icon=\"plus\"\n onClick={() => dispatch(addMetric(nextId))}\n tooltip=\"Add metric\"\n aria-label=\"Add metric\"\n />\n )}\n </QueryEditorRow>\n );\n }\n })}\n </>\n );\n};\n","import React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { RadioButtonGroup } from '@grafana/ui';\n\nimport { useDispatch } from '../../hooks/useStatelessReducer';\nimport { MetricAggregation, QueryType } from '../../types';\n\nimport { useQuery } from './ElasticsearchQueryContext';\nimport { changeMetricType } from './MetricAggregationsEditor/state/actions';\nimport { metricAggregationConfig } from './MetricAggregationsEditor/utils';\n\nconst OPTIONS: Array<SelectableValue<QueryType>> = [\n { value: 'metrics', label: 'Metrics' },\n { value: 'logs', label: 'Logs' },\n { value: 'raw_data', label: 'Raw Data' },\n { value: 'raw_document', label: 'Raw Document' },\n];\n\nfunction queryTypeToMetricType(type: QueryType): MetricAggregation['type'] {\n switch (type) {\n case 'logs':\n case 'raw_data':\n case 'raw_document':\n return type;\n case 'metrics':\n return 'count';\n default:\n // should never happen\n throw new Error(`invalid query type: ${type}`);\n }\n}\n\nexport const QueryTypeSelector = () => {\n const query = useQuery();\n const dispatch = useDispatch();\n\n const firstMetric = query.metrics?.[0];\n\n if (firstMetric == null) {\n // not sure if this can really happen, but we should handle it anyway\n return null;\n }\n\n const queryType = metricAggregationConfig[firstMetric.type].impliedQueryType;\n\n const onChange = (newQueryType: QueryType) => {\n dispatch(changeMetricType({ id: firstMetric.id, type: queryTypeToMetricType(newQueryType) }));\n };\n\n return <RadioButtonGroup<QueryType> fullWidth={false} options={OPTIONS} value={queryType} onChange={onChange} />;\n};\n","import { css } from '@emotion/css';\nimport React, { useEffect, useId, useState } from 'react';\nimport { SemVer } from 'semver';\n\nimport { getDefaultTimeRange, GrafanaTheme2, QueryEditorProps } from '@grafana/data';\nimport { Alert, InlineField, InlineLabel, Input, QueryField, useStyles2 } from '@grafana/ui';\n\nimport { ElasticDatasource } from '../../datasource';\nimport { useNextId } from '../../hooks/useNextId';\nimport { useDispatch } from '../../hooks/useStatelessReducer';\nimport { ElasticsearchOptions, ElasticsearchQuery } from '../../types';\nimport { isSupportedVersion, isTimeSeriesQuery, unsupportedVersionMessage } from '../../utils';\n\nimport { BucketAggregationsEditor } from './BucketAggregationsEditor';\nimport { ElasticsearchProvider } from './ElasticsearchQueryContext';\nimport { MetricAggregationsEditor } from './MetricAggregationsEditor';\nimport { metricAggregationConfig } from './MetricAggregationsEditor/utils';\nimport { QueryTypeSelector } from './QueryTypeSelector';\nimport { changeAliasPattern, changeQuery } from './state';\n\nexport type ElasticQueryEditorProps = QueryEditorProps<ElasticDatasource, ElasticsearchQuery, ElasticsearchOptions>;\n\n// a react hook that returns the elasticsearch database version,\n// or `null`, while loading, or if it is not possible to determine the value.\nfunction useElasticVersion(datasource: ElasticDatasource): SemVer | null {\n const [version, setVersion] = useState<SemVer | null>(null);\n useEffect(() => {\n let canceled = false;\n datasource.getDatabaseVersion().then(\n (version) => {\n if (!canceled) {\n setVersion(version);\n }\n },\n (error) => {\n // we do nothing\n console.log(error);\n }\n );\n\n return () => {\n canceled = true;\n };\n }, [datasource]);\n\n return version;\n}\n\nexport const QueryEditor = ({ query, onChange, onRunQuery, datasource, range }: ElasticQueryEditorProps) => {\n const elasticVersion = useElasticVersion(datasource);\n const showUnsupportedMessage = elasticVersion != null && !isSupportedVersion(elasticVersion);\n return (\n <ElasticsearchProvider\n datasource={datasource}\n onChange={onChange}\n onRunQuery={onRunQuery}\n query={query}\n range={range || getDefaultTimeRange()}\n >\n {showUnsupportedMessage && <Alert title={unsupportedVersionMessage} />}\n <QueryEditorForm value={query} />\n </ElasticsearchProvider>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n root: css`\n display: flex;\n `,\n queryItem: css`\n flex-grow: 1;\n margin: 0 ${theme.spacing(0.5)} ${theme.spacing(0.5)} 0;\n `,\n});\n\ninterface Props {\n value: ElasticsearchQuery;\n}\n\nexport const ElasticSearchQueryField = ({ value, onChange }: { value?: string; onChange: (v: string) => void }) => {\n const styles = useStyles2(getStyles);\n\n return (\n <div className={styles.queryItem}>\n <QueryField query={value} onChange={onChange} placeholder=\"Enter a lucene query\" portalOrigin=\"elasticsearch\" />\n </div>\n );\n};\n\nconst QueryEditorForm = ({ value }: Props) => {\n const dispatch = useDispatch();\n const nextId = useNextId();\n const inputId = useId();\n const styles = useStyles2(getStyles);\n\n const isTimeSeries = isTimeSeriesQuery(value);\n\n const showBucketAggregationsEditor = value.metrics?.every(\n (metric) => metricAggregationConfig[metric.type].impliedQueryType === 'metrics'\n );\n\n return (\n <>\n <div className={styles.root}>\n <InlineLabel width={17}>Query type</InlineLabel>\n <div className={styles.queryItem}>\n <QueryTypeSelector />\n </div>\n </div>\n <div className={styles.root}>\n <InlineLabel width={17}>Lucene Query</InlineLabel>\n <ElasticSearchQueryField onChange={(query) => dispatch(changeQuery(query))} value={value?.query} />\n\n {isTimeSeries && (\n <InlineField\n label=\"Alias\"\n labelWidth={15}\n tooltip=\"Aliasing only works for timeseries queries (when the last group is 'Date Histogram'). For all other query types this field is ignored.\"\n htmlFor={inputId}\n >\n <Input\n id={inputId}\n placeholder=\"Alias Pattern\"\n onBlur={(e) => dispatch(changeAliasPattern(e.currentTarget.value))}\n defaultValue={value.alias}\n />\n </InlineField>\n )}\n </div>\n\n <MetricAggregationsEditor nextId={nextId} />\n {showBucketAggregationsEditor && <BucketAggregationsEditor nextId={nextId} />}\n </>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { Dispatch, SetStateAction, useEffect, useState } from 'react';\nimport { usePrevious } from 'react-use';\n\nimport { DataSourceInstanceSettings, VariableSuggestion } from '@grafana/data';\nimport { DataSourcePicker } from '@grafana/runtime';\nimport {\n Button,\n DataLinkInput,\n InlineField,\n InlineSwitch,\n InlineFieldRow,\n InlineLabel,\n Input,\n useStyles2,\n} from '@grafana/ui';\n\nimport { DataLinkConfig } from '../types';\n\ninterface Props {\n value: DataLinkConfig;\n onChange: (value: DataLinkConfig) => void;\n onDelete: () => void;\n suggestions: VariableSuggestion[];\n className?: string;\n}\n\nexport const DataLink = (props: Props) => {\n const { value, onChange, onDelete, suggestions, className } = props;\n const styles = useStyles2(getStyles);\n const [showInternalLink, setShowInternalLink] = useInternalLink(value.datasourceUid);\n\n const handleChange = (field: keyof typeof value) => (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange({\n ...value,\n [field]: event.currentTarget.value,\n });\n };\n\n return (\n <div className={className}>\n <div className={styles.firstRow}>\n <InlineField\n label=\"Field\"\n htmlFor=\"elasticsearch-datasource-config-field\"\n labelWidth={12}\n tooltip={'Can be exact field name or a regex pattern that will match on the field name.'}\n >\n <Input\n type=\"text\"\n id=\"elasticsearch-datasource-config-field\"\n value={value.field}\n onChange={handleChange('field')}\n width={100}\n />\n </InlineField>\n <Button\n variant={'destructive'}\n title=\"Remove field\"\n icon=\"times\"\n onClick={(event) => {\n event.preventDefault();\n onDelete();\n }}\n />\n </div>\n\n <InlineFieldRow>\n <div className={styles.urlField}>\n <InlineLabel htmlFor=\"elasticsearch-datasource-internal-link\" width={12}>\n {showInternalLink ? 'Query' : 'URL'}\n </InlineLabel>\n <DataLinkInput\n placeholder={showInternalLink ? '${__value.raw}' : 'http://example.com/${__value.raw}'}\n value={value.url || ''}\n onChange={(newValue) =>\n onChange({\n ...value,\n url: newValue,\n })\n }\n suggestions={suggestions}\n />\n </div>\n\n <div className={styles.urlDisplayLabelField}>\n <InlineField\n label=\"URL Label\"\n htmlFor=\"elasticsearch-datasource-url-label\"\n labelWidth={14}\n tooltip={'Use to override the button label.'}\n >\n <Input\n type=\"text\"\n id=\"elasticsearch-datasource-url-label\"\n value={value.urlDisplayLabel}\n onChange={handleChange('urlDisplayLabel')}\n />\n </InlineField>\n </div>\n </InlineFieldRow>\n\n <div className={styles.row}>\n <InlineField label=\"Internal link\" labelWidth={12}>\n <InlineSwitch\n label=\"Internal link\"\n value={showInternalLink || false}\n onChange={() => {\n if (showInternalLink) {\n onChange({\n ...value,\n datasourceUid: undefined,\n });\n }\n setShowInternalLink(!showInternalLink);\n }}\n />\n </InlineField>\n\n {showInternalLink && (\n <DataSourcePicker\n tracing={true}\n // Uid and value should be always set in the db and so in the items.\n onChange={(ds: DataSourceInstanceSettings) => {\n onChange({\n ...value,\n datasourceUid: ds.uid,\n });\n }}\n current={value.datasourceUid}\n />\n )}\n </div>\n </div>\n );\n};\n\nfunction useInternalLink(datasourceUid?: string): [boolean, Dispatch<SetStateAction<boolean>>] {\n const [showInternalLink, setShowInternalLink] = useState<boolean>(!!datasourceUid);\n const previousUid = usePrevious(datasourceUid);\n\n // Force internal link visibility change if uid changed outside of this component.\n useEffect(() => {\n if (!previousUid && datasourceUid && !showInternalLink) {\n setShowInternalLink(true);\n }\n if (previousUid && !datasourceUid && showInternalLink) {\n setShowInternalLink(false);\n }\n }, [previousUid, datasourceUid, showInternalLink]);\n\n return [showInternalLink, setShowInternalLink];\n}\n\nconst getStyles = () => ({\n firstRow: css`\n display: flex;\n `,\n nameField: css`\n flex: 2;\n `,\n regexField: css`\n flex: 3;\n `,\n row: css`\n display: flex;\n align-items: baseline;\n `,\n urlField: css`\n display: flex;\n flex: 1;\n `,\n urlDisplayLabelField: css`\n flex: 1;\n `,\n});\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2, VariableOrigin, DataLinkBuiltInVars } from '@grafana/data';\nimport { ConfigDescriptionLink, ConfigSubSection } from '@grafana/experimental';\nimport { Button, useStyles2 } from '@grafana/ui';\n\nimport { DataLinkConfig } from '../types';\n\nimport { DataLink } from './DataLink';\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n addButton: css`\n margin-right: 10px;\n `,\n container: css`\n margin-bottom: ${theme.spacing(2)};\n `,\n dataLink: css`\n margin-bottom: ${theme.spacing(1)};\n `,\n };\n};\n\nexport type Props = {\n value?: DataLinkConfig[];\n onChange: (value: DataLinkConfig[]) => void;\n};\nexport const DataLinks = (props: Props) => {\n const { value, onChange } = props;\n const styles = useStyles2(getStyles);\n\n return (\n <ConfigSubSection\n title=\"Data links\"\n description={\n <ConfigDescriptionLink\n description=\"Add links to existing fields. Links will be shown in log row details next to the field value.\"\n suffix=\"elasticsearch/#data-links\"\n feature=\"Elasticsearch data links\"\n />\n }\n >\n <div className={styles.container}>\n {value && value.length > 0 && (\n <div className=\"gf-form-group\">\n {value.map((field, index) => {\n return (\n <DataLink\n className={styles.dataLink}\n key={index}\n value={field}\n onChange={(newField) => {\n const newDataLinks = [...value];\n newDataLinks.splice(index, 1, newField);\n onChange(newDataLinks);\n }}\n onDelete={() => {\n const newDataLinks = [...value];\n newDataLinks.splice(index, 1);\n onChange(newDataLinks);\n }}\n suggestions={[\n {\n value: DataLinkBuiltInVars.valueRaw,\n label: 'Raw value',\n documentation: 'Raw value of the field',\n origin: VariableOrigin.Value,\n },\n ]}\n />\n );\n })}\n </div>\n )}\n\n <Button\n type=\"button\"\n variant={'secondary'}\n className={styles.addButton}\n icon=\"plus\"\n onClick={(event) => {\n event.preventDefault();\n const newDataLinks = [...(value || []), { field: '', url: '' }];\n onChange(newDataLinks);\n }}\n >\n Add\n </Button>\n </div>\n </ConfigSubSection>\n );\n};\n","import React from 'react';\n\nimport { DataSourceSettings, SelectableValue } from '@grafana/data';\nimport { ConfigDescriptionLink, ConfigSubSection } from '@grafana/experimental';\nimport { InlineField, Input, Select, InlineSwitch } from '@grafana/ui';\n\nimport { ElasticsearchOptions, Interval } from '../types';\n\nconst indexPatternTypes: Array<SelectableValue<'none' | Interval>> = [\n { label: 'No pattern', value: 'none' },\n { label: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH' },\n { label: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD' },\n { label: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW' },\n { label: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM' },\n { label: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY' },\n];\n\ntype Props = {\n value: DataSourceSettings<ElasticsearchOptions>;\n onChange: (value: DataSourceSettings<ElasticsearchOptions>) => void;\n};\nexport const ElasticDetails = ({ value, onChange }: Props) => {\n return (\n <ConfigSubSection\n title=\"Elasticsearch details\"\n description={\n <ConfigDescriptionLink\n description=\"Specific settings for the Elasticsearch data source.\"\n suffix=\"elasticsearch/#index-settings\"\n feature=\"Elasticsearch details\"\n />\n }\n >\n <InlineField\n label=\"Index name\"\n htmlFor=\"es_config_indexName\"\n labelWidth={29}\n tooltip=\"Name of your Elasticsearch index. You can use a time pattern, such as YYYY.MM.DD, or a wildcard for the index name.\"\n >\n <Input\n id=\"es_config_indexName\"\n value={value.jsonData.index ?? (value.database || '')}\n onChange={indexChangeHandler(value, onChange)}\n width={24}\n placeholder=\"es-index-name\"\n required\n />\n </InlineField>\n\n <InlineField\n label=\"Pattern\"\n htmlFor=\"es_config_indexPattern\"\n labelWidth={29}\n tooltip=\"If you're using a pattern for your index, select the type, or no pattern.\"\n >\n <Select\n inputId=\"es_config_indexPattern\"\n value={indexPatternTypes.find(\n (pattern) => pattern.value === (value.jsonData.interval === undefined ? 'none' : value.jsonData.interval)\n )}\n options={indexPatternTypes}\n onChange={intervalHandler(value, onChange)}\n width={24}\n />\n </InlineField>\n\n <InlineField\n label=\"Time field name\"\n htmlFor=\"es_config_timeField\"\n labelWidth={29}\n tooltip=\"Name of your time field. Defaults to @timestamp.\"\n >\n <Input\n id=\"es_config_timeField\"\n value={value.jsonData.timeField || ''}\n onChange={jsonDataChangeHandler('timeField', value, onChange)}\n width={24}\n placeholder=\"@timestamp\"\n required\n />\n </InlineField>\n\n <InlineField\n label=\"Max concurrent Shard Requests\"\n htmlFor=\"es_config_shardRequests\"\n labelWidth={29}\n tooltip=\"Maximum number of concurrent shards a search request can hit per node. Defaults to 5.\"\n >\n <Input\n id=\"es_config_shardRequests\"\n value={value.jsonData.maxConcurrentShardRequests || ''}\n onChange={jsonDataChangeHandler('maxConcurrentShardRequests', value, onChange)}\n width={24}\n />\n </InlineField>\n\n <InlineField\n label=\"Min time interval\"\n htmlFor=\"es_config_minTimeInterval\"\n labelWidth={29}\n tooltip={\n <>\n A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example{' '}\n <code>1m</code> if your data is written every minute.\n </>\n }\n error=\"Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s\"\n invalid={!!value.jsonData.timeInterval && !/^\\d+(ms|[Mwdhmsy])$/.test(value.jsonData.timeInterval)}\n >\n <Input\n id=\"es_config_minTimeInterval\"\n value={value.jsonData.timeInterval || ''}\n onChange={jsonDataChangeHandler('timeInterval', value, onChange)}\n width={24}\n placeholder=\"10s\"\n />\n </InlineField>\n\n <InlineField label=\"X-Pack enabled\" labelWidth={29} tooltip=\"Enable or disable X-Pack specific features\">\n <InlineSwitch\n id=\"es_config_xpackEnabled\"\n value={value.jsonData.xpack || false}\n onChange={jsonDataSwitchChangeHandler('xpack', value, onChange)}\n />\n </InlineField>\n\n {value.jsonData.xpack && (\n <InlineField\n label=\"Include Frozen Indices\"\n htmlFor=\"es_config_frozenIndices\"\n labelWidth={29}\n tooltip=\"Include frozen indices in searches.\"\n >\n <InlineSwitch\n id=\"es_config_frozenIndices\"\n value={value.jsonData.includeFrozen ?? false}\n onChange={jsonDataSwitchChangeHandler('includeFrozen', value, onChange)}\n />\n </InlineField>\n )}\n </ConfigSubSection>\n );\n};\n\nconst indexChangeHandler =\n (value: Props['value'], onChange: Props['onChange']) =>\n (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {\n onChange({\n ...value,\n database: '',\n jsonData: {\n ...value.jsonData,\n index: event.currentTarget.value,\n },\n });\n };\n\n// TODO: Use change handlers from @grafana/data\nconst jsonDataChangeHandler =\n (key: keyof ElasticsearchOptions, value: Props['value'], onChange: Props['onChange']) =>\n (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {\n onChange({\n ...value,\n jsonData: {\n ...value.jsonData,\n [key]: event.currentTarget.value,\n },\n });\n };\n\nconst jsonDataSwitchChangeHandler =\n (key: keyof ElasticsearchOptions, value: Props['value'], onChange: Props['onChange']) =>\n (event: React.SyntheticEvent<HTMLInputElement>) => {\n onChange({\n ...value,\n jsonData: {\n ...value.jsonData,\n [key]: event.currentTarget.checked,\n },\n });\n };\n\nconst intervalHandler =\n (value: Props['value'], onChange: Props['onChange']) => (option: SelectableValue<Interval | 'none'>) => {\n // If option value is undefined it will send its label instead so we have to convert made up value to undefined here.\n const newInterval = option.value === 'none' ? undefined : option.value;\n\n const currentIndex = value.jsonData.index ?? value.database;\n if (!currentIndex || currentIndex.length === 0 || currentIndex.startsWith('[logstash-]')) {\n let newDatabase = '';\n\n if (newInterval !== undefined) {\n const pattern = indexPatternTypes.find((pattern) => pattern.value === newInterval);\n\n if (pattern) {\n newDatabase = pattern.example ?? '';\n }\n }\n\n onChange({\n ...value,\n database: '',\n jsonData: {\n ...value.jsonData,\n index: newDatabase,\n interval: newInterval,\n },\n });\n } else {\n onChange({\n ...value,\n jsonData: {\n ...value.jsonData,\n interval: newInterval,\n },\n });\n }\n };\n\nexport function defaultMaxConcurrentShardRequests() {\n return 5;\n}\n","import React from 'react';\n\nimport { ConfigDescriptionLink, ConfigSubSection } from '@grafana/experimental';\nimport { Input, InlineField } from '@grafana/ui';\n\nimport { ElasticsearchOptions } from '../types';\n\ntype Props = {\n value: ElasticsearchOptions;\n onChange: (value: ElasticsearchOptions) => void;\n};\nexport const LogsConfig = (props: Props) => {\n const { value, onChange } = props;\n const changeHandler =\n (key: keyof ElasticsearchOptions) => (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {\n onChange({\n ...value,\n [key]: event.currentTarget.value,\n });\n };\n\n return (\n <ConfigSubSection\n title=\"Logs\"\n description={\n <ConfigDescriptionLink\n description=\"Configure which fields the data source uses for log messages and log levels.\"\n suffix=\"elasticsearch/#logs\"\n feature=\"Elasticsearch log fields\"\n />\n }\n >\n <InlineField\n label=\"Message field name\"\n labelWidth={22}\n tooltip=\"Configure the field to be used for log messages.\"\n >\n <Input\n id=\"es_logs-config_logMessageField\"\n value={value.logMessageField}\n onChange={changeHandler('logMessageField')}\n placeholder=\"_source\"\n width={24}\n />\n </InlineField>\n\n <InlineField\n label=\"Level field name\"\n labelWidth={22}\n tooltip=\"Configure the field that determines the level of each log message.\"\n >\n <Input\n id=\"es_logs-config_logLevelField\"\n value={value.logLevelField}\n onChange={changeHandler('logLevelField')}\n width={24}\n />\n </InlineField>\n </ConfigSubSection>\n );\n};\n","import { DataSourceSettings } from '@grafana/data';\n\nimport { ElasticsearchOptions } from '../types';\n\nimport { defaultMaxConcurrentShardRequests } from './ElasticDetails';\n\nexport const coerceOptions = (\n options: DataSourceSettings<ElasticsearchOptions, {}>\n): DataSourceSettings<ElasticsearchOptions, {}> => {\n return {\n ...options,\n jsonData: {\n ...options.jsonData,\n timeField: options.jsonData.timeField || '@timestamp',\n maxConcurrentShardRequests: options.jsonData.maxConcurrentShardRequests || defaultMaxConcurrentShardRequests(),\n logMessageField: options.jsonData.logMessageField || '',\n logLevelField: options.jsonData.logLevelField || '',\n includeFrozen: options.jsonData.includeFrozen ?? false,\n },\n };\n};\n\nexport const isValidOptions = (options: DataSourceSettings<ElasticsearchOptions, {}>): boolean => {\n return (\n // timeField should not be empty or nullish\n !!options.jsonData.timeField &&\n // maxConcurrentShardRequests should be a number AND greater than 0\n !!options.jsonData.maxConcurrentShardRequests &&\n // message & level fields should be defined\n options.jsonData.logMessageField !== undefined &&\n options.jsonData.logLevelField !== undefined\n );\n};\n","import React, { useEffect } from 'react';\n\nimport { SIGV4ConnectionConfig } from '@grafana/aws-sdk';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport {\n AdvancedHttpSettings,\n Auth,\n AuthMethod,\n ConfigSection,\n ConnectionSettings,\n convertLegacyAuthProps,\n DataSourceDescription,\n} from '@grafana/experimental';\nimport { config } from '@grafana/runtime';\nimport { Alert, SecureSocksProxySettings, Divider, Stack } from '@grafana/ui';\n\nimport { ElasticsearchOptions } from '../types';\n\nimport { DataLinks } from './DataLinks';\nimport { ElasticDetails } from './ElasticDetails';\nimport { LogsConfig } from './LogsConfig';\nimport { coerceOptions, isValidOptions } from './utils';\n\nexport type Props = DataSourcePluginOptionsEditorProps<ElasticsearchOptions>;\n\nexport const ConfigEditor = (props: Props) => {\n const { options, onOptionsChange } = props;\n\n useEffect(() => {\n if (!isValidOptions(options)) {\n onOptionsChange(coerceOptions(options));\n }\n }, [onOptionsChange, options]);\n\n const authProps = convertLegacyAuthProps({\n config: options,\n onChange: onOptionsChange,\n });\n if (config.sigV4AuthEnabled) {\n authProps.customMethods = [\n {\n id: 'custom-sigv4',\n label: 'SigV4 auth',\n description: 'AWS Signature Version 4 authentication',\n component: <SIGV4ConnectionConfig inExperimentalAuthComponent={true} {...props} />,\n },\n ];\n authProps.selectedMethod = options.jsonData.sigV4Auth ? 'custom-sigv4' : authProps.selectedMethod;\n }\n\n return (\n <>\n {options.access === 'direct' && (\n <Alert title=\"Error\" severity=\"error\">\n Browser access mode in the Elasticsearch datasource is no longer available. Switch to server access mode.\n </Alert>\n )}\n <DataSourceDescription\n dataSourceName=\"Elasticsearch\"\n docsLink=\"https://grafana.com/docs/grafana/latest/datasources/elasticsearch\"\n hasRequiredFields={false}\n />\n <Divider spacing={4} />\n <ConnectionSettings config={options} onChange={onOptionsChange} urlPlaceholder=\"http://localhost:9200\" />\n <Divider spacing={4} />\n <Auth\n {...authProps}\n onAuthMethodSelect={(method) => {\n onOptionsChange({\n ...options,\n basicAuth: method === AuthMethod.BasicAuth,\n withCredentials: method === AuthMethod.CrossSiteCredentials,\n jsonData: {\n ...options.jsonData,\n sigV4Auth: method === 'custom-sigv4',\n oauthPassThru: method === AuthMethod.OAuthForward,\n },\n });\n }}\n />\n <Divider spacing={4} />\n <ConfigSection\n title=\"Additional settings\"\n description=\"Additional settings are optional settings that can be configured for more control over your data source.\"\n isCollapsible={true}\n isInitiallyOpen\n >\n <Stack gap={5} direction=\"column\">\n <AdvancedHttpSettings config={options} onChange={onOptionsChange} />\n {config.secureSocksDSProxyEnabled && (\n <SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />\n )}\n <ElasticDetails value={options} onChange={onOptionsChange} />\n <LogsConfig\n value={options.jsonData}\n onChange={(newValue) =>\n onOptionsChange({\n ...options,\n jsonData: newValue,\n })\n }\n />\n <DataLinks\n value={options.jsonData.dataLinks}\n onChange={(newValue) => {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n dataLinks: newValue,\n },\n });\n }}\n />\n </Stack>\n </ConfigSection>\n </>\n );\n};\n","import { toUtc, dateTime, DateTime, DurationUnit } from '@grafana/data';\n\nimport { Interval } from './types';\n\ntype IntervalMap = Record<\n Interval,\n {\n startOf: DurationUnit;\n amount: DurationUnit;\n }\n>;\n\nexport const intervalMap: IntervalMap = {\n Hourly: { startOf: 'hour', amount: 'hours' },\n Daily: { startOf: 'day', amount: 'days' },\n Weekly: { startOf: 'isoWeek', amount: 'weeks' },\n Monthly: { startOf: 'month', amount: 'months' },\n Yearly: { startOf: 'year', amount: 'years' },\n};\n\nexport class IndexPattern {\n private dateLocale = 'en';\n\n constructor(\n private pattern: string,\n private interval?: keyof typeof intervalMap\n ) {}\n\n getIndexForToday() {\n if (this.interval) {\n return toUtc().locale(this.dateLocale).format(this.pattern);\n } else {\n return this.pattern;\n }\n }\n\n getIndexList(from?: DateTime, to?: DateTime) {\n // When no `from` or `to` is provided, we request data from 7 subsequent/previous indices\n // for the provided index pattern.\n // This is useful when requesting log context where the only time data we have is the log\n // timestamp.\n // TODO: Remove when enableBackendMigration toggle is removed\n const indexOffset = 7;\n if (!this.interval) {\n return this.pattern;\n }\n\n const intervalInfo = intervalMap[this.interval];\n const start = dateTime(from || dateTime(to).add(-indexOffset, intervalInfo.amount))\n .utc()\n .startOf(intervalInfo.startOf);\n const endEpoch = dateTime(to || dateTime(from).add(indexOffset, intervalInfo.amount))\n .utc()\n .startOf(intervalInfo.startOf)\n .valueOf();\n const indexList = [];\n\n while (start.valueOf() <= endEpoch) {\n indexList.push(start.locale(this.dateLocale).format(this.pattern));\n start.add(1, intervalInfo.amount);\n }\n\n return indexList;\n }\n}\n","import { AbstractLabelOperator, AbstractLabelMatcher, LanguageProvider, AbstractQuery } from '@grafana/data';\n\nimport { ElasticDatasource } from './datasource';\nimport { ElasticsearchQuery } from './types';\n\nexport default class ElasticsearchLanguageProvider extends LanguageProvider {\n declare request: (url: string, params?: any) => Promise<any>;\n declare start: () => Promise<any[]>;\n datasource: ElasticDatasource;\n\n constructor(datasource: ElasticDatasource, initialValues?: any) {\n super();\n this.datasource = datasource;\n\n Object.assign(this, initialValues);\n }\n\n /**\n * Queries are transformed to an ES Logs query since it's the behaviour most users expect.\n **/\n importFromAbstractQuery(abstractQuery: AbstractQuery): ElasticsearchQuery {\n return {\n metrics: [\n {\n id: '1',\n type: 'logs',\n },\n ],\n query: this.getElasticsearchQuery(abstractQuery.labelMatchers),\n refId: abstractQuery.refId,\n };\n }\n\n getElasticsearchQuery(labels: AbstractLabelMatcher[]): string {\n return labels\n .map((label) => {\n switch (label.operator) {\n case AbstractLabelOperator.Equal: {\n return label.name + ':\"' + label.value + '\"';\n }\n case AbstractLabelOperator.NotEqual: {\n return '-' + label.name + ':\"' + label.value + '\"';\n }\n case AbstractLabelOperator.EqualRegEx: {\n return label.name + ':/' + label.value + '/';\n }\n case AbstractLabelOperator.NotEqualRegEx: {\n return '-' + label.name + ':/' + label.value + '/';\n }\n }\n })\n .join(' AND ');\n }\n}\n","import { clone, filter, find, identity, isArray, keys, map, uniq, values as _values } from 'lodash';\n\nimport {\n DataQueryResponse,\n DataFrame,\n toDataFrame,\n FieldType,\n MutableDataFrame,\n PreferredVisualisationType,\n} from '@grafana/data';\nimport { convertFieldType } from '@grafana/data/src/transformations/transformers/convertFieldType';\nimport TableModel from 'app/core/TableModel';\n\nimport { isMetricAggregationWithField } from './components/QueryEditor/MetricAggregationsEditor/aggregations';\nimport { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils';\nimport * as queryDef from './queryDef';\nimport { ElasticsearchAggregation, ElasticsearchQuery, TopMetrics, ExtendedStatMetaType } from './types';\nimport { describeMetric, flattenObject, getScriptValue } from './utils';\n\nconst HIGHLIGHT_TAGS_EXP = `${queryDef.highlightTags.pre}([^@]+)${queryDef.highlightTags.post}`;\ntype TopMetricMetric = Record<string, number>;\ninterface TopMetricBucket {\n top: Array<{\n metrics: TopMetricMetric;\n }>;\n}\n\nexport class ElasticResponse {\n constructor(\n private targets: ElasticsearchQuery[],\n private response: any\n ) {\n this.targets = targets;\n this.response = response;\n }\n\n processMetrics(esAgg: any, target: ElasticsearchQuery, seriesList: any, props: any) {\n let newSeries: any;\n\n for (let y = 0; y < target.metrics!.length; y++) {\n const metric = target.metrics![y];\n if (metric.hide) {\n continue;\n }\n\n switch (metric.type) {\n case 'count': {\n newSeries = { datapoints: [], metric: 'count', props, refId: target.refId };\n for (let i = 0; i < esAgg.buckets.length; i++) {\n const bucket = esAgg.buckets[i];\n const value = bucket.doc_count;\n newSeries.datapoints.push([value, bucket.key]);\n }\n seriesList.push(newSeries);\n break;\n }\n case 'percentiles': {\n if (esAgg.buckets.length === 0) {\n break;\n }\n\n const firstBucket = esAgg.buckets[0];\n const percentiles = firstBucket[metric.id].values;\n\n for (const percentileName in percentiles) {\n newSeries = {\n datapoints: [],\n metric: 'p' + percentileName,\n props: props,\n field: metric.field,\n refId: target.refId,\n };\n\n for (let i = 0; i < esAgg.buckets.length; i++) {\n const bucket = esAgg.buckets[i];\n const values = bucket[metric.id].values;\n newSeries.datapoints.push([values[percentileName], bucket.key]);\n }\n seriesList.push(newSeries);\n }\n\n break;\n }\n case 'extended_stats': {\n for (const statName in metric.meta) {\n if (!metric.meta[statName]) {\n continue;\n }\n\n newSeries = {\n datapoints: [],\n metric: statName,\n props: props,\n field: metric.field,\n refId: target.refId,\n };\n\n for (let i = 0; i < esAgg.buckets.length; i++) {\n const bucket = esAgg.buckets[i];\n const stats = bucket[metric.id];\n\n // add stats that are in nested obj to top level obj\n stats.std_deviation_bounds_upper = stats.std_deviation_bounds.upper;\n stats.std_deviation_bounds_lower = stats.std_deviation_bounds.lower;\n\n newSeries.datapoints.push([stats[statName], bucket.key]);\n }\n\n seriesList.push(newSeries);\n }\n\n break;\n }\n case 'top_metrics': {\n if (metric.settings?.metrics?.length) {\n for (const metricField of metric.settings?.metrics) {\n newSeries = {\n datapoints: [],\n metric: metric.type,\n props: props,\n refId: target.refId,\n field: metricField,\n };\n for (let i = 0; i < esAgg.buckets.length; i++) {\n const bucket = esAgg.buckets[i];\n const stats: TopMetricBucket = bucket[metric.id];\n const values = stats.top.map((hit) => {\n if (hit.metrics[metricField]) {\n return hit.metrics[metricField];\n }\n return null;\n });\n const point = [values[values.length - 1], bucket.key];\n newSeries.datapoints.push(point);\n }\n seriesList.push(newSeries);\n }\n }\n break;\n }\n default: {\n newSeries = {\n datapoints: [],\n metric: metric.type,\n metricId: metric.id,\n props: props,\n refId: target.refId,\n };\n\n if (isMetricAggregationWithField(metric)) {\n newSeries.field = metric.field;\n }\n\n for (let i = 0; i < esAgg.buckets.length; i++) {\n const bucket = esAgg.buckets[i];\n const value = bucket[metric.id];\n\n if (value !== undefined) {\n if (value.normalized_value) {\n newSeries.datapoints.push([value.normalized_value, bucket.key]);\n } else {\n newSeries.datapoints.push([value.value, bucket.key]);\n }\n }\n }\n seriesList.push(newSeries);\n break;\n }\n }\n }\n }\n\n processAggregationDocs(\n esAgg: any,\n aggDef: ElasticsearchAggregation,\n target: ElasticsearchQuery,\n table: any,\n props: any\n ) {\n // add columns\n if (table.columns.length === 0) {\n for (const propKey of keys(props)) {\n table.addColumn({ text: propKey, filterable: true });\n }\n table.addColumn({ text: aggDef.field, filterable: true });\n }\n\n // helper func to add values to value array\n const addMetricValue = (values: any[], metricName: string, value: any) => {\n table.addColumn({ text: metricName });\n values.push(value);\n };\n const buckets = isArray(esAgg.buckets) ? esAgg.buckets : [esAgg.buckets];\n for (const bucket of buckets) {\n const values = [];\n\n for (const propValues of _values(props)) {\n values.push(propValues);\n }\n\n // add bucket key (value)\n values.push(bucket.key);\n\n for (const metric of target.metrics || []) {\n switch (metric.type) {\n case 'count': {\n addMetricValue(values, this.getMetricName(metric.type), bucket.doc_count);\n break;\n }\n case 'extended_stats': {\n for (const statName in metric.meta) {\n if (!metric.meta[statName]) {\n continue;\n }\n\n const stats = bucket[metric.id];\n // add stats that are in nested obj to top level obj\n stats.std_deviation_bounds_upper = stats.std_deviation_bounds.upper;\n stats.std_deviation_bounds_lower = stats.std_deviation_bounds.lower;\n\n addMetricValue(values, this.getMetricName(statName as ExtendedStatMetaType), stats[statName]);\n }\n break;\n }\n case 'percentiles': {\n const percentiles = bucket[metric.id].values;\n\n for (const percentileName in percentiles) {\n addMetricValue(values, `p${percentileName} ${metric.field}`, percentiles[percentileName]);\n }\n break;\n }\n case 'top_metrics': {\n const baseName = this.getMetricName(metric.type);\n\n if (metric.settings?.metrics) {\n for (const metricField of metric.settings.metrics) {\n // If we selected more than one metric we also add each metric name\n const metricName = metric.settings.metrics.length > 1 ? `${baseName} ${metricField}` : baseName;\n\n const stats: TopMetricBucket = bucket[metric.id];\n\n // Size of top_metrics is fixed to 1.\n addMetricValue(values, metricName, stats.top[0].metrics[metricField]);\n }\n }\n\n break;\n }\n default: {\n let metricName = this.getMetricName(metric.type);\n const otherMetrics = filter(target.metrics, { type: metric.type });\n\n // if more of the same metric type include field field name in property\n if (otherMetrics.length > 1) {\n if (isMetricAggregationWithField(metric)) {\n metricName += ' ' + metric.field;\n }\n\n if (metric.type === 'bucket_script') {\n //Use the formula in the column name\n metricName = getScriptValue(metric);\n }\n }\n\n addMetricValue(values, metricName, bucket[metric.id].value);\n break;\n }\n }\n }\n\n table.rows.push(values);\n }\n }\n\n // This is quite complex\n // need to recurse down the nested buckets to build series\n processBuckets(aggs: any, target: ElasticsearchQuery, seriesList: any, table: TableModel, props: any, depth: number) {\n let bucket, aggDef: any, esAgg, aggId;\n const maxDepth = target.bucketAggs!.length - 1;\n\n for (aggId in aggs) {\n aggDef = find(target.bucketAggs, { id: aggId });\n esAgg = aggs[aggId];\n\n if (!aggDef) {\n continue;\n }\n\n if (aggDef.type === 'nested') {\n this.processBuckets(esAgg, target, seriesList, table, props, depth + 1);\n continue;\n }\n\n if (depth === maxDepth) {\n if (aggDef.type === 'date_histogram') {\n this.processMetrics(esAgg, target, seriesList, props);\n } else {\n this.processAggregationDocs(esAgg, aggDef, target, table, props);\n }\n } else {\n for (const nameIndex in esAgg.buckets) {\n bucket = esAgg.buckets[nameIndex];\n props = clone(props);\n if (bucket.key !== void 0) {\n props[aggDef.field] = bucket.key;\n } else {\n props['filter'] = nameIndex;\n }\n if (bucket.key_as_string) {\n props[aggDef.field] = bucket.key_as_string;\n }\n this.processBuckets(bucket, target, seriesList, table, props, depth + 1);\n }\n }\n }\n }\n\n private getMetricName(metric: string): string {\n const metricDef = Object.entries(metricAggregationConfig)\n .filter(([key]) => key === metric)\n .map(([_, value]) => value)[0];\n\n if (metricDef) {\n return metricDef.label;\n }\n\n const extendedStat = queryDef.extendedStats.find((e) => e.value === metric);\n if (extendedStat) {\n return extendedStat.label;\n }\n\n return metric;\n }\n\n private getSeriesName(series: any, target: ElasticsearchQuery, dedup: boolean) {\n let metricName = this.getMetricName(series.metric);\n\n if (target.alias) {\n const regex = /\\{\\{([\\s\\S]+?)\\}\\}/g;\n\n return target.alias.replace(regex, (match, g1, g2) => {\n const group = g1 || g2;\n\n if (group.indexOf('term ') === 0) {\n return series.props[group.substring(5)];\n }\n if (series.props[group] !== void 0) {\n return series.props[group];\n }\n if (group === 'metric') {\n return metricName;\n }\n if (group === 'field') {\n return series.field || '';\n }\n\n return match;\n });\n }\n\n if (queryDef.isPipelineAgg(series.metric)) {\n if (series.metric && queryDef.isPipelineAggWithMultipleBucketPaths(series.metric)) {\n const agg: any = find(target.metrics, { id: series.metricId });\n if (agg && agg.settings.script) {\n metricName = getScriptValue(agg);\n\n for (const pv of agg.pipelineVariables) {\n const appliedAgg = find(target.metrics, { id: pv.pipelineAgg });\n if (appliedAgg) {\n metricName = metricName.replace('params.' + pv.name, describeMetric(appliedAgg));\n }\n }\n } else {\n metricName = 'Unset';\n }\n } else {\n const appliedAgg = find(target.metrics, { id: series.field });\n if (appliedAgg) {\n metricName += ' ' + describeMetric(appliedAgg);\n } else {\n metricName = 'Unset';\n }\n }\n } else if (series.field) {\n metricName += ' ' + series.field;\n }\n\n const propKeys = keys(series.props);\n if (propKeys.length === 0) {\n return metricName;\n }\n\n let name = '';\n for (const propName in series.props) {\n name += series.props[propName] + ' ';\n }\n\n if (dedup) {\n return name.trim() + ' ' + metricName;\n }\n\n return name.trim();\n }\n\n nameSeries(seriesList: any, target: ElasticsearchQuery) {\n const metricTypeCount = uniq(map(seriesList, 'metric')).length;\n const hasTopMetricWithMultipleMetrics = (\n target.metrics?.filter((m) => m.type === 'top_metrics') as TopMetrics[]\n ).some((m) => (m?.settings?.metrics?.length || 0) > 1);\n\n for (let i = 0; i < seriesList.length; i++) {\n const series = seriesList[i];\n series.target = this.getSeriesName(series, target, metricTypeCount > 1 || hasTopMetricWithMultipleMetrics);\n }\n }\n\n processHits(hits: { total: { value: any }; hits: any[] }, seriesList: any[], target: ElasticsearchQuery) {\n const hitsTotal = typeof hits.total === 'number' ? hits.total : hits.total.value; // <- Works with Elasticsearch 7.0+\n\n const series: any = {\n target: target.refId,\n type: 'docs',\n refId: target.refId,\n datapoints: [],\n total: hitsTotal,\n filterable: true,\n };\n let propName, hit, doc: any, i;\n\n for (i = 0; i < hits.hits.length; i++) {\n hit = hits.hits[i];\n doc = {\n _id: hit._id,\n _type: hit._type,\n _index: hit._index,\n sort: hit.sort,\n highlight: hit.highlight,\n };\n\n if (hit._source) {\n for (propName in hit._source) {\n doc[propName] = hit._source[propName];\n }\n }\n\n for (propName in hit.fields) {\n doc[propName] = hit.fields[propName];\n }\n series.datapoints.push(doc);\n }\n\n seriesList.push(series);\n }\n\n trimDatapoints(aggregations: any, target: ElasticsearchQuery) {\n const histogram: any = find(target.bucketAggs, { type: 'date_histogram' });\n\n const shouldDropFirstAndLast = histogram && histogram.settings && histogram.settings.trimEdges;\n if (shouldDropFirstAndLast) {\n const trim = histogram.settings.trimEdges;\n for (const prop in aggregations) {\n const points = aggregations[prop];\n if (points.datapoints.length > trim * 2) {\n points.datapoints = points.datapoints.slice(trim, points.datapoints.length - trim);\n }\n }\n }\n }\n\n getErrorFromElasticResponse(response: any, err: any) {\n const result: any = {};\n result.data = JSON.stringify(err, null, 4);\n if (err.root_cause && err.root_cause.length > 0 && err.root_cause[0].reason) {\n result.message = err.root_cause[0].reason;\n } else {\n result.message = err.reason || 'Unknown elastic error response';\n }\n\n if (response.$$config) {\n result.config = response.$$config;\n }\n\n return result;\n }\n\n getTimeSeries() {\n if (this.targets.some((target) => queryDef.hasMetricOfType(target, 'raw_data'))) {\n return this.processResponseToDataFrames(false);\n }\n const result = this.processResponseToSeries();\n return {\n ...result,\n data: result.data.map((item) => toDataFrame(item)),\n };\n }\n\n getLogs(logMessageField?: string, logLevelField?: string): DataQueryResponse {\n return this.processResponseToDataFrames(true, logMessageField, logLevelField);\n }\n\n private processResponseToDataFrames(\n isLogsRequest: boolean,\n logMessageField?: string,\n logLevelField?: string\n ): DataQueryResponse {\n const dataFrame: DataFrame[] = [];\n for (let n = 0; n < this.response.responses.length; n++) {\n const response = this.response.responses[n];\n if (response.error) {\n throw this.getErrorFromElasticResponse(this.response, response.error);\n }\n\n if (response.hits) {\n const { propNames, docs } = flattenHits(response.hits.hits);\n\n const series = docs.length\n ? createEmptyDataFrame(\n propNames.map(toNameTypePair(docs)),\n isLogsRequest,\n this.targets[0].timeField,\n logMessageField,\n logLevelField\n )\n : createEmptyDataFrame([], isLogsRequest);\n\n if (isLogsRequest) {\n addPreferredVisualisationType(series, 'logs');\n }\n\n // Add a row for each document\n for (const doc of docs) {\n if (logLevelField) {\n // Remap level field based on the datasource config. This field is\n // then used in explore to figure out the log level. We may rewrite\n // some actual data in the level field if they are different.\n doc['level'] = doc[logLevelField];\n }\n // When highlighting exists, we need to collect all the highlighted\n // phrases and add them to the DataFrame's meta.searchWords array.\n if (doc.highlight) {\n // There might be multiple words so we need two versions of the\n // regular expression. One to match gobally, when used with part.match,\n // it returns and array of matches. The second one is used to capture the\n // values between the tags.\n const globalHighlightWordRegex = new RegExp(HIGHLIGHT_TAGS_EXP, 'g');\n const highlightWordRegex = new RegExp(HIGHLIGHT_TAGS_EXP);\n const newSearchWords = Object.keys(doc.highlight)\n .flatMap((key) => {\n return doc.highlight[key].flatMap((line: string) => {\n const matchedPhrases = line.match(globalHighlightWordRegex);\n if (!matchedPhrases) {\n return [];\n }\n return matchedPhrases.map((part) => {\n const matches = part.match(highlightWordRegex);\n return (matches && matches[1]) || null;\n });\n });\n })\n .filter(identity);\n // If meta and searchWords already exists, add the words and\n // deduplicate otherwise create a new set of search words.\n const searchWords = series.meta?.searchWords\n ? uniq([...series.meta.searchWords, ...newSearchWords])\n : [...newSearchWords];\n series.meta = series.meta ? { ...series.meta, searchWords } : { searchWords };\n }\n series.add(doc);\n }\n\n const target = this.targets[n];\n series.refId = target.refId;\n dataFrame.push(series);\n }\n\n if (response.aggregations) {\n const aggregations = response.aggregations;\n const target = this.targets[n];\n const tmpSeriesList: any[] = [];\n const table = new TableModel();\n\n this.processBuckets(aggregations, target, tmpSeriesList, table, {}, 0);\n this.trimDatapoints(tmpSeriesList, target);\n this.nameSeries(tmpSeriesList, target);\n\n if (table.rows.length > 0) {\n const series = toDataFrame(table);\n series.refId = target.refId;\n dataFrame.push(series);\n }\n\n for (let y = 0; y < tmpSeriesList.length; y++) {\n let series = toDataFrame(tmpSeriesList[y]);\n\n // When log results, show aggregations only in graph. Log fields are then going to be shown in table.\n if (isLogsRequest) {\n addPreferredVisualisationType(series, 'graph');\n }\n\n series.refId = target.refId;\n dataFrame.push(series);\n }\n }\n }\n\n for (let frame of dataFrame) {\n for (let field of frame.fields) {\n if (field.type === FieldType.time && typeof field.values[0] !== 'number') {\n field.values = convertFieldType(field, { destinationType: FieldType.time }).values;\n }\n }\n }\n\n return { data: dataFrame };\n }\n\n processResponseToSeries = () => {\n const seriesList = [];\n\n for (let i = 0; i < this.response.responses.length; i++) {\n const response = this.response.responses[i];\n const target = this.targets[i];\n\n if (response.error) {\n throw this.getErrorFromElasticResponse(this.response, response.error);\n }\n\n if (response.hits && response.hits.hits.length > 0) {\n this.processHits(response.hits, seriesList, target);\n }\n\n if (response.aggregations) {\n const aggregations = response.aggregations;\n const target = this.targets[i];\n const tmpSeriesList: any[] = [];\n const table = new TableModel();\n table.refId = target.refId;\n\n this.processBuckets(aggregations, target, tmpSeriesList, table, {}, 0);\n this.trimDatapoints(tmpSeriesList, target);\n this.nameSeries(tmpSeriesList, target);\n\n for (let y = 0; y < tmpSeriesList.length; y++) {\n seriesList.push(tmpSeriesList[y]);\n }\n\n if (table.rows.length > 0) {\n seriesList.push(table);\n }\n }\n }\n\n return { data: seriesList };\n };\n}\n\ntype Doc = {\n _id: string;\n _type: string;\n _index: string;\n _source?: any;\n sort?: Array<string | number>;\n highlight?: Record<string, string[]>;\n};\n\n/**\n * Flatten the docs from response mainly the _source part which can be nested. This flattens it so that it is one level\n * deep and the keys are: `level1Name.level2Name...`. Also returns list of all properties from all the docs (not all\n * docs have to have the same keys).\n * @param hits\n */\nconst flattenHits = (hits: Doc[]): { docs: Array<Record<string, any>>; propNames: string[] } => {\n const docs: any[] = [];\n // We keep a list of all props so that we can create all the fields in the dataFrame, this can lead\n // to wide sparse dataframes in case the scheme is different per document.\n let propNames: string[] = [];\n\n for (const hit of hits) {\n const flattened = hit._source ? flattenObject(hit._source) : {};\n const doc = {\n _id: hit._id,\n _type: hit._type,\n _index: hit._index,\n sort: hit.sort,\n highlight: hit.highlight,\n _source: { ...flattened },\n ...flattened,\n };\n\n for (const propName of Object.keys(doc)) {\n if (propNames.indexOf(propName) === -1) {\n propNames.push(propName);\n }\n }\n\n docs.push(doc);\n }\n\n propNames.sort();\n return { docs, propNames };\n};\n\n/**\n * Create empty dataframe but with created fields. Fields are based from propNames (should be from the response) and\n * also from configuration specified fields for message, time, and level.\n * @param propNames\n * @param timeField\n * @param logMessageField\n * @param logLevelField\n */\nconst createEmptyDataFrame = (\n props: Array<[string, FieldType]>,\n isLogsRequest: boolean,\n timeField?: string,\n logMessageField?: string,\n logLevelField?: string\n): MutableDataFrame => {\n const series = new MutableDataFrame({ fields: [] });\n\n if (timeField) {\n series.addField({\n config: {\n filterable: true,\n },\n name: timeField,\n type: FieldType.time,\n });\n }\n\n if (logMessageField) {\n const f = series.addField({\n name: logMessageField,\n type: FieldType.string,\n });\n series.setParser(f, (v) => {\n return v || '';\n });\n }\n\n if (logLevelField) {\n const f = series.addField({\n name: 'level',\n type: FieldType.string,\n });\n series.setParser(f, (v) => {\n return v || '';\n });\n }\n\n const fieldNames = series.fields.map((field) => field.name);\n\n for (const [name, type] of props) {\n // Do not duplicate fields. This can mean that we will shadow some fields.\n if (fieldNames.includes(name)) {\n continue;\n }\n // Do not add _source field (besides logs) as we are showing each _source field in table instead.\n if (!isLogsRequest && name === '_source') {\n continue;\n }\n\n const f = series.addField({\n config: {\n filterable: true,\n },\n name,\n type,\n });\n series.setParser(f, (v) => {\n return v || '';\n });\n }\n\n return series;\n};\n\nconst addPreferredVisualisationType = (series: DataFrame, type: PreferredVisualisationType) => {\n let s = series;\n s.meta\n ? (s.meta.preferredVisualisationType = type)\n : (s.meta = {\n preferredVisualisationType: type,\n });\n};\n\nconst toNameTypePair =\n (docs: Array<Record<string, unknown>>) =>\n (propName: string): [string, FieldType] => [\n propName,\n guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName]),\n ];\n\n/**\n * Trying to guess data type from its value. This is far from perfect, as in order to have accurate guess\n * we should have access to the elasticsearch mapping, but it covers the most common use cases for numbers, strings & arrays.\n */\nconst guessType = (value: unknown): FieldType => {\n switch (typeof value) {\n case 'number':\n return FieldType.number;\n case 'string':\n return FieldType.string;\n default:\n return FieldType.other;\n }\n};\n","import { CoreApp, DashboardLoadedEvent, DataQueryRequest, DataQueryResponse } from '@grafana/data';\nimport { config, reportInteraction } from '@grafana/runtime';\n\nimport { REF_ID_STARTER_LOG_VOLUME } from './datasource';\nimport pluginJson from './plugin.json';\nimport { ElasticsearchAnnotationQuery, ElasticsearchQuery } from './types';\nimport { variableRegex } from './utils';\n\ntype ElasticSearchOnDashboardLoadedTrackingEvent = {\n grafana_version?: string;\n dashboard_id?: string;\n org_id?: number;\n\n /* The number of Elasticsearch queries present in the dashboard*/\n queries_count: number;\n\n /* The number of Elasticsearch logs queries present in the dashboard*/\n logs_queries_count: number;\n\n /* The number of Elasticsearch metric queries present in the dashboard*/\n metric_queries_count: number;\n\n /* The number of Elasticsearch raw data queries present in the dashboard*/\n raw_data_queries_count: number;\n\n /* The number of Elasticsearch raw documents queries present in the dashboard*/\n raw_document_queries_count: number;\n\n /* The number of Elasticsearch queries with used template variables present in the dashboard*/\n queries_with_template_variables_count: number;\n\n /* The number of Elasticsearch queries with changed line limit present in the dashboard*/\n queries_with_changed_line_limit_count: number;\n\n /* The number of Elasticsearch queries with lucene query present in the dashboard*/\n queries_with_lucene_query_count: number;\n};\n\nexport const onDashboardLoadedHandler = ({\n payload: { dashboardId, orgId, grafanaVersion, queries },\n}: DashboardLoadedEvent<ElasticsearchQuery>) => {\n try {\n // We only want to track visible ElasticSearch queries\n const elasticsearchQueries = queries[pluginJson.id]?.filter((query) => !query.hide);\n if (!elasticsearchQueries?.length) {\n return;\n }\n\n const queriesWithTemplateVariables = elasticsearchQueries.filter(isQueryWithTemplateVariables);\n const queriesWithLuceneQuery = elasticsearchQueries.filter((query) => !!query.query);\n const logsQueries = elasticsearchQueries.filter((query) => getQueryType(query) === 'logs');\n const metricQueries = elasticsearchQueries.filter((query) => getQueryType(query) === 'metric');\n const rawDataQueries = elasticsearchQueries.filter((query) => getQueryType(query) === 'raw_data');\n const rawDocumentQueries = elasticsearchQueries.filter((query) => getQueryType(query) === 'raw_document');\n const queriesWithChangedLineLimit = elasticsearchQueries.filter(isQueryWithChangedLineLimit);\n\n const event: ElasticSearchOnDashboardLoadedTrackingEvent = {\n grafana_version: grafanaVersion,\n dashboard_id: dashboardId,\n org_id: orgId,\n queries_count: elasticsearchQueries.length,\n logs_queries_count: logsQueries.length,\n metric_queries_count: metricQueries.length,\n raw_data_queries_count: rawDataQueries.length,\n raw_document_queries_count: rawDocumentQueries.length,\n queries_with_template_variables_count: queriesWithTemplateVariables.length,\n queries_with_changed_line_limit_count: queriesWithChangedLineLimit.length,\n queries_with_lucene_query_count: queriesWithLuceneQuery.length,\n };\n\n reportInteraction('grafana_elasticsearch_dashboard_loaded', event);\n } catch (error) {\n console.error('error in elasticsearch tracking handler', error);\n }\n};\n\nconst getQueryType = (query: ElasticsearchQuery): string | undefined => {\n if (!query.metrics || !query.metrics.length) {\n return undefined;\n }\n const nonMetricQueryTypes = ['logs', 'raw_data', 'raw_document'];\n if (nonMetricQueryTypes.includes(query.metrics[0].type)) {\n return query.metrics[0].type;\n }\n return 'metric';\n};\n\nconst getLineLimit = (query: ElasticsearchQuery): number | undefined => {\n if (query.metrics?.[0]?.type !== 'logs') {\n return undefined;\n }\n\n const lineLimit = query.metrics?.[0].settings?.limit;\n return lineLimit ? parseInt(lineLimit, 10) : undefined;\n};\n\nconst isQueryWithChangedLineLimit = (query: ElasticsearchQuery): boolean => {\n const lineLimit = getLineLimit(query);\n return lineLimit !== undefined && lineLimit !== 500;\n};\n\nconst isQueryWithTemplateVariables = (query: ElasticsearchQuery): boolean => {\n return variableRegex.test(query.query ?? '');\n};\n\nconst shouldNotReportBasedOnRefId = (refId: string): boolean => {\n if (refId.startsWith(REF_ID_STARTER_LOG_VOLUME)) {\n return true;\n }\n return false;\n};\n\nexport function trackQuery(\n response: DataQueryResponse,\n request: DataQueryRequest<ElasticsearchQuery> & { targets: ElasticsearchQuery[] },\n startTime: Date\n): void {\n const { targets: queries, app } = request;\n if (app === CoreApp.Dashboard || app === CoreApp.PanelViewer) {\n return;\n }\n\n for (const query of queries) {\n if (shouldNotReportBasedOnRefId(query.refId)) {\n return;\n }\n reportInteraction('grafana_elasticsearch_query_executed', {\n app,\n grafana_version: config.buildInfo.version,\n with_lucene_query: query.query ? true : false,\n query_type: getQueryType(query),\n line_limit: getLineLimit(query),\n alias: query.alias,\n has_error: response.error !== undefined,\n has_data: response.data.some((frame) => frame.length > 0),\n simultaneously_sent_query_count: queries.length,\n time_range_from: request?.range?.from?.toISOString(),\n time_range_to: request?.range?.to?.toISOString(),\n time_taken: Date.now() - startTime.getTime(),\n });\n }\n}\n\nexport function trackAnnotationQuery(annotation: ElasticsearchAnnotationQuery): void {\n reportInteraction('grafana_elasticsearch_annotation_query_executed', {\n grafana_version: config.buildInfo.version,\n has_target_query: !!annotation.target?.query,\n has_query: !!annotation.query,\n has_time_field: !!annotation.timeField,\n has_time_end_field: !!annotation.timeEndField,\n has_tags_field: !!annotation.tagsField,\n has_text_field: !!annotation.textField,\n has_index: !!annotation.index,\n });\n}\n","import { first as _first, cloneDeep } from 'lodash';\nimport { lastValueFrom, Observable, of, throwError } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\n\nimport {\n DataFrame,\n DataQueryRequest,\n DataQueryResponse,\n dateTime,\n ensureTimeField,\n Field,\n LogRowContextOptions,\n LogRowContextQueryDirection,\n LogRowModel,\n} from '@grafana/data';\nimport { BackendSrvRequest, getBackendSrv, TemplateSrv } from '@grafana/runtime';\n\nimport { ElasticResponse } from './ElasticResponse';\nimport { ElasticDatasource, enhanceDataFrameWithDataLinks } from './datasource';\nimport { defaultBucketAgg, hasMetricOfType } from './queryDef';\nimport { trackQuery } from './tracking';\nimport { DataLinkConfig, ElasticsearchQuery, Logs } from './types';\n\nexport class LegacyQueryRunner {\n datasource: ElasticDatasource;\n templateSrv: TemplateSrv;\n\n constructor(datasource: ElasticDatasource, templateSrv: TemplateSrv) {\n this.datasource = datasource;\n this.templateSrv = templateSrv;\n }\n\n request(\n method: string,\n url: string,\n data?: BackendSrvRequest['data'],\n headers?: BackendSrvRequest['headers']\n ): Observable<any> {\n if (!this.datasource.isProxyAccess) {\n const error = new Error(\n 'Browser access mode in the Elasticsearch datasource is no longer available. Switch to server access mode.'\n );\n return throwError(() => error);\n }\n\n const options: BackendSrvRequest = {\n url: this.datasource.url + '/' + url,\n method,\n data,\n headers,\n };\n\n if (method === 'POST') {\n options.headers = options.headers ?? {};\n options.headers['Content-Type'] = 'application/x-ndjson';\n }\n\n if (this.datasource.basicAuth || this.datasource.withCredentials) {\n options.withCredentials = true;\n }\n if (this.datasource.basicAuth) {\n options.headers = {\n Authorization: this.datasource.basicAuth,\n };\n }\n\n return getBackendSrv()\n .fetch<any>(options)\n .pipe(\n map((results) => {\n results.data.$$config = results.config;\n return results.data;\n }),\n catchError((err) => {\n if (err.data) {\n const message = err.data.error?.reason ?? err.data.message ?? 'Unknown error';\n\n return throwError({\n message,\n error: err.data.error,\n });\n }\n\n return throwError(err);\n })\n );\n }\n\n async logContextQuery(row: LogRowModel, options?: LogRowContextOptions): Promise<{ data: DataFrame[] }> {\n const sortField = row.dataFrame.fields.find((f) => f.name === 'sort');\n const searchAfter = sortField?.values[row.rowIndex] || [row.timeEpochMs];\n const sort = options?.direction === LogRowContextQueryDirection.Forward ? 'asc' : 'desc';\n\n const header =\n options?.direction === LogRowContextQueryDirection.Forward\n ? this.datasource.getQueryHeader('query_then_fetch', dateTime(row.timeEpochMs))\n : this.datasource.getQueryHeader('query_then_fetch', undefined, dateTime(row.timeEpochMs));\n\n const limit = options?.limit ?? 10;\n const esQuery = JSON.stringify({\n size: limit,\n query: {\n bool: {\n filter: [\n {\n range: {\n [this.datasource.timeField]: {\n [options?.direction === LogRowContextQueryDirection.Forward ? 'gte' : 'lte']: row.timeEpochMs,\n format: 'epoch_millis',\n },\n },\n },\n ],\n },\n },\n sort: [{ [this.datasource.timeField]: sort }, { _doc: sort }],\n search_after: searchAfter,\n });\n const payload = [header, esQuery].join('\\n') + '\\n';\n const url = this.datasource.getMultiSearchUrl();\n const response = await lastValueFrom(this.request('POST', url, payload));\n const targets: ElasticsearchQuery[] = [{ refId: `${row.dataFrame.refId}`, metrics: [{ type: 'logs', id: '1' }] }];\n const elasticResponse = new ElasticResponse(targets, transformHitsBasedOnDirection(response, sort));\n const logResponse = elasticResponse.getLogs(this.datasource.logMessageField, this.datasource.logLevelField);\n const dataFrame = _first(logResponse.data);\n if (!dataFrame) {\n return { data: [] };\n }\n /**\n * The LogRowContext requires there is a field in the dataFrame.fields\n * named `ts` for timestamp and `line` for the actual log line to display.\n * Unfortunatly these fields are hardcoded and are required for the lines to\n * be properly displayed. This code just copies the fields based on this.timeField\n * and this.logMessageField and recreates the dataFrame so it works.\n */\n const timestampField = dataFrame.fields.find((f: Field) => f.name === this.datasource.timeField);\n const lineField = dataFrame.fields.find((f: Field) => f.name === this.datasource.logMessageField);\n const otherFields = dataFrame.fields.filter((f: Field) => f !== timestampField && f !== lineField);\n if (timestampField && lineField) {\n return {\n data: [\n {\n ...dataFrame,\n fields: [ensureTimeField(timestampField), lineField, ...otherFields],\n },\n ],\n };\n }\n return logResponse;\n }\n\n query(request: DataQueryRequest<ElasticsearchQuery>): Observable<DataQueryResponse> {\n let payload = '';\n const targets = this.datasource.interpolateVariablesInQueries(\n cloneDeep(request.targets),\n request.scopedVars,\n request.filters\n );\n const sentTargets: ElasticsearchQuery[] = [];\n let targetsContainsLogsQuery = targets.some((target) => hasMetricOfType(target, 'logs'));\n\n const logLimits: Array<number | undefined> = [];\n\n for (const target of targets) {\n if (target.hide) {\n continue;\n }\n\n let queryObj;\n if (hasMetricOfType(target, 'logs')) {\n // FIXME: All this logic here should be in the query builder.\n // When moving to the BE-only implementation we should remove this and let the BE\n // Handle this.\n // TODO: defaultBucketAgg creates a dete_histogram aggregation without a field, so it fallbacks to\n // the configured timeField. we should allow people to use a different time field here.\n target.bucketAggs = [defaultBucketAgg()];\n\n const log = target.metrics?.find((m) => m.type === 'logs') as Logs;\n const limit = log.settings?.limit ? parseInt(log.settings?.limit, 10) : 500;\n logLimits.push(limit);\n\n target.metrics = [];\n // Setting this for metrics queries that are typed as logs\n queryObj = this.datasource.queryBuilder.getLogsQuery(target, limit);\n } else {\n logLimits.push();\n if (target.alias) {\n target.alias = this.datasource.interpolateLuceneQuery(target.alias, request.scopedVars);\n }\n\n queryObj = this.datasource.queryBuilder.build(target);\n }\n\n const esQuery = JSON.stringify(queryObj);\n\n const searchType = 'query_then_fetch';\n const header = this.datasource.getQueryHeader(searchType, request.range.from, request.range.to);\n payload += header + '\\n';\n\n payload += esQuery + '\\n';\n\n sentTargets.push(target);\n }\n\n if (sentTargets.length === 0) {\n return of({ data: [] });\n }\n\n // We replace the range here for actual values. We need to replace it together with enclosing \"\" so that we replace\n // it as an integer not as string with digits. This is because elastic will convert the string only if the time\n // field is specified as type date (which probably should) but can also be specified as integer (millisecond epoch)\n // and then sending string will error out.\n payload = payload.replace(/\"\\$timeFrom\"/g, request.range.from.valueOf().toString());\n payload = payload.replace(/\"\\$timeTo\"/g, request.range.to.valueOf().toString());\n payload = this.templateSrv.replace(payload, request.scopedVars);\n\n const url = this.datasource.getMultiSearchUrl();\n\n const start = new Date();\n return this.request('POST', url, payload).pipe(\n map((res) => {\n const er = new ElasticResponse(sentTargets, res);\n\n // TODO: This needs to be revisited, it seems wrong to process ALL the sent queries as logs if only one of them was a log query\n if (targetsContainsLogsQuery) {\n const response = er.getLogs(this.datasource.logMessageField, this.datasource.logLevelField);\n\n response.data.forEach((dataFrame, index) => {\n enhanceDataFrame(dataFrame, this.datasource.dataLinks, logLimits[index]);\n });\n return response;\n }\n\n return er.getTimeSeries();\n }),\n tap((response) => trackQuery(response, request, start))\n );\n }\n}\n\nfunction transformHitsBasedOnDirection(response: any, direction: 'asc' | 'desc') {\n if (direction === 'desc') {\n return response;\n }\n const actualResponse = response.responses[0];\n return {\n ...response,\n responses: [\n {\n ...actualResponse,\n hits: {\n ...actualResponse.hits,\n hits: actualResponse.hits.hits.reverse(),\n },\n },\n ],\n };\n}\n\n/**\n * Modifies dataFrame and adds dataLinks from the config.\n * Exported for tests.\n */\nexport function enhanceDataFrame(dataFrame: DataFrame, dataLinks: DataLinkConfig[], limit?: number) {\n if (limit) {\n dataFrame.meta = {\n ...dataFrame.meta,\n limit,\n };\n }\n enhanceDataFrameWithDataLinks(dataFrame, dataLinks);\n}\n","import React from 'react';\n\nimport { AnnotationQuery } from '@grafana/data';\nimport { EditorField, EditorRow } from '@grafana/experimental';\nimport { Input, Stack } from '@grafana/ui';\n\nimport { ElasticsearchQuery } from '../../types';\n\nimport { ElasticQueryEditorProps, ElasticSearchQueryField } from './index';\n\ntype Props = ElasticQueryEditorProps & {\n annotation?: AnnotationQuery<ElasticsearchQuery>;\n onAnnotationChange?: (annotation: AnnotationQuery<ElasticsearchQuery>) => void;\n};\n\nexport function ElasticsearchAnnotationsQueryEditor(props: Props) {\n const annotation = props.annotation!;\n const onAnnotationChange = props.onAnnotationChange!;\n\n return (\n <Stack direction=\"column\" gap={5}>\n <div>\n <ElasticSearchQueryField\n value={annotation.target?.query}\n onChange={(query) => {\n const currentTarget = annotation.target ?? { refId: 'annotation_query' };\n const newTarget = {\n ...currentTarget,\n query,\n };\n\n onAnnotationChange({\n ...annotation,\n target: newTarget,\n });\n }}\n />\n </div>\n\n <div>\n <h6>Field mappings</h6>\n <EditorRow>\n <EditorField label=\"Time\">\n <Input\n type=\"text\"\n placeholder=\"@timestamp\"\n value={annotation.timeField}\n onChange={(e) => {\n onAnnotationChange({\n ...annotation,\n timeField: e.currentTarget.value,\n });\n }}\n />\n </EditorField>\n <EditorField label=\"Time End\">\n <Input\n type=\"text\"\n value={annotation.timeEndField}\n onChange={(e) => {\n onAnnotationChange({\n ...annotation,\n timeEndField: e.currentTarget.value,\n });\n }}\n />\n </EditorField>\n <EditorField label=\"Text\">\n <Input\n type=\"text\"\n value={annotation.textField}\n onChange={(e) => {\n onAnnotationChange({\n ...annotation,\n textField: e.currentTarget.value,\n });\n }}\n />\n </EditorField>\n <EditorField label=\"Tags\">\n <Input\n type=\"text\"\n placeholder=\"tags\"\n value={annotation.tagsField}\n onChange={(e) => {\n onAnnotationChange({\n ...annotation,\n tagsField: e.currentTarget.value,\n });\n }}\n />\n </EditorField>\n </EditorRow>\n </div>\n\n {/*Empty div to preserve the bottom margin */}\n <div />\n </Stack>\n );\n}\n","import { ExtendedStats, MetricAggregation } from './dataquery.gen';\n\nexport function isMetricAggregationWithMeta(metric: MetricAggregation): metric is ExtendedStats {\n if (!metric || typeof metric !== 'object') {\n return false;\n }\n return 'meta' in metric;\n}\n","import { isEqual } from 'lodash';\nimport lucene, { AST, BinaryAST, LeftOnlyAST, NodeTerm } from 'lucene';\n\nimport { AdHocVariableFilter } from '@grafana/data';\n\ntype ModifierType = '' | '-';\n\n/**\n * Checks for the presence of a given label:\"value\" filter in the query.\n */\nexport function queryHasFilter(query: string, key: string, value: string, modifier: ModifierType = ''): boolean {\n return findFilterNode(query, key, value, modifier) !== null;\n}\n\n/**\n * Given a query, find the NodeTerm that matches the given field and value.\n */\nexport function findFilterNode(\n query: string,\n key: string,\n value: string,\n modifier: ModifierType = ''\n): NodeTerm | null {\n const field = `${modifier}${lucene.term.escape(key)}`;\n value = lucene.phrase.escape(value);\n let ast: AST | null = parseQuery(query);\n if (!ast) {\n return null;\n }\n\n return findNodeInTree(ast, field, value);\n}\n\nfunction findNodeInTree(ast: AST, field: string, value: string): NodeTerm | null {\n // {}\n if (Object.keys(ast).length === 0) {\n return null;\n }\n // { left: {}, right: {} } or { left: {} }\n if (isAST(ast.left)) {\n return findNodeInTree(ast.left, field, value);\n }\n if (isNodeTerm(ast.left) && ast.left.field === field && ast.left.term === value) {\n return ast.left;\n }\n if (isLeftOnlyAST(ast)) {\n return null;\n }\n if (isNodeTerm(ast.right) && ast.right.field === field && ast.right.term === value) {\n return ast.right;\n }\n if (isBinaryAST(ast.right)) {\n return findNodeInTree(ast.right, field, value);\n }\n return null;\n}\n\n/**\n * Adds a label:\"value\" expression to the query.\n */\nexport function addFilterToQuery(query: string, key: string, value: string, modifier: ModifierType = ''): string {\n if (queryHasFilter(query, key, value, modifier)) {\n return query;\n }\n\n key = escapeFilter(key);\n value = escapeFilterValue(value);\n const filter = `${modifier}${key}:\"${value}\"`;\n\n return concatenate(query, filter);\n}\n\n/**\n * Merge a query with a filter.\n */\nfunction concatenate(query: string, filter: string, condition = 'AND'): string {\n if (!filter) {\n return query;\n }\n return query.trim() === '' ? filter : `${query} ${condition} ${filter}`;\n}\n\n/**\n * Adds a label:\"value\" expression to the query.\n */\nexport function addAddHocFilter(query: string, filter: AdHocVariableFilter): string {\n if (!filter.key || !filter.value) {\n return query;\n }\n\n filter = {\n ...filter,\n // Type is defined as string, but it can be a number.\n value: filter.value.toString(),\n };\n\n const equalityFilters = ['=', '!='];\n if (equalityFilters.includes(filter.operator)) {\n return addFilterToQuery(query, filter.key, filter.value, filter.operator === '=' ? '' : '-');\n }\n /**\n * Keys and values in ad hoc filters may contain characters such as\n * colons, which needs to be escaped.\n */\n const key = escapeFilter(filter.key);\n const value = escapeFilterValue(filter.value);\n let addHocFilter = '';\n switch (filter.operator) {\n case '=~':\n addHocFilter = `${key}:/${value}/`;\n break;\n case '!~':\n addHocFilter = `-${key}:/${value}/`;\n break;\n case '>':\n addHocFilter = `${key}:>${value}`;\n break;\n case '<':\n addHocFilter = `${key}:<${value}`;\n break;\n }\n return concatenate(query, addHocFilter);\n}\n\n/**\n * Removes a label:\"value\" expression from the query.\n */\nexport function removeFilterFromQuery(query: string, key: string, value: string, modifier: ModifierType = ''): string {\n const node = findFilterNode(query, key, value, modifier);\n const ast = parseQuery(query);\n if (!node || !ast) {\n return query;\n }\n\n return lucene.toString(removeNodeFromTree(ast, node));\n}\n\nfunction removeNodeFromTree(ast: AST, node: NodeTerm): AST {\n // {}\n if (Object.keys(ast).length === 0) {\n return ast;\n }\n // { left: {}, right: {} } or { left: {} }\n if (isAST(ast.left)) {\n ast.left = removeNodeFromTree(ast.left, node);\n return ast;\n }\n if (isNodeTerm(ast.left) && isEqual(ast.left, node)) {\n Object.assign(\n ast,\n {\n left: undefined,\n operator: undefined,\n right: undefined,\n },\n 'right' in ast ? ast.right : {}\n );\n return ast;\n }\n if (isLeftOnlyAST(ast)) {\n return ast;\n }\n if (isNodeTerm(ast.right) && isEqual(ast.right, node)) {\n Object.assign(ast, {\n right: undefined,\n operator: undefined,\n });\n return ast;\n }\n if (isBinaryAST(ast.right)) {\n ast.right = removeNodeFromTree(ast.right, node);\n return ast;\n }\n return ast;\n}\n\n/**\n * Filters can possibly reserved characters such as colons which are part of the Lucene syntax.\n * Use this function to escape filter keys.\n */\nexport function escapeFilter(value: string) {\n return lucene.term.escape(value);\n}\n\n/**\n * Values can possibly reserved special characters such as quotes.\n * Use this function to escape filter values.\n */\nexport function escapeFilterValue(value: string) {\n value = value.replace(/\\\\/g, '\\\\\\\\');\n return lucene.phrase.escape(value);\n}\n\n/**\n * Normalizes the query by removing whitespace around colons, which breaks parsing.\n */\nfunction normalizeQuery(query: string) {\n return query.replace(/(\\w+)\\s(:)/gi, '$1$2');\n}\n\nfunction isLeftOnlyAST(ast: unknown): ast is LeftOnlyAST {\n if (!ast || typeof ast !== 'object') {\n return false;\n }\n\n if ('left' in ast && !('right' in ast)) {\n return true;\n }\n\n return false;\n}\n\nfunction isBinaryAST(ast: unknown): ast is BinaryAST {\n if (!ast || typeof ast !== 'object') {\n return false;\n }\n\n if ('left' in ast && 'right' in ast) {\n return true;\n }\n return false;\n}\n\nfunction isAST(ast: unknown): ast is AST {\n return isLeftOnlyAST(ast) || isBinaryAST(ast);\n}\n\nfunction isNodeTerm(ast: unknown): ast is NodeTerm {\n if (ast && typeof ast === 'object' && 'term' in ast) {\n return true;\n }\n\n return false;\n}\n\nfunction parseQuery(query: string) {\n try {\n return lucene.parse(normalizeQuery(query));\n } catch (e) {\n return null;\n }\n}\n\nexport function addStringFilterToQuery(query: string, filter: string, contains = true) {\n const expression = `\"${escapeFilterValue(filter)}\"`;\n return query.trim() ? `${query} ${contains ? 'AND' : 'NOT'} ${expression}` : `${contains ? '' : 'NOT '}${expression}`;\n}\n","import { cloneDeep, find, first as _first, isNumber, isObject, isString, map as _map } from 'lodash';\nimport { from, generate, lastValueFrom, Observable, of } from 'rxjs';\nimport { catchError, first, map, mergeMap, skipWhile, throwIfEmpty, tap } from 'rxjs/operators';\nimport { SemVer } from 'semver';\n\nimport {\n DataFrame,\n DataLink,\n DataQueryRequest,\n DataQueryResponse,\n DataSourceInstanceSettings,\n DataSourceWithLogsContextSupport,\n DataSourceWithQueryImportSupport,\n DataSourceWithSupplementaryQueriesSupport,\n DateTime,\n dateTime,\n getDefaultTimeRange,\n AbstractQuery,\n LogLevel,\n LogRowModel,\n MetricFindValue,\n ScopedVars,\n TimeRange,\n QueryFixAction,\n CoreApp,\n SupplementaryQueryType,\n DataQueryError,\n rangeUtil,\n LogRowContextQueryDirection,\n LogRowContextOptions,\n SupplementaryQueryOptions,\n toUtc,\n AnnotationEvent,\n DataSourceWithToggleableQueryFiltersSupport,\n QueryFilterOptions,\n ToggleFilterAction,\n DataSourceGetTagValuesOptions,\n AdHocVariableFilter,\n DataSourceWithQueryModificationSupport,\n AdHocVariableModel,\n TypedVariableModel,\n} from '@grafana/data';\nimport {\n DataSourceWithBackend,\n getDataSourceSrv,\n config,\n BackendSrvRequest,\n TemplateSrv,\n getTemplateSrv,\n} from '@grafana/runtime';\n\nimport { IndexPattern, intervalMap } from './IndexPattern';\nimport LanguageProvider from './LanguageProvider';\nimport { LegacyQueryRunner } from './LegacyQueryRunner';\nimport { ElasticQueryBuilder } from './QueryBuilder';\nimport { ElasticsearchAnnotationsQueryEditor } from './components/QueryEditor/AnnotationQueryEditor';\nimport { isBucketAggregationWithField } from './components/QueryEditor/BucketAggregationsEditor/aggregations';\nimport { bucketAggregationConfig } from './components/QueryEditor/BucketAggregationsEditor/utils';\nimport {\n isMetricAggregationWithField,\n isPipelineAggregationWithMultipleBucketPaths,\n} from './components/QueryEditor/MetricAggregationsEditor/aggregations';\nimport { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils';\nimport { isMetricAggregationWithMeta } from './guards';\nimport {\n addAddHocFilter,\n addFilterToQuery,\n addStringFilterToQuery,\n queryHasFilter,\n removeFilterFromQuery,\n} from './modifyQuery';\nimport { trackAnnotationQuery, trackQuery } from './tracking';\nimport {\n Logs,\n BucketAggregation,\n DataLinkConfig,\n ElasticsearchOptions,\n ElasticsearchQuery,\n TermsQuery,\n Interval,\n ElasticsearchAnnotationQuery,\n RangeMap,\n} from './types';\nimport { getScriptValue, isSupportedVersion, isTimeSeriesQuery, unsupportedVersionMessage } from './utils';\n\nexport const REF_ID_STARTER_LOG_VOLUME = 'log-volume-';\nexport const REF_ID_STARTER_LOG_SAMPLE = 'log-sample-';\n\n// Those are metadata fields as defined in https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-fields.html#_identity_metadata_fields.\n// custom fields can start with underscores, therefore is not safe to exclude anything that starts with one.\nconst ELASTIC_META_FIELDS = [\n '_index',\n '_type',\n '_id',\n '_source',\n '_size',\n '_field_names',\n '_ignored',\n '_routing',\n '_meta',\n];\n\nexport class ElasticDatasource\n extends DataSourceWithBackend<ElasticsearchQuery, ElasticsearchOptions>\n implements\n DataSourceWithLogsContextSupport,\n DataSourceWithQueryImportSupport<ElasticsearchQuery>,\n DataSourceWithSupplementaryQueriesSupport<ElasticsearchQuery>,\n DataSourceWithToggleableQueryFiltersSupport<ElasticsearchQuery>,\n DataSourceWithQueryModificationSupport<ElasticsearchQuery>\n{\n basicAuth?: string;\n withCredentials?: boolean;\n url: string;\n name: string;\n index: string;\n timeField: string;\n xpack: boolean;\n interval: string;\n maxConcurrentShardRequests?: number;\n queryBuilder: ElasticQueryBuilder;\n indexPattern: IndexPattern;\n intervalPattern?: Interval;\n logMessageField?: string;\n logLevelField?: string;\n dataLinks: DataLinkConfig[];\n languageProvider: LanguageProvider;\n includeFrozen: boolean;\n isProxyAccess: boolean;\n databaseVersion: SemVer | null;\n legacyQueryRunner: LegacyQueryRunner;\n\n constructor(\n instanceSettings: DataSourceInstanceSettings<ElasticsearchOptions>,\n private readonly templateSrv: TemplateSrv = getTemplateSrv()\n ) {\n super(instanceSettings);\n this.basicAuth = instanceSettings.basicAuth;\n this.withCredentials = instanceSettings.withCredentials;\n this.url = instanceSettings.url!;\n this.name = instanceSettings.name;\n this.isProxyAccess = instanceSettings.access === 'proxy';\n const settingsData = instanceSettings.jsonData || {};\n\n this.index = settingsData.index ?? instanceSettings.database ?? '';\n this.timeField = settingsData.timeField;\n this.xpack = Boolean(settingsData.xpack);\n this.indexPattern = new IndexPattern(this.index, settingsData.interval);\n this.intervalPattern = settingsData.interval;\n this.interval = settingsData.timeInterval;\n this.maxConcurrentShardRequests = settingsData.maxConcurrentShardRequests;\n this.queryBuilder = new ElasticQueryBuilder({\n timeField: this.timeField,\n });\n this.logMessageField = settingsData.logMessageField || '';\n this.logLevelField = settingsData.logLevelField || '';\n this.dataLinks = settingsData.dataLinks || [];\n this.includeFrozen = settingsData.includeFrozen ?? false;\n this.databaseVersion = null;\n this.annotations = {\n QueryEditor: ElasticsearchAnnotationsQueryEditor,\n };\n\n if (this.logMessageField === '') {\n this.logMessageField = undefined;\n }\n\n if (this.logLevelField === '') {\n this.logLevelField = undefined;\n }\n this.languageProvider = new LanguageProvider(this);\n this.legacyQueryRunner = new LegacyQueryRunner(this, this.templateSrv);\n }\n\n getResourceRequest(path: string, params?: BackendSrvRequest['params'], options?: Partial<BackendSrvRequest>) {\n return this.getResource(path, params, options);\n }\n\n postResourceRequest(path: string, data?: BackendSrvRequest['data'], options?: Partial<BackendSrvRequest>) {\n const resourceOptions = options ?? {};\n resourceOptions.headers = resourceOptions.headers ?? {};\n resourceOptions.headers['content-type'] = 'application/x-ndjson';\n\n return this.postResource(path, data, resourceOptions);\n }\n\n async importFromAbstractQueries(abstractQueries: AbstractQuery[]): Promise<ElasticsearchQuery[]> {\n return abstractQueries.map((abstractQuery) => this.languageProvider.importFromAbstractQuery(abstractQuery));\n }\n\n /**\n * Sends a GET request to the specified url on the newest matching and available index.\n *\n * When multiple indices span the provided time range, the request is sent starting from the newest index,\n * and then going backwards until an index is found.\n */\n private requestAllIndices(range = getDefaultTimeRange()) {\n let indexList = this.indexPattern.getIndexList(range.from, range.to);\n if (!Array.isArray(indexList)) {\n indexList = [this.indexPattern.getIndexForToday()];\n }\n\n const url = '_mapping';\n\n const indexUrlList = indexList.map((index) => {\n // make sure `index` does not end with a slash\n index = index.replace(/\\/$/, '');\n if (index === '') {\n return url;\n }\n\n return `${index}/${url}`;\n });\n\n const maxTraversals = 7; // do not go beyond one week (for a daily pattern)\n const listLen = indexUrlList.length;\n\n return generate({\n initialState: 0,\n condition: (i) => i < Math.min(listLen, maxTraversals),\n iterate: (i) => i + 1,\n }).pipe(\n mergeMap((index) => {\n // catch all errors and emit an object with an err property to simplify checks later in the pipeline\n const path = indexUrlList[listLen - index - 1];\n const requestObservable = config.featureToggles.enableElasticsearchBackendQuerying\n ? from(this.getResource(path))\n : this.legacyQueryRunner.request('GET', path);\n\n return requestObservable.pipe(catchError((err) => of({ err })));\n }),\n skipWhile((resp) => resp?.err?.status === 404), // skip all requests that fail because missing Elastic index\n throwIfEmpty(() => 'Could not find an available index for this time range.'), // when i === Math.min(listLen, maxTraversals) generate will complete but without emitting any values which means we didn't find a valid index\n first(), // take the first value that isn't skipped\n map((resp) => {\n if (resp.err) {\n throw resp.err; // if there is some other error except 404 then we must throw it\n }\n\n return resp;\n })\n );\n }\n\n annotationQuery(options: any): Promise<AnnotationEvent[]> {\n const payload = this.prepareAnnotationRequest(options);\n trackAnnotationQuery(options.annotation);\n const annotationObservable = config.featureToggles.enableElasticsearchBackendQuerying\n ? // TODO: We should migrate this to use query and not resource call\n // The plan is to look at this when we start to work on raw query editor for ES\n // as we will have to explore how to handle any query\n from(this.postResourceRequest('_msearch', payload))\n : this.legacyQueryRunner.request('POST', '_msearch', payload);\n\n return lastValueFrom(\n annotationObservable.pipe(\n map((res) => {\n const hits = res.responses[0].hits.hits;\n return this.processHitsToAnnotationEvents(options.annotation, hits);\n })\n )\n );\n }\n\n private prepareAnnotationRequest(options: {\n annotation: ElasticsearchAnnotationQuery;\n // Should be DashboardModel but cannot import that here from the main app. This is a temporary solution as we need to move from deprecated annotations.\n dashboard: { getVariables: () => TypedVariableModel[] };\n range: TimeRange;\n }) {\n const annotation = options.annotation;\n const timeField = annotation.timeField || '@timestamp';\n const timeEndField = annotation.timeEndField || null;\n const dashboard = options.dashboard;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n const adhocVariables = dashboard.getVariables().filter((v) => v.type === 'adhoc') as AdHocVariableModel[];\n const annotationRelatedVariables = adhocVariables.filter((v) => v.datasource?.uid === annotation.datasource.uid);\n const filters = annotationRelatedVariables.map((v) => v.filters).flat();\n\n // the `target.query` is the \"new\" location for the query.\n // normally we would write this code as\n // try-the-new-place-then-try-the-old-place,\n // but we had the bug at\n // https://github.com/grafana/grafana/issues/61107\n // that may have stored annotations where\n // both the old and the new place are set,\n // and in that scenario the old place needs\n // to have priority.\n const queryString = annotation.query ?? annotation.target?.query ?? '';\n\n const dateRanges = [];\n const rangeStart: RangeMap = {};\n rangeStart[timeField] = {\n from: options.range.from.valueOf(),\n to: options.range.to.valueOf(),\n format: 'epoch_millis',\n };\n dateRanges.push({ range: rangeStart });\n\n if (timeEndField) {\n const rangeEnd: RangeMap = {};\n rangeEnd[timeEndField] = {\n from: options.range.from.valueOf(),\n to: options.range.to.valueOf(),\n format: 'epoch_millis',\n };\n dateRanges.push({ range: rangeEnd });\n }\n\n const queryInterpolated = this.interpolateLuceneQuery(queryString);\n const finalQuery = this.addAdHocFilters(queryInterpolated, filters);\n\n const query: {\n bool: { filter: Array<Record<string, Record<string, string | number | Array<{ range: RangeMap }>>>> };\n } = {\n bool: {\n filter: [\n {\n bool: {\n should: dateRanges,\n minimum_should_match: 1,\n },\n },\n ],\n },\n };\n\n if (finalQuery) {\n query.bool.filter.push({\n query_string: {\n query: finalQuery,\n },\n });\n }\n const data = {\n query,\n size: 10000,\n };\n\n const header: Record<string, string | string[] | boolean> = {\n search_type: 'query_then_fetch',\n ignore_unavailable: true,\n };\n\n // @deprecated\n // Field annotation.index is deprecated and will be removed in the future\n if (annotation.index) {\n header.index = annotation.index;\n } else {\n header.index = this.indexPattern.getIndexList(options.range.from, options.range.to);\n }\n\n const payload = JSON.stringify(header) + '\\n' + JSON.stringify(data) + '\\n';\n return payload;\n }\n\n private processHitsToAnnotationEvents(\n annotation: ElasticsearchAnnotationQuery,\n hits: Array<Record<string, string | number | Record<string | number, string | number>>>\n ) {\n const timeField = annotation.timeField || '@timestamp';\n const timeEndField = annotation.timeEndField || null;\n const textField = annotation.textField || 'tags';\n const tagsField = annotation.tagsField || null;\n const list: AnnotationEvent[] = [];\n\n const getFieldFromSource = (source: any, fieldName: string | null) => {\n if (!fieldName) {\n return;\n }\n\n const fieldNames = fieldName.split('.');\n let fieldValue = source;\n\n for (let i = 0; i < fieldNames.length; i++) {\n fieldValue = fieldValue[fieldNames[i]];\n if (!fieldValue) {\n return '';\n }\n }\n\n return fieldValue;\n };\n\n for (let i = 0; i < hits.length; i++) {\n const source = hits[i]._source;\n let time = getFieldFromSource(source, timeField);\n if (typeof hits[i].fields !== 'undefined') {\n const fields = hits[i].fields;\n if (typeof fields === 'object' && (isString(fields[timeField]) || isNumber(fields[timeField]))) {\n time = fields[timeField];\n }\n }\n\n const event: AnnotationEvent = {\n annotation: annotation,\n time: toUtc(time).valueOf(),\n text: getFieldFromSource(source, textField),\n };\n\n if (timeEndField) {\n const timeEnd = getFieldFromSource(source, timeEndField);\n if (timeEnd) {\n event.timeEnd = toUtc(timeEnd).valueOf();\n }\n }\n\n // legacy support for title field\n if (annotation.titleField) {\n const title = getFieldFromSource(source, annotation.titleField);\n if (title) {\n event.text = title + '\\n' + event.text;\n }\n }\n\n const tags = getFieldFromSource(source, tagsField);\n if (typeof tags === 'string') {\n event.tags = tags.split(',');\n } else {\n event.tags = tags;\n }\n\n list.push(event);\n }\n return list;\n }\n\n interpolateLuceneQuery(queryString: string, scopedVars?: ScopedVars) {\n return this.templateSrv.replace(queryString, scopedVars, 'lucene');\n }\n\n interpolateVariablesInQueries(\n queries: ElasticsearchQuery[],\n scopedVars: ScopedVars,\n filters?: AdHocVariableFilter[]\n ): ElasticsearchQuery[] {\n return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters));\n }\n\n async testDatasource() {\n // we explicitly ask for uncached, \"fresh\" data here\n const dbVersion = await this.getDatabaseVersion(false);\n // if we are not able to determine the elastic-version, we assume it is a good version.\n const isSupported = dbVersion != null ? isSupportedVersion(dbVersion) : true;\n const versionMessage = isSupported ? '' : `WARNING: ${unsupportedVersionMessage} `;\n // validate that the index exist and has date field\n return lastValueFrom(\n this.getFields(['date']).pipe(\n mergeMap((dateFields) => {\n const timeField = find(dateFields, { text: this.timeField });\n if (!timeField) {\n return of({\n status: 'error',\n message: 'No date field named ' + this.timeField + ' found',\n });\n }\n return of({ status: 'success', message: `${versionMessage}Data source successfully connected.` });\n }),\n catchError((err) => {\n const infoInParentheses = err.message ? ` (${err.message})` : '';\n const message = `Unable to connect with Elasticsearch${infoInParentheses}. Please check the server logs for more details.`;\n return of({ status: 'error', message });\n })\n )\n );\n }\n\n getQueryHeader(searchType: string, timeFrom?: DateTime, timeTo?: DateTime): string {\n const queryHeader = {\n search_type: searchType,\n ignore_unavailable: true,\n index: this.indexPattern.getIndexList(timeFrom, timeTo),\n };\n\n return JSON.stringify(queryHeader);\n }\n\n getQueryDisplayText(query: ElasticsearchQuery) {\n // TODO: This might be refactored a bit.\n const metricAggs = query.metrics;\n const bucketAggs = query.bucketAggs;\n let text = '';\n\n if (query.query) {\n text += 'Query: ' + query.query + ', ';\n }\n\n text += 'Metrics: ';\n\n text += metricAggs?.reduce((acc, metric) => {\n const metricConfig = metricAggregationConfig[metric.type];\n\n let text = metricConfig.label + '(';\n\n if (isMetricAggregationWithField(metric)) {\n text += metric.field;\n }\n if (isPipelineAggregationWithMultipleBucketPaths(metric)) {\n text += getScriptValue(metric).replace(new RegExp('params.', 'g'), '');\n }\n text += '), ';\n\n return `${acc} ${text}`;\n }, '');\n\n text += bucketAggs?.reduce((acc, bucketAgg, index) => {\n const bucketConfig = bucketAggregationConfig[bucketAgg.type];\n\n let text = '';\n if (index === 0) {\n text += ' Group by: ';\n }\n\n text += bucketConfig.label + '(';\n if (isBucketAggregationWithField(bucketAgg)) {\n text += bucketAgg.field;\n }\n\n return `${acc} ${text}), `;\n }, '');\n\n if (query.alias) {\n text += 'Alias: ' + query.alias;\n }\n\n return text;\n }\n\n getLogRowContext = async (row: LogRowModel, options?: LogRowContextOptions): Promise<{ data: DataFrame[] }> => {\n const { enableElasticsearchBackendQuerying } = config.featureToggles;\n if (enableElasticsearchBackendQuerying) {\n const contextRequest = this.makeLogContextDataRequest(row, options);\n\n return lastValueFrom(\n this.query(contextRequest).pipe(\n catchError((err) => {\n const error: DataQueryError = {\n message: 'Error during context query. Please check JS console logs.',\n status: err.status,\n statusText: err.statusText,\n };\n throw error;\n })\n )\n );\n } else {\n return this.legacyQueryRunner.logContextQuery(row, options);\n }\n };\n\n /**\n * Implemented for DataSourceWithSupplementaryQueriesSupport.\n * It generates a DataQueryRequest for a specific supplementary query type.\n * @returns A DataQueryRequest for the supplementary queries or undefined if not supported.\n */\n getSupplementaryRequest(\n type: SupplementaryQueryType,\n request: DataQueryRequest<ElasticsearchQuery>\n ): DataQueryRequest<ElasticsearchQuery> | undefined {\n switch (type) {\n case SupplementaryQueryType.LogsVolume:\n return this.getLogsVolumeDataProvider(request);\n case SupplementaryQueryType.LogsSample:\n return this.getLogsSampleDataProvider(request);\n default:\n return undefined;\n }\n }\n\n getSupportedSupplementaryQueryTypes(): SupplementaryQueryType[] {\n return [SupplementaryQueryType.LogsVolume, SupplementaryQueryType.LogsSample];\n }\n\n getSupplementaryQuery(options: SupplementaryQueryOptions, query: ElasticsearchQuery): ElasticsearchQuery | undefined {\n let isQuerySuitable = false;\n\n switch (options.type) {\n case SupplementaryQueryType.LogsVolume:\n // it has to be a logs-producing range-query\n isQuerySuitable = !!(query.metrics?.length === 1 && query.metrics[0].type === 'logs');\n if (!isQuerySuitable) {\n return undefined;\n }\n const bucketAggs: BucketAggregation[] = [];\n const timeField = this.timeField ?? '@timestamp';\n\n if (this.logLevelField) {\n bucketAggs.push({\n id: '2',\n type: 'terms',\n settings: {\n min_doc_count: '0',\n size: '0',\n order: 'desc',\n orderBy: '_count',\n missing: LogLevel.unknown,\n },\n field: this.logLevelField,\n });\n }\n bucketAggs.push({\n id: '3',\n type: 'date_histogram',\n settings: {\n interval: 'auto',\n min_doc_count: '0',\n trimEdges: '0',\n },\n field: timeField,\n });\n\n return {\n refId: `${REF_ID_STARTER_LOG_VOLUME}${query.refId}`,\n query: query.query,\n metrics: [{ type: 'count', id: '1' }],\n timeField,\n bucketAggs,\n };\n\n case SupplementaryQueryType.LogsSample:\n isQuerySuitable = isTimeSeriesQuery(query);\n\n if (!isQuerySuitable) {\n return undefined;\n }\n\n if (options.limit) {\n return {\n refId: `${REF_ID_STARTER_LOG_SAMPLE}${query.refId}`,\n query: query.query,\n metrics: [{ type: 'logs', id: '1', settings: { limit: options.limit.toString() } }],\n };\n }\n\n return {\n refId: `${REF_ID_STARTER_LOG_SAMPLE}${query.refId}`,\n query: query.query,\n metrics: [{ type: 'logs', id: '1' }],\n };\n\n default:\n return undefined;\n }\n }\n\n private getLogsVolumeDataProvider(\n request: DataQueryRequest<ElasticsearchQuery>\n ): DataQueryRequest<ElasticsearchQuery> | undefined {\n const logsVolumeRequest = cloneDeep(request);\n const targets = logsVolumeRequest.targets\n .map((target) => this.getSupplementaryQuery({ type: SupplementaryQueryType.LogsVolume }, target))\n .filter((query): query is ElasticsearchQuery => !!query);\n\n if (!targets.length) {\n return undefined;\n }\n\n return { ...logsVolumeRequest, targets };\n }\n\n private getLogsSampleDataProvider(\n request: DataQueryRequest<ElasticsearchQuery>\n ): DataQueryRequest<ElasticsearchQuery> | undefined {\n const logsSampleRequest = cloneDeep(request);\n const targets = logsSampleRequest.targets;\n const queries = targets.map((query) => {\n return this.getSupplementaryQuery({ type: SupplementaryQueryType.LogsSample, limit: 100 }, query);\n });\n const elasticQueries = queries.filter((query): query is ElasticsearchQuery => !!query);\n\n if (!elasticQueries.length) {\n return undefined;\n }\n return { ...logsSampleRequest, targets: elasticQueries };\n }\n\n query(request: DataQueryRequest<ElasticsearchQuery>): Observable<DataQueryResponse> {\n const { enableElasticsearchBackendQuerying } = config.featureToggles;\n if (enableElasticsearchBackendQuerying) {\n const start = new Date();\n return super.query(request).pipe(\n tap((response) => trackQuery(response, request, start)),\n map((response) => {\n response.data.forEach((dataFrame) => {\n enhanceDataFrameWithDataLinks(dataFrame, this.dataLinks);\n });\n return response;\n })\n );\n }\n return this.legacyQueryRunner.query(request);\n }\n\n filterQuery(query: ElasticsearchQuery): boolean {\n if (query.hide) {\n return false;\n }\n return true;\n }\n\n isMetadataField(fieldName: string) {\n return ELASTIC_META_FIELDS.includes(fieldName);\n }\n\n // TODO: instead of being a string, this could be a custom type representing all the elastic types\n // FIXME: This doesn't seem to return actual MetricFindValues, we should either change the return type\n // or fix the implementation.\n getFields(type?: string[], range?: TimeRange): Observable<MetricFindValue[]> {\n const typeMap: Record<string, string> = {\n float: 'number',\n double: 'number',\n integer: 'number',\n long: 'number',\n date: 'date',\n date_nanos: 'date',\n string: 'string',\n text: 'string',\n scaled_float: 'number',\n nested: 'nested',\n histogram: 'number',\n };\n return this.requestAllIndices(range).pipe(\n map((result) => {\n const shouldAddField = (obj: any, key: string) => {\n if (this.isMetadataField(key)) {\n return false;\n }\n\n if (!type || type.length === 0) {\n return true;\n }\n\n // equal query type filter, or via type map translation\n return type.includes(obj.type) || type.includes(typeMap[obj.type]);\n };\n\n // Store subfield names: [system, process, cpu, total] -> system.process.cpu.total\n const fieldNameParts: string[] = [];\n const fields: Record<string, { text: string; type: string }> = {};\n\n function getFieldsRecursively(obj: any) {\n for (const key in obj) {\n const subObj = obj[key];\n\n // Check mapping field for nested fields\n if (isObject(subObj.properties)) {\n fieldNameParts.push(key);\n getFieldsRecursively(subObj.properties);\n }\n\n if (isObject(subObj.fields)) {\n fieldNameParts.push(key);\n getFieldsRecursively(subObj.fields);\n }\n\n if (isString(subObj.type)) {\n const fieldName = fieldNameParts.concat(key).join('.');\n\n // Hide meta-fields and check field type\n if (shouldAddField(subObj, key)) {\n fields[fieldName] = {\n text: fieldName,\n type: subObj.type,\n };\n }\n }\n }\n fieldNameParts.pop();\n }\n\n for (const indexName in result) {\n const index = result[indexName];\n if (index && index.mappings) {\n const mappings = index.mappings;\n\n const properties = mappings.properties;\n getFieldsRecursively(properties);\n }\n }\n\n // transform to array\n return _map(fields, (value) => {\n return value;\n });\n })\n );\n }\n\n getTerms(queryDef: TermsQuery, range = getDefaultTimeRange()): Observable<MetricFindValue[]> {\n const searchType = 'query_then_fetch';\n const header = this.getQueryHeader(searchType, range.from, range.to);\n let esQuery = JSON.stringify(this.queryBuilder.getTermsQuery(queryDef));\n\n esQuery = esQuery.replace(/\\$timeFrom/g, range.from.valueOf().toString());\n esQuery = esQuery.replace(/\\$timeTo/g, range.to.valueOf().toString());\n esQuery = header + '\\n' + esQuery + '\\n';\n\n const url = this.getMultiSearchUrl();\n\n const termsObservable = config.featureToggles.enableElasticsearchBackendQuerying\n ? // TODO: This is run through resource call, but maybe should run through query\n from(this.postResourceRequest(url, esQuery))\n : this.legacyQueryRunner.request('POST', url, esQuery);\n\n return termsObservable.pipe(\n map((res) => {\n if (!res.responses[0].aggregations) {\n return [];\n }\n\n const buckets = res.responses[0].aggregations['1'].buckets;\n return _map(buckets, (bucket) => {\n return {\n text: bucket.key_as_string || bucket.key,\n value: bucket.key,\n };\n });\n })\n );\n }\n\n getMultiSearchUrl() {\n const searchParams = new URLSearchParams();\n\n if (this.maxConcurrentShardRequests) {\n searchParams.append('max_concurrent_shard_requests', `${this.maxConcurrentShardRequests}`);\n }\n\n if (this.xpack && this.includeFrozen) {\n searchParams.append('ignore_throttled', 'false');\n }\n\n return ('_msearch?' + searchParams.toString()).replace(/\\?$/, '');\n }\n\n metricFindQuery(query: string, options?: { range: TimeRange }): Promise<MetricFindValue[]> {\n const range = options?.range;\n const parsedQuery = JSON.parse(query);\n if (query) {\n if (parsedQuery.find === 'fields') {\n parsedQuery.type = this.interpolateLuceneQuery(parsedQuery.type);\n return lastValueFrom(this.getFields(parsedQuery.type, range));\n }\n\n if (parsedQuery.find === 'terms') {\n parsedQuery.field = this.interpolateLuceneQuery(parsedQuery.field);\n parsedQuery.query = this.interpolateLuceneQuery(parsedQuery.query);\n return lastValueFrom(this.getTerms(parsedQuery, range));\n }\n }\n\n return Promise.resolve([]);\n }\n\n getTagKeys() {\n return lastValueFrom(this.getFields());\n }\n\n getTagValues(options: DataSourceGetTagValuesOptions) {\n return lastValueFrom(this.getTerms({ field: options.key }, options.timeRange));\n }\n\n targetContainsTemplate(target: ElasticsearchQuery) {\n if (this.templateSrv.containsTemplate(target.query) || this.templateSrv.containsTemplate(target.alias)) {\n return true;\n }\n\n if (target.bucketAggs) {\n for (const bucketAgg of target.bucketAggs) {\n if (isBucketAggregationWithField(bucketAgg) && this.templateSrv.containsTemplate(bucketAgg.field)) {\n return true;\n }\n if (this.objectContainsTemplate(bucketAgg.settings)) {\n return true;\n }\n }\n }\n\n if (target.metrics) {\n for (const metric of target.metrics) {\n if (!isMetricAggregationWithField(metric)) {\n continue;\n }\n if (metric.field && this.templateSrv.containsTemplate(metric.field)) {\n return true;\n }\n if (metric.settings && this.objectContainsTemplate(metric.settings)) {\n return true;\n }\n if (isMetricAggregationWithMeta(metric) && this.objectContainsTemplate(metric.meta)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n private objectContainsTemplate(obj: any) {\n if (typeof obj === 'string') {\n return this.templateSrv.containsTemplate(obj);\n }\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n for (const key of Object.keys(obj)) {\n if (Array.isArray(obj[key])) {\n for (const item of obj[key]) {\n if (this.objectContainsTemplate(item)) {\n return true;\n }\n }\n } else if (this.objectContainsTemplate(obj[key])) {\n return true;\n }\n }\n\n return false;\n }\n\n toggleQueryFilter(query: ElasticsearchQuery, filter: ToggleFilterAction): ElasticsearchQuery {\n let expression = query.query ?? '';\n switch (filter.type) {\n case 'FILTER_FOR': {\n // This gives the user the ability to toggle a filter on and off.\n expression = queryHasFilter(expression, filter.options.key, filter.options.value)\n ? removeFilterFromQuery(expression, filter.options.key, filter.options.value)\n : addFilterToQuery(expression, filter.options.key, filter.options.value);\n break;\n }\n case 'FILTER_OUT': {\n // If the opposite filter is present, remove it before adding the new one.\n if (queryHasFilter(expression, filter.options.key, filter.options.value)) {\n expression = removeFilterFromQuery(expression, filter.options.key, filter.options.value);\n }\n expression = addFilterToQuery(expression, filter.options.key, filter.options.value, '-');\n break;\n }\n }\n\n return { ...query, query: expression };\n }\n\n queryHasFilter(query: ElasticsearchQuery, options: QueryFilterOptions): boolean {\n let expression = query.query ?? '';\n return queryHasFilter(expression, options.key, options.value);\n }\n\n modifyQuery(query: ElasticsearchQuery, action: QueryFixAction): ElasticsearchQuery {\n if (!action.options) {\n return query;\n }\n\n let expression = query.query ?? '';\n switch (action.type) {\n case 'ADD_FILTER': {\n expression = addFilterToQuery(expression, action.options.key, action.options.value);\n break;\n }\n case 'ADD_FILTER_OUT': {\n expression = addFilterToQuery(expression, action.options.key, action.options.value, '-');\n break;\n }\n case 'ADD_STRING_FILTER': {\n expression = addStringFilterToQuery(expression, action.options.value);\n break;\n }\n case 'ADD_STRING_FILTER_OUT': {\n expression = addStringFilterToQuery(expression, action.options.value, false);\n break;\n }\n }\n\n return { ...query, query: expression };\n }\n\n getSupportedQueryModifications() {\n return ['ADD_FILTER', 'ADD_FILTER_OUT', 'ADD_STRING_FILTER', 'ADD_STRING_FILTER_OUT'];\n }\n\n addAdHocFilters(query: string, adhocFilters?: AdHocVariableFilter[]) {\n if (!adhocFilters) {\n return query;\n }\n let finalQuery = query;\n adhocFilters.forEach((filter) => {\n finalQuery = addAddHocFilter(finalQuery, filter);\n });\n\n return finalQuery;\n }\n\n // Used when running queries through backend\n applyTemplateVariables(\n query: ElasticsearchQuery,\n scopedVars: ScopedVars,\n filters?: AdHocVariableFilter[]\n ): ElasticsearchQuery {\n // We need a separate interpolation format for lucene queries, therefore we first interpolate any\n // lucene query string and then everything else\n const interpolateBucketAgg = (bucketAgg: BucketAggregation): BucketAggregation => {\n if (bucketAgg.type === 'filters') {\n return {\n ...bucketAgg,\n settings: {\n ...bucketAgg.settings,\n filters: bucketAgg.settings?.filters?.map((filter) => ({\n ...filter,\n query: this.interpolateLuceneQuery(filter.query, scopedVars) || '*',\n })),\n },\n };\n }\n\n return bucketAgg;\n };\n\n const expandedQuery = {\n ...query,\n datasource: this.getRef(),\n query: this.addAdHocFilters(this.interpolateLuceneQuery(query.query || '', scopedVars), filters),\n bucketAggs: query.bucketAggs?.map(interpolateBucketAgg),\n };\n\n const finalQuery = JSON.parse(this.templateSrv.replace(JSON.stringify(expandedQuery), scopedVars));\n return finalQuery;\n }\n\n private getDatabaseVersionUncached(): Promise<SemVer | null> {\n // we want this function to never fail\n const getDbVersionObservable = config.featureToggles.enableElasticsearchBackendQuerying\n ? from(this.getResourceRequest(''))\n : this.legacyQueryRunner.request('GET', '/');\n\n return lastValueFrom(getDbVersionObservable).then(\n (data) => {\n const versionNumber = data?.version?.number;\n if (typeof versionNumber !== 'string') {\n return null;\n }\n try {\n return new SemVer(versionNumber);\n } catch (error) {\n console.error(error);\n return null;\n }\n },\n (error) => {\n console.error(error);\n return null;\n }\n );\n }\n\n async getDatabaseVersion(useCachedData = true): Promise<SemVer | null> {\n if (useCachedData) {\n const cached = this.databaseVersion;\n if (cached != null) {\n return cached;\n }\n }\n\n const freshDatabaseVersion = await this.getDatabaseVersionUncached();\n this.databaseVersion = freshDatabaseVersion;\n return freshDatabaseVersion;\n }\n\n private makeLogContextDataRequest = (row: LogRowModel, options?: LogRowContextOptions) => {\n const direction = options?.direction || LogRowContextQueryDirection.Backward;\n const logQuery: Logs = {\n type: 'logs',\n id: '1',\n settings: {\n limit: options?.limit ? options?.limit.toString() : '10',\n // Sorting of results in the context query\n sortDirection: direction === LogRowContextQueryDirection.Backward ? 'desc' : 'asc',\n // Used to get the next log lines before/after the current log line using sort field of selected log line\n searchAfter: row.dataFrame.fields.find((f) => f.name === 'sort')?.values[row.rowIndex] ?? [row.timeEpochMs],\n },\n };\n\n const query: ElasticsearchQuery = {\n refId: `log-context-${row.dataFrame.refId}-${direction}`,\n metrics: [logQuery],\n query: '',\n };\n\n const timeRange = createContextTimeRange(row.timeEpochMs, direction, this.intervalPattern);\n const range = {\n from: timeRange.from,\n to: timeRange.to,\n raw: timeRange,\n };\n\n const interval = rangeUtil.calculateInterval(range, 1);\n\n const contextRequest: DataQueryRequest<ElasticsearchQuery> = {\n requestId: `log-context-request-${row.dataFrame.refId}-${options?.direction}`,\n targets: [query],\n interval: interval.interval,\n intervalMs: interval.intervalMs,\n range,\n scopedVars: {},\n timezone: 'UTC',\n app: CoreApp.Explore,\n startTime: Date.now(),\n hideFromInspector: true,\n };\n return contextRequest;\n };\n}\n\nexport function enhanceDataFrameWithDataLinks(dataFrame: DataFrame, dataLinks: DataLinkConfig[]) {\n if (!dataLinks.length) {\n return;\n }\n\n for (const field of dataFrame.fields) {\n const linksToApply = dataLinks.filter((dataLink) => new RegExp(dataLink.field).test(field.name));\n\n if (linksToApply.length === 0) {\n continue;\n }\n\n field.config = field.config || {};\n field.config.links = [...(field.config.links || [], linksToApply.map(generateDataLink))];\n }\n}\n\nfunction generateDataLink(linkConfig: DataLinkConfig): DataLink {\n const dataSourceSrv = getDataSourceSrv();\n\n if (linkConfig.datasourceUid) {\n const dsSettings = dataSourceSrv.getInstanceSettings(linkConfig.datasourceUid);\n\n return {\n title: linkConfig.urlDisplayLabel || '',\n url: '',\n internal: {\n query: { query: linkConfig.url },\n datasourceUid: linkConfig.datasourceUid,\n datasourceName: dsSettings?.name ?? 'Data source not found',\n },\n };\n } else {\n return {\n title: linkConfig.urlDisplayLabel || '',\n url: linkConfig.url,\n };\n }\n}\n\nfunction createContextTimeRange(rowTimeEpochMs: number, direction: string, intervalPattern: Interval | undefined) {\n const offset = 7;\n // For log context, we want to request data from 7 subsequent/previous indices\n if (intervalPattern) {\n const intervalInfo = intervalMap[intervalPattern];\n if (direction === LogRowContextQueryDirection.Forward) {\n return {\n from: dateTime(rowTimeEpochMs).utc(),\n to: dateTime(rowTimeEpochMs).add(offset, intervalInfo.amount).utc().startOf(intervalInfo.startOf),\n };\n } else {\n return {\n from: dateTime(rowTimeEpochMs).subtract(offset, intervalInfo.amount).utc().startOf(intervalInfo.startOf),\n to: dateTime(rowTimeEpochMs).utc(),\n };\n }\n // If we don't have an interval pattern, we can't do this, so we just request data from 7h before/after\n } else {\n if (direction === LogRowContextQueryDirection.Forward) {\n return {\n from: dateTime(rowTimeEpochMs).utc(),\n to: dateTime(rowTimeEpochMs).add(offset, 'hours').utc(),\n };\n } else {\n return {\n from: dateTime(rowTimeEpochMs).subtract(offset, 'hours').utc(),\n to: dateTime(rowTimeEpochMs).utc(),\n };\n }\n }\n}\n","import { DashboardLoadedEvent, DataSourcePlugin } from '@grafana/data';\nimport { getAppEvents } from '@grafana/runtime';\n\nimport { QueryEditor } from './components/QueryEditor';\nimport { ConfigEditor } from './configuration/ConfigEditor';\nimport { ElasticDatasource } from './datasource';\nimport { onDashboardLoadedHandler } from './tracking';\nimport { ElasticsearchQuery } from './types';\n\nexport const plugin = new DataSourcePlugin(ElasticDatasource).setQueryEditor(QueryEditor).setConfigEditor(ConfigEditor);\n\n// Subscribe to on dashboard loaded event so that we can track plugin adoption\ngetAppEvents().subscribe<DashboardLoadedEvent<ElasticsearchQuery>>(DashboardLoadedEvent, onDashboardLoadedHandler);\n","exports.escape = function escape(s) {\n return s.replace(/[\\+\\-\\!\\(\\)\\{\\}\\[\\]\\^\\\"\\?\\:\\\\\\&\\|\\'\\/\\s\\*\\~]/g, prefixCharWithBackslashes);\n};\n\nfunction prefixCharWithBackslashes(char) {\n return '\\\\' + char;\n}\n\nexports.unescape = function unescape(s) {\n return s.replace(/\\\\([\\+\\-\\!\\(\\)\\{\\}\\[\\]\\^\\\"\\?\\:\\\\\\&\\|\\'\\/\\s\\*\\~])/g, extractChar);\n};\n\nfunction extractChar(match, char) {\n return char;\n}\n\nexports.escapePhrase = function escapePhrase(s) {\n return s.replace(/\"/g, prefixCharWithBackslashes);\n};\n\nexports.unescapePhrase = function unescapePhrase(s) {\n return s.replace(/\\\\(\")/g, extractChar);\n};\n","'use strict';\n\nvar queryParser = require('./queryParser');\nvar escaping = require('./escaping');\n\nexports.parse = queryParser.parse.bind(queryParser);\nexports.toString = require('./toString');\n\nexports.term = {\n escape: escaping.escape,\n unescape: escaping.unescape\n};\n\nexports.phrase = {\n escape: escaping.escapePhrase,\n unescape: escaping.unescapePhrase\n};\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n\n\"use strict\";\n\nfunction peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n}\n\nfunction peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n}\n\npeg$subclass(peg$SyntaxError, Error);\n\npeg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\n\nfunction peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { start: peg$parsestart },\n peg$startRuleFunction = peg$parsestart,\n\n peg$c0 = function(node) {\n return node[0];\n },\n peg$c1 = function() {\n return {};\n },\n peg$c2 = function(operator) {\n return {\n 'operator': operator,\n };\n },\n peg$c3 = function(start, left, operator, right) {\n var node = {\n 'start': start,\n 'left': left,\n };\n\n var right =\n right.length == 0\n ? null\n : right[0]['right'] == null\n ? right[0]['left']\n : right[0];\n\n if (right != null) {\n node['operator'] = operator == '' ? '<implicit>' : operator[0];\n node['right'] = right;\n }\n\n return node;\n },\n peg$c4 = function(operator, right) {\n return right;\n },\n peg$c5 = function(left, operator, right) {\n var node = {\n 'left':left\n };\n\n var right =\n right.length == 0\n ? null\n : right[0]['right'] == null\n ? right[0]['left']\n : right[0];\n\n if (right != null) {\n node['operator'] = operator == '' ? '<implicit>' : operator[0];\n node['right'] = right;\n }\n\n return node;\n },\n peg$c6 = function(field_exp) {\n return field_exp;\n },\n peg$c7 = \"(\",\n peg$c8 = peg$literalExpectation(\"(\", false),\n peg$c9 = \")\",\n peg$c10 = peg$literalExpectation(\")\", false),\n peg$c11 = function(node) {\n node[0]['parenthesized'] = true;\n return node[0];\n },\n peg$c12 = function(fieldname, range) {\n range['field'] =\n fieldname == null || fieldname.label == ''\n ? \"<implicit>\"\n : fieldname.label;\n range['fieldLocation'] =\n fieldname == null || fieldname.label == ''\n ? null\n : fieldname.location;\n\n return range;\n },\n peg$c13 = function(fieldname, node) {\n node['field']= fieldname.label;\n node['fieldLocation'] = fieldname.location;\n return node;\n },\n peg$c14 = function(fieldname, term) {\n var fieldexp = {\n 'field':\n fieldname == null || fieldname.label == ''\n ? \"<implicit>\"\n : fieldname.label,\n 'fieldLocation':\n fieldname == null || fieldname.label == ''\n ? null\n : fieldname.location,\n\n\n };\n\n for(var key in term)\n fieldexp[key] = term[key];\n\n return fieldexp;\n },\n peg$c15 = /^[:]/,\n peg$c16 = peg$classExpectation([\":\"], false, false),\n peg$c17 = function(fieldname) {\n return {\n label: fieldname.label,\n location: fieldname.location\n }\n\n },\n peg$c18 = function(op, term, proximity, boost) {\n var result = {\n 'term': term,\n 'quoted': true,\n 'regex' : false,\n 'termLocation': location()\n };\n\n if('' != proximity)\n {\n result['proximity'] = proximity;\n }\n if('' != boost)\n {\n result['boost'] = boost;\n }\n if('' != op)\n {\n result['prefix'] = op;\n }\n\n return result;\n },\n peg$c19 = function(op, term) {\n var result = {\n 'term': term,\n 'quoted': false,\n 'regex': true,\n 'termLocation': location()\n };\n\n return result;\n },\n peg$c20 = function(op, term, similarity, boost) {\n var result = {\n 'term': term.label,\n 'quoted': false,\n 'regex': false,\n 'termLocation': location()\n };\n if('' != similarity)\n {\n result['similarity'] = similarity;\n }\n if('' != boost)\n {\n result['boost'] = boost;\n }\n if('' != op)\n {\n result['prefix'] = op;\n }\n return result;\n },\n peg$c21 = \"\\\\\",\n peg$c22 = peg$literalExpectation(\"\\\\\", false),\n peg$c23 = function(sequence) { return '\\\\' + sequence; },\n peg$c24 = \".\",\n peg$c25 = peg$literalExpectation(\".\", false),\n peg$c26 = /^[^ \\t\\r\\n\\f{}()\"\\/\\^~[\\]]/,\n peg$c27 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\", \"\\f\", \"{\", \"}\", \"(\", \")\", \"\\\"\", \"/\", \"^\", \"~\", \"[\", \"]\"], true, false),\n peg$c28 = function(term) {\n return term.join('');\n },\n peg$c29 = function(term) {\n return {\n label: term.join(''),\n location: location(),\n };\n },\n peg$c30 = /^[^: \\t\\r\\n\\f{}()\"\\/\\^~[\\]]/,\n peg$c31 = peg$classExpectation([\":\", \" \", \"\\t\", \"\\r\", \"\\n\", \"\\f\", \"{\", \"}\", \"(\", \")\", \"\\\"\", \"/\", \"^\", \"~\", \"[\", \"]\"], true, false),\n peg$c32 = \"\\\"\",\n peg$c33 = peg$literalExpectation(\"\\\"\", false),\n peg$c34 = function(chars) { return chars.join(''); },\n peg$c35 = \"/\",\n peg$c36 = peg$literalExpectation(\"/\", false),\n peg$c37 = function(chars) { return chars.join('') },\n peg$c38 = peg$anyExpectation(),\n peg$c39 = function(char) { return char; },\n peg$c40 = \"+\",\n peg$c41 = peg$literalExpectation(\"+\", false),\n peg$c42 = \"-\",\n peg$c43 = peg$literalExpectation(\"-\", false),\n peg$c44 = \"!\",\n peg$c45 = peg$literalExpectation(\"!\", false),\n peg$c46 = \"{\",\n peg$c47 = peg$literalExpectation(\"{\", false),\n peg$c48 = \"}\",\n peg$c49 = peg$literalExpectation(\"}\", false),\n peg$c50 = \"[\",\n peg$c51 = peg$literalExpectation(\"[\", false),\n peg$c52 = \"]\",\n peg$c53 = peg$literalExpectation(\"]\", false),\n peg$c54 = \"^\",\n peg$c55 = peg$literalExpectation(\"^\", false),\n peg$c56 = \"?\",\n peg$c57 = peg$literalExpectation(\"?\", false),\n peg$c58 = \":\",\n peg$c59 = peg$literalExpectation(\":\", false),\n peg$c60 = \"&\",\n peg$c61 = peg$literalExpectation(\"&\", false),\n peg$c62 = \"|\",\n peg$c63 = peg$literalExpectation(\"|\", false),\n peg$c64 = \"'\",\n peg$c65 = peg$literalExpectation(\"'\", false),\n peg$c66 = \"~\",\n peg$c67 = peg$literalExpectation(\"~\", false),\n peg$c68 = \"*\",\n peg$c69 = peg$literalExpectation(\"*\", false),\n peg$c70 = \" \",\n peg$c71 = peg$literalExpectation(\" \", false),\n peg$c72 = function(proximity) {\n return proximity;\n },\n peg$c73 = function(boost) {\n return boost;\n },\n peg$c74 = function(fuzziness) {\n return fuzziness == '' || fuzziness == null ? 0.5 : fuzziness;\n },\n peg$c75 = \"0.\",\n peg$c76 = peg$literalExpectation(\"0.\", false),\n peg$c77 = /^[0-9]/,\n peg$c78 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c79 = function(val) {\n return parseFloat(\"0.\" + val.join(''));\n },\n peg$c80 = function(val) {\n return parseInt(val.join(''));\n },\n peg$c81 = \"TO\",\n peg$c82 = peg$literalExpectation(\"TO\", false),\n peg$c83 = function(term_min, term_max) {\n return {\n 'term_min': term_min,\n 'term_max': term_max,\n 'inclusive': 'both'\n };\n },\n peg$c84 = function(term_min, term_max) {\n return {\n 'term_min': term_min,\n 'term_max': term_max,\n 'inclusive': 'none'\n };\n },\n peg$c85 = function(term_min, term_max) {\n return {\n 'term_min': term_min,\n 'term_max': term_max,\n 'inclusive': 'left'\n };\n },\n peg$c86 = function(term_min, term_max) {\n return {\n 'term_min': term_min,\n 'term_max': term_max,\n 'inclusive': 'right'\n };\n },\n peg$c87 = function(operator) {\n return operator;\n },\n peg$c88 = \"OR NOT\",\n peg$c89 = peg$literalExpectation(\"OR NOT\", false),\n peg$c90 = \"AND NOT\",\n peg$c91 = peg$literalExpectation(\"AND NOT\", false),\n peg$c92 = \"OR\",\n peg$c93 = peg$literalExpectation(\"OR\", false),\n peg$c94 = \"AND\",\n peg$c95 = peg$literalExpectation(\"AND\", false),\n peg$c96 = \"NOT\",\n peg$c97 = peg$literalExpectation(\"NOT\", false),\n peg$c98 = \"||\",\n peg$c99 = peg$literalExpectation(\"||\", false),\n peg$c100 = \"&&\",\n peg$c101 = peg$literalExpectation(\"&&\", false),\n peg$c102 = peg$otherExpectation(\"whitespace\"),\n peg$c103 = /^[ \\t\\r\\n\\f]/,\n peg$c104 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\", \"\\f\"], false, false),\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parsestart() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parse_();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parse_();\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsenode();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsenode();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parse_();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parse_();\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseEOF();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c1();\n }\n s0 = s1;\n }\n }\n\n return s0;\n }\n\n function peg$parsenode() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$parseoperator_exp();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseEOF();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c2(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseoperator_exp();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsegroup_exp();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseoperator_exp();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseoperator_exp();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parsenode();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parsenode();\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1, s2, s3, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseoperator_exp();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsenode();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c4(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsegroup_exp();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseoperator_exp();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseoperator_exp();\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsenode();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsenode();\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsegroup_exp() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parsefield_exp();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parse_();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parse_();\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c6(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseparen_exp();\n }\n\n return s0;\n }\n\n function peg$parseparen_exp() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 40) {\n s1 = peg$c7;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parse_();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parse_();\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsenode();\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsenode();\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s4 = peg$c9;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c10); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c11(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsefield_exp() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsefieldname();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parserange_operator_exp();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldname();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseparen_exp();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldname();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseterm();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c14(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsefieldname() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$parseunquoted_term();\n if (s1 !== peg$FAILED) {\n if (peg$c15.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c16); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c17(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseterm() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parseprefix_operator_exp();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsequoted_term();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseproximity_modifier();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseboost_modifier();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c18(s1, s2, s3, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseprefix_operator_exp();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseregex_term();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c19(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseprefix_operator_exp();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseunquoted_term();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsefuzzy_modifier();\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseboost_modifier();\n if (s4 === peg$FAILED) {\n s4 = null;\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s2, s3, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parserterm_char() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseEscapeSequence();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s0 = peg$c24;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c26.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c27); }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseranged_term() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parserterm_char();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parserterm_char();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c28(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseunquoted_term() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseterm_char();\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseterm_char();\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseterm_char() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseEscapeSequence();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s0 = peg$c24;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c30.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsequoted_term() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c32;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseDoubleStringCharacter();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseDoubleStringCharacter();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c32;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseregex_term() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 47) {\n s1 = peg$c35;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseRegexCharacter();\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseRegexCharacter();\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 47) {\n s3 = peg$c35;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c37(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseDoubleStringCharacter() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 34) {\n s2 = peg$c32;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s2 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 92) {\n s2 = peg$c21;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n }\n peg$silentFails--;\n if (s2 === peg$FAILED) {\n s1 = void 0;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseEscapeSequence();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseRegexCharacter() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n peg$silentFails++;\n if (input.charCodeAt(peg$currPos) === 47) {\n s2 = peg$c35;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s2 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 92) {\n s2 = peg$c21;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n }\n peg$silentFails--;\n if (s2 === peg$FAILED) {\n s1 = void 0;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n if (input.length > peg$currPos) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c21;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseEscapeSequence();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseEscapeSequence() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 43) {\n s0 = peg$c40;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c41); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s0 = peg$c42;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 33) {\n s0 = peg$c44;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c45); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s0 = peg$c7;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c8); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s0 = peg$c9;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c10); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s0 = peg$c46;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c47); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s0 = peg$c48;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s0 = peg$c50;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c51); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s0 = peg$c52;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 94) {\n s0 = peg$c54;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c55); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s0 = peg$c32;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 63) {\n s0 = peg$c56;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c57); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s0 = peg$c58;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c59); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 92) {\n s0 = peg$c21;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 38) {\n s0 = peg$c60;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c61); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 124) {\n s0 = peg$c62;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c63); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s0 = peg$c64;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c65); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 47) {\n s0 = peg$c35;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 126) {\n s0 = peg$c66;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 42) {\n s0 = peg$c68;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 32) {\n s0 = peg$c70;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c71); }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseproximity_modifier() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 126) {\n s1 = peg$c66;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseint_exp();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c72(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseboost_modifier() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 94) {\n s1 = peg$c54;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c55); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedecimal_or_int_exp();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c73(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsefuzzy_modifier() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 126) {\n s1 = peg$c66;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedecimal_exp();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c74(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsedecimal_or_int_exp() {\n var s0;\n\n s0 = peg$parsedecimal_exp();\n if (s0 === peg$FAILED) {\n s0 = peg$parseint_exp();\n }\n\n return s0;\n }\n\n function peg$parsedecimal_exp() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c75) {\n s1 = peg$c75;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c79(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseint_exp() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c80(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parserange_operator_exp() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c50;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c51); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseranged_term();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c81) {\n s4 = peg$c81;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c82); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseranged_term();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s7 = peg$c52;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c83(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c46;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c47); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseranged_term();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c81) {\n s4 = peg$c81;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c82); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseranged_term();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s7 = peg$c48;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c50;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c51); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseranged_term();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c81) {\n s4 = peg$c81;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c82); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseranged_term();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s7 = peg$c48;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c85(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c46;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c47); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseranged_term();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c81) {\n s4 = peg$c81;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c82); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parse_();\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseranged_term();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s7 = peg$c52;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c86(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseoperator_exp() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parse_();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parse_();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseoperator();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parse_();\n }\n } else {\n s3 = peg$FAILED;\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parse_();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parse_();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseoperator();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseEOF();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseoperator() {\n var s0;\n\n if (input.substr(peg$currPos, 6) === peg$c88) {\n s0 = peg$c88;\n peg$currPos += 6;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c89); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c90) {\n s0 = peg$c90;\n peg$currPos += 7;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c91); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c92) {\n s0 = peg$c92;\n peg$currPos += 2;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c93); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c94) {\n s0 = peg$c94;\n peg$currPos += 3;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c95); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c96) {\n s0 = peg$c96;\n peg$currPos += 3;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c97); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c98) {\n s0 = peg$c98;\n peg$currPos += 2;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c99); }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c100) {\n s0 = peg$c100;\n peg$currPos += 2;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c101); }\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseprefix_operator_exp() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parse_();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parse_();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseprefix_operator();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c87(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseprefix_operator() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 43) {\n s0 = peg$c40;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c41); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s0 = peg$c42;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 33) {\n s0 = peg$c44;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c45); }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n peg$silentFails++;\n s0 = [];\n if (peg$c103.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c104); }\n }\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c103.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c104); }\n }\n }\n } else {\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c102); }\n }\n\n return s0;\n }\n\n function peg$parseEOF() {\n var s0, s1;\n\n s0 = peg$currPos;\n peg$silentFails++;\n if (input.length > peg$currPos) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n peg$silentFails--;\n if (s1 === peg$FAILED) {\n s0 = void 0;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n}\n\nmodule.exports = {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n};\n","'use strict';\n\nvar implicit = '<implicit>';\n\nmodule.exports = function toString(ast) {\n if (!ast) {\n return '';\n }\n\n var result = '';\n\n if (ast.start != null) {\n result += (ast.parenthesized ? '(' : '') + ast.start + ' ';\n }\n\n if (ast.field && ast.field !== implicit) {\n result += ast.field + ':';\n }\n\n if (ast.left) {\n if (ast.parenthesized && !ast.start) {\n result += '(';\n }\n result += toString(ast.left);\n\n if (ast.parenthesized && !ast.right) {\n result += ')';\n }\n }\n\n if (ast.operator) {\n if (ast.left) {\n result += ' ';\n }\n\n if (ast.operator !== implicit) {\n result += ast.operator;\n }\n }\n\n if (ast.right) {\n if (ast.operator && ast.operator !== implicit) {\n result += ' ';\n }\n result += toString(ast.right);\n\n if (ast.parenthesized) {\n result += ')';\n }\n }\n\n if (ast.term || (ast.term === '' && ast.quoted)) {\n if (ast.prefix) {\n result += ast.prefix;\n }\n if (ast.quoted) {\n result += '\"';\n result += ast.term;\n result += '\"';\n } else if (ast.regex) {\n result += '/';\n result += ast.term;\n result += '/';\n } else {\n result += ast.term;\n }\n\n if (ast.proximity != null) {\n result += '~' + ast.proximity;\n }\n\n if (ast.boost != null) {\n result += '^' + ast.boost;\n }\n }\n\n if (ast.term_min) {\n if (ast.inclusive === 'both' || ast.inclusive === 'left') {\n result += '[';\n } else {\n result += '{';\n }\n\n result += ast.term_min;\n result += ' TO ';\n result += ast.term_max;\n\n if (ast.inclusive === 'both' || ast.inclusive === 'right') {\n result += ']';\n } else {\n result += '}';\n }\n }\n\n if (ast.similarity) {\n result += '~';\n\n if (ast.similarity !== 0.5) {\n result += ast.similarity;\n }\n }\n\n return result;\n};\n"],"names":["__defProp","__defProps","__getOwnPropDescs","__getOwnPropSymbols","__hasOwnProp","__propIsEnum","__defNormalProp","obj","key","value","__spreadValues","a","b","prop","__spreadProps","AdvancedHttpSettings","config","onChange","className","onCookiesChange","cookies","onTimeoutChange","event","styles","combineReducers","reducers","state","action","newState","useStatelessReducer","reducer","DispatchContext","useDispatch","dispatch","defaultPipelineVariable","name","generatePipelineVariableName","pipelineVars","v","isEWMAMovingAverage","metric","isHoltMovingAverage","isHoltWintersMovingAverage","isMovingAverageWithModelSettings","isMetricAggregationWithField","metricAggregationConfig","isPipelineAggregation","isPipelineAggregationWithMultipleBucketPaths","isMetricAggregationWithMissingSupport","isMetricAggregationWithSettings","isMetricAggregationWithMeta","isMetricAggregationWithInlineScript","METRIC_AGGREGATION_TYPES","isMetricAggregationType","s","pipelineOptions","getChildren","metrics","children","m","pv","child","extendedStats","movingAvgModelOptions","highlightTags","defaultGeoHashPrecisionString","defaultMetricAgg","id","defaultBucketAgg","findMetricById","hasMetricOfType","target","type","isPipelineAgg","metricType","isPipelineAggWithMultipleBucketPaths","describeMetric","removeEmpty","acc","cleanObj","convertOrderByToMetricId","orderBy","metricIdMatches","getScriptValue","isSupportedVersion","version","unsupportedVersionMessage","isTimeSeriesQuery","query","variableRegex","flattenObject","opts","delimiter","maxDepth","currentDepth","output","step","object","prev","isarray","isobject","newKey","addMetric","removeMetric","toggleMetricVisibility","changeMetricField","changeMetricType","changeMetricAttribute","changeMetricSetting","changeMetricMeta","initQuery","changeQuery","changeAliasPattern","queryReducer","prevQuery","aliasPatternReducer","prevAliasPattern","defaultFilter","bucketAggregationConfig","orderByOptions","orderOptions","sizeOptions","addBucketAggregation","removeBucketAggregation","changeBucketAggregationType","changeBucketAggregationField","changeBucketAggregationSetting","createReducer","defaultTimeField","newAgg","lastAgg","bucketAgg","newSettings","metricToRemove","metricsToRemove","resultingMetrics","toRemove","newMetric","DatasourceContext","QueryContext","RangeContext","ElasticsearchProvider","onRunQuery","datasource","range","onStateChange","isUninitialized","shouldRunInit","setShouldRunInit","getHook","c","contextValue","useQuery","useDatasource","useRange","toId","e","toInt","idString","useNextId","bucketAggs","QueryEditorRow","label","onRemoveClick","onHideClick","hidden","getStyles","InlineFieldRow","InlineSegmentGroup","InlineLabel","IconButton","theme","isBucketAggregationWithField","BUCKET_AGGREGATION_TYPES","isBucketAggregationType","getFilter","toSelectableValue","text","useFields","filter","rawFields","q","lastValueFrom","segmentStyles","SettingsEditorContainer","open","setOpen","Icon","calendarIntervals","ElasticQueryBuilder","options","aggDef","queryNode","size","metricId","esAgg","settings","interval","filterObj","i","j","nestedAggs","aggField","metricAgg","appliedAgg","_","k","settingName","stringValue","field","script","parsedValue","queryDef","order","keyname","limit","hasValue","searchValue","getInitialState","initialOptions","initialValue","useCreatableSelectPersistedBehaviour","setOptions","addOption","newValue","defaultIntervalOptions","isValidNewOption","inputValue","optionStartsWithValue","option","getIntervalType","DateHistogramSettingsEditor","baseId","handleIntervalChange","intervalType","InlineField","inlineFieldProps","Select","Input","TimeZonePicker","timeZone","AddRemove","index","onAdd","onRemove","elements","Button","addFilter","removeFilter","changeFilter","FiltersSettingsEditor","upperStateDispatch","QueryField","TermsSettingsEditor","createOrderByOptions","createOrderByOptionsForExtendedStats","method","createOrderByOptionsForPercentiles","percent","percentString","isValidOrderTarget","metricOptions","useDescription","minDocCount","description","orderByOption","trimEdges","SettingsEditor","settingsDescription","bucketAggOptions","toOption","BucketAggregationEditor","getFields","Segment","SegmentAsync","BucketAggregationsEditor","nextId","totalBucketAggs","noWrap","toOptions","MetricPicker","selectedOption","SettingField","placeholder","tooltip","defaultValue","addPipelineVariable","removePipelineVariable","renamePipelineVariable","changePipelineVariableMetric","pipelineVariable","BucketScriptSettingsEditor","previousMetrics","pipelineVar","MovingAverageSettingsEditor","toMultiSelectValue","TopMetricsSettingsEditor","getOrderByOptions","getMetricsOptions","selectedStats","sizeFieldId","unitFieldId","modeFieldId","rateAggUnitOptions","rateAggModeOptions","stat","ExtendedStatSetting","QueryEditorSpecialMetricRow","isBasicAggregation","getTypeOptions","esVersion","includePipelineAggregations","versionRange","MetricEditor","getTypeOptionsAsync","dbVersion","loadOptions","remoteFields","MetricAggregationsEditor","totalMetrics","Alert","OPTIONS","queryTypeToMetricType","QueryTypeSelector","firstMetric","queryType","newQueryType","RadioButtonGroup","useElasticVersion","setVersion","canceled","error","QueryEditor","elasticVersion","showUnsupportedMessage","QueryEditorForm","ElasticSearchQueryField","inputId","isTimeSeries","showBucketAggregationsEditor","DataLink","props","onDelete","suggestions","showInternalLink","setShowInternalLink","useInternalLink","handleChange","DataLinkInput","DataSourcePicker","ds","datasourceUid","previousUid","usePrevious","DataLinks","ConfigSubSection","ConfigDescriptionLink","newField","newDataLinks","indexPatternTypes","ElasticDetails","indexChangeHandler","pattern","intervalHandler","jsonDataChangeHandler","jsonDataSwitchChangeHandler","newInterval","currentIndex","newDatabase","defaultMaxConcurrentShardRequests","LogsConfig","changeHandler","coerceOptions","isValidOptions","ConfigEditor","onOptionsChange","authProps","DataSourceDescription","Divider","ConnectionSettings","Auth","ConfigSection","Stack","SecureSocksProxySettings","intervalMap","IndexPattern","from","to","intervalInfo","start","endEpoch","indexList","ElasticsearchLanguageProvider","initialValues","abstractQuery","labels","HIGHLIGHT_TAGS_EXP","ElasticResponse","targets","response","seriesList","aggregations","tmpSeriesList","table","TableModel","y","newSeries","bucket","percentiles","percentileName","values","statName","stats","metricField","hit","point","propKey","addMetricValue","metricName","buckets","propValues","baseName","aggs","depth","aggId","nameIndex","metricDef","extendedStat","series","dedup","regex","match","g1","g2","group","agg","propName","metricTypeCount","hasTopMetricWithMultipleMetrics","hits","hitsTotal","doc","histogram","trim","points","err","result","item","logMessageField","logLevelField","isLogsRequest","dataFrame","n","propNames","docs","flattenHits","createEmptyDataFrame","toNameTypePair","addPreferredVisualisationType","globalHighlightWordRegex","highlightWordRegex","newSearchWords","line","matchedPhrases","part","matches","searchWords","frame","convertFieldType","flattened","timeField","MutableDataFrame","f","fieldNames","guessType","onDashboardLoadedHandler","dashboardId","orgId","grafanaVersion","queries","elasticsearchQueries","queriesWithTemplateVariables","isQueryWithTemplateVariables","queriesWithLuceneQuery","logsQueries","getQueryType","metricQueries","rawDataQueries","rawDocumentQueries","queriesWithChangedLineLimit","isQueryWithChangedLineLimit","getLineLimit","lineLimit","shouldNotReportBasedOnRefId","refId","REF_ID_STARTER_LOG_VOLUME","trackQuery","request","startTime","app","trackAnnotationQuery","annotation","LegacyQueryRunner","templateSrv","url","data","headers","throwError","map","results","catchError","message","row","searchAfter","sort","header","esQuery","payload","logResponse","transformHitsBasedOnDirection","timestampField","lineField","otherFields","sentTargets","targetsContainsLogsQuery","logLimits","queryObj","log","searchType","of","res","er","enhanceDataFrame","tap","direction","actualResponse","dataLinks","enhanceDataFrameWithDataLinks","ElasticsearchAnnotationsQueryEditor","onAnnotationChange","newTarget","EditorRow","EditorField","queryHasFilter","modifier","findFilterNode","lucene","ast","parseQuery","findNodeInTree","isAST","isNodeTerm","isLeftOnlyAST","isBinaryAST","addFilterToQuery","escapeFilter","escapeFilterValue","concatenate","condition","addAddHocFilter","addHocFilter","removeFilterFromQuery","node","removeNodeFromTree","normalizeQuery","addStringFilterToQuery","contains","expression","REF_ID_STARTER_LOG_SAMPLE","ELASTIC_META_FIELDS","ElasticDatasource","DataSourceWithBackend","instanceSettings","enableElasticsearchBackendQuerying","contextRequest","logQuery","timeRange","createContextTimeRange","settingsData","path","params","resourceOptions","abstractQueries","indexUrlList","maxTraversals","listLen","generate","mergeMap","skipWhile","resp","throwIfEmpty","first","annotationObservable","timeEndField","filters","queryString","dateRanges","rangeStart","rangeEnd","queryInterpolated","finalQuery","textField","tagsField","list","getFieldFromSource","source","fieldName","fieldValue","time","fields","timeEnd","title","tags","scopedVars","versionMessage","dateFields","timeFrom","timeTo","queryHeader","metricAggs","bucketConfig","isQuerySuitable","logsVolumeRequest","logsSampleRequest","elasticQueries","typeMap","shouldAddField","fieldNameParts","getFieldsRecursively","subObj","indexName","properties","searchParams","parsedQuery","adhocFilters","interpolateBucketAgg","expandedQuery","getDbVersionObservable","versionNumber","useCachedData","cached","freshDatabaseVersion","linksToApply","dataLink","generateDataLink","linkConfig","dataSourceSrv","dsSettings","rowTimeEpochMs","intervalPattern","exports","prefixCharWithBackslashes","char","extractChar","queryParser","escaping","peg$subclass","parent","ctor","peg$SyntaxError","expected","found","location","DESCRIBE_EXPECTATION_FNS","expectation","literalEscape","escapedParts","classEscape","hex","ch","describeExpectation","describeExpected","descriptions","describeFound","peg$parse","input","peg$FAILED","peg$startRuleFunctions","peg$parsestart","peg$startRuleFunction","peg$c0","peg$c1","peg$c2","operator","peg$c3","left","right","peg$c4","peg$c5","peg$c6","field_exp","peg$c7","peg$c8","peg$literalExpectation","peg$c9","peg$c10","peg$c11","peg$c12","fieldname","peg$c13","peg$c14","term","fieldexp","peg$c15","peg$c16","peg$classExpectation","peg$c17","peg$c18","op","proximity","boost","peg$c19","peg$c20","similarity","peg$c21","peg$c22","peg$c23","sequence","peg$c24","peg$c25","peg$c26","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","peg$c32","peg$c33","peg$c34","chars","peg$c35","peg$c36","peg$c37","peg$c38","peg$anyExpectation","peg$c39","peg$c40","peg$c41","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","peg$c50","peg$c51","peg$c52","peg$c53","peg$c54","peg$c55","peg$c56","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c62","peg$c63","peg$c64","peg$c65","peg$c66","peg$c67","peg$c68","peg$c69","peg$c70","peg$c71","peg$c72","peg$c73","peg$c74","fuzziness","peg$c75","peg$c76","peg$c77","peg$c78","peg$c79","val","peg$c80","peg$c81","peg$c82","peg$c83","term_min","term_max","peg$c84","peg$c85","peg$c86","peg$c87","peg$c88","peg$c89","peg$c90","peg$c91","peg$c92","peg$c93","peg$c94","peg$c95","peg$c96","peg$c97","peg$c98","peg$c99","peg$c100","peg$c101","peg$c102","peg$otherExpectation","peg$c103","peg$c104","peg$currPos","peg$savedPos","peg$posDetailsCache","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","peg$result","peg$computeLocation","peg$buildStructuredError","peg$buildSimpleError","ignoreCase","parts","inverted","peg$endExpectation","peg$computePosDetails","pos","details","p","startPos","endPos","startPosDetails","endPosDetails","peg$fail","s0","s1","s2","s3","peg$parse_","peg$parsenode","peg$parseEOF","s4","s5","peg$parseoperator_exp","peg$parsegroup_exp","peg$parsefield_exp","peg$parseparen_exp","s6","peg$parsefieldname","peg$parserange_operator_exp","peg$parseterm","peg$parseunquoted_term","peg$parseprefix_operator_exp","peg$parsequoted_term","peg$parseproximity_modifier","peg$parseboost_modifier","peg$parseregex_term","peg$parsefuzzy_modifier","peg$parserterm_char","peg$parseEscapeSequence","peg$parseranged_term","peg$parseterm_char","peg$parseDoubleStringCharacter","peg$parseRegexCharacter","peg$parseint_exp","peg$parsedecimal_or_int_exp","peg$parsedecimal_exp","s7","peg$parseoperator","peg$parseprefix_operator","module","implicit","toString"],"sourceRoot":""}
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
static
---
0755
0.c88fc16b6533c8976681.js
11857 bytes
0644
0.c88fc16b6533c8976681.js.map
46011 bytes
0644
1118.6d1cbbd2070e00a7483d.js
9459 bytes
0644
1118.6d1cbbd2070e00a7483d.js.map
22012 bytes
0644
1121.6c31bf81768d3312b0d4.js
11557 bytes
0644
1121.6c31bf81768d3312b0d4.js.map
40274 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js
4310 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js.map
9301 bytes
0644
1133.cd705902767ed2e9bf55.js
107191 bytes
0644
1133.cd705902767ed2e9bf55.js.map
459177 bytes
0644
1216.ddb58ad09e0c4e3f4079.js
12860 bytes
0644
1216.ddb58ad09e0c4e3f4079.js.map
47906 bytes
0644
1282.2347f27d5b3a18a42a1e.js
2965 bytes
0644
1282.2347f27d5b3a18a42a1e.js.map
6699 bytes
0644
1345.8570fef914aafab94513.js
2223 bytes
0644
1345.8570fef914aafab94513.js.map
5201 bytes
0644
1347.8ad23b870a6e21306189.js
32035 bytes
0644
1347.8ad23b870a6e21306189.js.map
89851 bytes
0644
1420.f2553cafc235b7c32261.js
14576 bytes
0644
1420.f2553cafc235b7c32261.js.map
32839 bytes
0644
1438.897db349b7f48a15b9eb.js
2830 bytes
0644
1438.897db349b7f48a15b9eb.js.map
6911 bytes
0644
1446.babd36e7134aac1046c4.js
1832 bytes
0644
1446.babd36e7134aac1046c4.js.map
3282 bytes
0644
1488.ff35935a06f41b02b6cc.js
316 bytes
0644
1488.ff35935a06f41b02b6cc.js.map
1206 bytes
0644
1560.30962127c91e5eae9982.js
8916 bytes
0644
1560.30962127c91e5eae9982.js.map
20515 bytes
0644
1660.e1f66118fb028d12074f.js
21866 bytes
0644
1660.e1f66118fb028d12074f.js.map
71039 bytes
0644
1698.68ff1ef08e94a87836b3.js
12570 bytes
0644
1698.68ff1ef08e94a87836b3.js.map
46006 bytes
0644
1708.f42a783c0f6c7a317d49.js
2249 bytes
0644
1708.f42a783c0f6c7a317d49.js.map
2954 bytes
0644
1710.d96221051fceaf8c89dd.js
10172 bytes
0644
1710.d96221051fceaf8c89dd.js.map
22097 bytes
0644
1740.e57d920c47a11759ade4.js
6204 bytes
0644
1740.e57d920c47a11759ade4.js.map
13740 bytes
0644
1888.0ede69d3190c536744b9.js
6822 bytes
0644
1888.0ede69d3190c536744b9.js.map
15421 bytes
0644
1914.58113477b565d57e8bfe.js
10710 bytes
0644
1914.58113477b565d57e8bfe.js.map
23555 bytes
0644
198.b84c0e4f5759344ae05a.js
8267 bytes
0644
198.b84c0e4f5759344ae05a.js.map
19446 bytes
0644
205.6c51b5e35c8147226738.js
3542 bytes
0644
205.6c51b5e35c8147226738.js.map
8376 bytes
0644
2058.0e5df44647184aaf02e2.js
1252 bytes
0644
2058.0e5df44647184aaf02e2.js.map
4744 bytes
0644
2077.12b2df3682085a92a810.js
34133 bytes
0644
2077.12b2df3682085a92a810.js.map
122011 bytes
0644
2094.259625d8acf28b9c7361.js
16518 bytes
0644
2094.259625d8acf28b9c7361.js.map
41269 bytes
0644
21.afca69f2d336e287a655.js
6172 bytes
0644
21.afca69f2d336e287a655.js.map
17305 bytes
0644
2136.9c8dcd43d3af327f51f5.js
498667 bytes
0644
2136.9c8dcd43d3af327f51f5.js.map
1908011 bytes
0644
2228.cf629cf4a83c5b6c2671.js
269 bytes
0644
2228.cf629cf4a83c5b6c2671.js.map
457 bytes
0644
2244.9324c28eca7d2ffb7568.js
3396 bytes
0644
2244.9324c28eca7d2ffb7568.js.map
7683 bytes
0644
2261.ac6a26854d5acee00776.js
106373 bytes
0644
2261.ac6a26854d5acee00776.js.map
478562 bytes
0644
2278.bdd73b14b6337c6b14e4.js
5754 bytes
0644
2278.bdd73b14b6337c6b14e4.js.map
13399 bytes
0644
2398.3de0e7aa3057b7dcf9da.js
8016 bytes
0644
2398.3de0e7aa3057b7dcf9da.js.map
18383 bytes
0644
2514.c86950e9813e27962050.js
1983 bytes
0644
2514.c86950e9813e27962050.js.map
4863 bytes
0644
2571.345ecfd2b82551018f2e.js
162139 bytes
0644
2571.345ecfd2b82551018f2e.js.map
2046 bytes
0644
2586.972e9a7d564398afee76.js
6385 bytes
0644
2586.972e9a7d564398afee76.js.map
14676 bytes
0644
2658.f4100815829c4d37d35c.js
5432 bytes
0644
2658.f4100815829c4d37d35c.js.map
13650 bytes
0644
2686.2fbaa7db9c01d59cad8d.js
2815 bytes
0644
2686.2fbaa7db9c01d59cad8d.js.map
6564 bytes
0644
2692.20098ad0182743d98d62.js
2282 bytes
0644
2692.20098ad0182743d98d62.js.map
5680 bytes
0644
2694.a31d749361a36eb167da.js
2726 bytes
0644
2694.a31d749361a36eb167da.js.map
3618 bytes
0644
2745.2e5ec1fdf377d2940fb4.js
33584 bytes
0644
2745.2e5ec1fdf377d2940fb4.js.map
120277 bytes
0644
2962.4c3147d8ee365fe296ef.js
7640 bytes
0644
2962.4c3147d8ee365fe296ef.js.map
17621 bytes
0644
3042.248a4194805a8500fd28.js
19010 bytes
0644
3042.248a4194805a8500fd28.js.map
38148 bytes
0644
3062.4e9a427c2a59d53f902e.js
4663 bytes
0644
3062.4e9a427c2a59d53f902e.js.map
10650 bytes
0644
3082.c09cff56c35d736ee8b6.js
52872 bytes
0644
3082.c09cff56c35d736ee8b6.js.map
56822 bytes
0644
3096.8d41728a4f5010bc56a2.js
4378 bytes
0644
3096.8d41728a4f5010bc56a2.js.map
10739 bytes
0644
3098.f22ad6dab13d06477be0.js
31462 bytes
0644
3098.f22ad6dab13d06477be0.js.map
85588 bytes
0644
3182.1d531f28507c00e391fc.js
13817 bytes
0644
3182.1d531f28507c00e391fc.js.map
26653 bytes
0644
3407.666eb88a718e66b93f72.js
34425 bytes
0644
3407.666eb88a718e66b93f72.js.map
103716 bytes
0644
3418.d31d882b87bd5a2ef66f.js
33061 bytes
0644
3418.d31d882b87bd5a2ef66f.js.map
114234 bytes
0644
3541.8d063e3d43d55745d89b.js
20582 bytes
0644
3541.8d063e3d43d55745d89b.js.map
67154 bytes
0644
3543.eecef49ce94da5ee0418.js
136752 bytes
0644
3543.eecef49ce94da5ee0418.js.map
446118 bytes
0644
3622.976b1aef94b333e450b9.js
1260 bytes
0644
3622.976b1aef94b333e450b9.js.map
2819 bytes
0644
3686.102abfc00452299017bb.js
87 bytes
0644
3718.3993946b7a0eb8f64b4d.js
23620 bytes
0644
3718.3993946b7a0eb8f64b4d.js.map
92024 bytes
0644
3726.3adfe210678d2cd26969.js
31765 bytes
0644
3726.3adfe210678d2cd26969.js.map
118227 bytes
0644
398.4e93ffb675609ea7a9c6.js
2990 bytes
0644
398.4e93ffb675609ea7a9c6.js.map
7145 bytes
0644
4114.953b39a9ce57caa0e87a.js
2536 bytes
0644
4114.953b39a9ce57caa0e87a.js.map
6028 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js
3229 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js.map
7533 bytes
0644
4209.c7060d489834063658f5.js
17352 bytes
0644
4209.c7060d489834063658f5.js.map
30980 bytes
0644
4254.c5f4a5512b252e3a5796.js
71716 bytes
0644
4254.c5f4a5512b252e3a5796.js.map
237783 bytes
0644
4289.d5662b0904798ff437e9.js
16496 bytes
0644
4289.d5662b0904798ff437e9.js.map
32015 bytes
0644
4334.bc078c368a20ed3257b6.js
2598 bytes
0644
4334.bc078c368a20ed3257b6.js.map
6308 bytes
0644
4630.b604ea691184ba563d59.js
5585 bytes
0644
4630.b604ea691184ba563d59.js.map
11866 bytes
0644
4680.358dfdd92851f69ecc97.js
4573 bytes
0644
4680.358dfdd92851f69ecc97.js.map
10841 bytes
0644
4698.696713071ff5d9929a11.js
3682 bytes
0644
4698.696713071ff5d9929a11.js.map
8967 bytes
0644
4787.bd938ea7cb58d64ee246.js
738 bytes
0644
4787.bd938ea7cb58d64ee246.js.map
2168 bytes
0644
4839.17a10e0ceca3eb8954b4.js
39585 bytes
0644
4839.17a10e0ceca3eb8954b4.js.map
145699 bytes
0644
494.8cf705bc1ea509187c88.js
3796 bytes
0644
494.8cf705bc1ea509187c88.js.map
8987 bytes
0644
4958.cd447d877778fc5af081.js
4923 bytes
0644
4958.cd447d877778fc5af081.js.map
11000 bytes
0644
4962.0da526ad79f816a15985.js
2242 bytes
0644
4962.0da526ad79f816a15985.js.map
4978 bytes
0644
50.7b1e44d5b9dbbed566be.js
617497 bytes
0644
50.7b1e44d5b9dbbed566be.js.map
2271464 bytes
0644
5017.003cacead1bba1cba035.js
3567142 bytes
0644
5017.003cacead1bba1cba035.js.map
13214665 bytes
0644
5130.4d31108de97088a3b014.js
2850 bytes
0644
5130.4d31108de97088a3b014.js.map
6536 bytes
0644
5196.064b914693b6a5591a48.js
4035 bytes
0644
5196.064b914693b6a5591a48.js.map
10273 bytes
0644
5240.eceb5f73f807ac22d800.js
704 bytes
0644
5240.eceb5f73f807ac22d800.js.map
2618 bytes
0644
5277.ce6608b6f47246e32767.js
269 bytes
0644
5277.ce6608b6f47246e32767.js.map
457 bytes
0644
5280.4348c762594edebf7d0e.js
16657 bytes
0644
5280.4348c762594edebf7d0e.js.map
89146 bytes
0644
5356.eabc0dc2021a3814a65f.js
10156 bytes
0644
5356.eabc0dc2021a3814a65f.js.map
25249 bytes
0644
5358.7c5e9e1b192582f3082d.js
6173 bytes
0644
5358.7c5e9e1b192582f3082d.js.map
19652 bytes
0644
5364.ac21c32fd45a27bc998a.js
3070 bytes
0644
5364.ac21c32fd45a27bc998a.js.map
7368 bytes
0644
5398.d0c11aa7c1232f4afe44.js
81872 bytes
0644
5398.d0c11aa7c1232f4afe44.js.map
769414 bytes
0644
5428.e85b0800b30feca9d7dc.js
330175 bytes
0644
5428.e85b0800b30feca9d7dc.js.map
530929 bytes
0644
5511.93023985e5c5efe49ae2.js
21275 bytes
0644
5511.93023985e5c5efe49ae2.js.map
93188 bytes
0644
5550.9284e42acc3f2bbdfc9d.js
7039 bytes
0644
5550.9284e42acc3f2bbdfc9d.js.map
16382 bytes
0644
558.701e8b4db7b852c4a10d.js
12211 bytes
0644
558.701e8b4db7b852c4a10d.js.map
24505 bytes
0644
5618.638c32d58d896f3f7261.js
3348 bytes
0644
5618.638c32d58d896f3f7261.js.map
8181 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js
57392 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js.map
60585 bytes
0644
5786.db7abc3b8e4f474a8f7b.js
5325 bytes
0644
5786.db7abc3b8e4f474a8f7b.js.map
11885 bytes
0644
5807.f05d997ece5811bbc849.js
2922915 bytes
0644
5807.f05d997ece5811bbc849.js.map
10524334 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js
4616249 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js.map
19277501 bytes
0644
6018.f4de7ac19ac8f0c774e6.js
5861 bytes
0644
6018.f4de7ac19ac8f0c774e6.js.map
13314 bytes
0644
6029.0549a3fcb50e73c4b256.js
409895 bytes
0644
6029.0549a3fcb50e73c4b256.js.map
998408 bytes
0644
6185.883629fcc773b4968b24.js
2258 bytes
0644
6185.883629fcc773b4968b24.js.map
4788 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js
54594 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js.map
242030 bytes
0644
6302.257b2eb06c25ee74090e.js
8440 bytes
0644
6302.257b2eb06c25ee74090e.js.map
19322 bytes
0644
6359.f824c85233ec703f8cea.js
11411 bytes
0644
6359.f824c85233ec703f8cea.js.map
41881 bytes
0644
6377.45d36c143a694fc45bd3.js
20571 bytes
0644
6377.45d36c143a694fc45bd3.js.map
79590 bytes
0644
6378.27b1e6d863a0a3b85962.js
977993 bytes
0644
6378.27b1e6d863a0a3b85962.js.map
3865587 bytes
0644
6414.192cf271de6ecbbbcb11.js
3984 bytes
0644
6414.192cf271de6ecbbbcb11.js.map
9134 bytes
0644
6446.b4b93ee91aa1bb57ea93.js
7731 bytes
0644
6446.b4b93ee91aa1bb57ea93.js.map
17485 bytes
0644
6464.f379e014f9909e621de6.js
34429 bytes
0644
6464.f379e014f9909e621de6.js.map
113303 bytes
0644
6499.9f52e0855fd4782a8b45.js
78297 bytes
0644
6499.9f52e0855fd4782a8b45.js.map
273155 bytes
0644
6587.bfb1ca0c32c6f325b0df.js
135004 bytes
0644
6587.bfb1ca0c32c6f325b0df.js.map
541974 bytes
0644
660.838743295c2108f3492d.js
43101 bytes
0644
660.838743295c2108f3492d.js.map
100340 bytes
0644
6678.a615dbe07b8a3e591e66.js
14725 bytes
0644
6678.a615dbe07b8a3e591e66.js.map
51145 bytes
0644
680.1a328432fae403eacab3.js
53846 bytes
0644
680.1a328432fae403eacab3.js.map
57615 bytes
0644
6830.0c200fec1efc2be388e2.js
5811 bytes
0644
6830.0c200fec1efc2be388e2.js.map
13972 bytes
0644
6934.fa19d392db34411fb300.js
168944 bytes
0644
6934.fa19d392db34411fb300.js.map
540337 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js
3408 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js.map
8039 bytes
0644
6969.f8f153735314f9426000.js
1119 bytes
0644
6969.f8f153735314f9426000.js.map
4230 bytes
0644
6990.cc2f5674128929a3f870.js
4418 bytes
0644
6990.cc2f5674128929a3f870.js.map
10503 bytes
0644
7048.117de444b1e1cb5a1360.js
4365 bytes
0644
7048.117de444b1e1cb5a1360.js.map
10316 bytes
0644
7166.480da6892ee84ee8bb53.js
593985 bytes
0644
7166.480da6892ee84ee8bb53.js.map
2430098 bytes
0644
7200.dc60128b9d612fc7b5b0.js
3634 bytes
0644
7200.dc60128b9d612fc7b5b0.js.map
8184 bytes
0644
7246.3adf293a34fa2043387b.js
4306 bytes
0644
7246.3adf293a34fa2043387b.js.map
9084 bytes
0644
7400.024c96bd5b99b8b47a63.js
14112 bytes
0644
7400.024c96bd5b99b8b47a63.js.map
64001 bytes
0644
7409.24316c87d08c1053c46a.js
3287 bytes
0644
7409.24316c87d08c1053c46a.js.map
11649 bytes
0644
7455.845968885abe369e6479.js
19801 bytes
0644
7455.845968885abe369e6479.js.map
77213 bytes
0644
7466.09e6e197d2507f62097d.js
11670 bytes
0644
7466.09e6e197d2507f62097d.js.map
24830 bytes
0644
7515.95323f0dfbd0de010e5c.js
1083 bytes
0644
7515.95323f0dfbd0de010e5c.js.map
1321 bytes
0644
7613.6334cff4df12cc157522.js
808779 bytes
0644
7613.6334cff4df12cc157522.js.map
991378 bytes
0644
7836.6a7e4207e70fc2dc235f.js
7192 bytes
0644
7836.6a7e4207e70fc2dc235f.js.map
17613 bytes
0644
7882.1a3cc418752c83396970.js
3743 bytes
0644
7882.1a3cc418752c83396970.js.map
14950 bytes
0644
7886.485c46f14540aa23cf70.js
8668 bytes
0644
7886.485c46f14540aa23cf70.js.map
20124 bytes
0644
7914.2b1a06c504df18e20fe4.js
2390 bytes
0644
7914.2b1a06c504df18e20fe4.js.map
6418 bytes
0644
7982.6761217193d3060dbf0e.js
188973 bytes
0644
7982.6761217193d3060dbf0e.js.map
1737667 bytes
0644
8054.094788468423bb88ee68.js
38124 bytes
0644
8054.094788468423bb88ee68.js.map
132296 bytes
0644
8107.92bd414247a1d05c014f.js
5144 bytes
0644
8107.92bd414247a1d05c014f.js.map
15320 bytes
0644
8230.2eedae6021a4715c6dea.js
2413 bytes
0644
8230.2eedae6021a4715c6dea.js.map
5812 bytes
0644
8332.f4b05d2f028641445650.js
3177 bytes
0644
8332.f4b05d2f028641445650.js.map
7186 bytes
0644
8334.c95ec0eb6900c0cf7e89.js
7803 bytes
0644
8334.c95ec0eb6900c0cf7e89.js.map
17714 bytes
0644
8390.1fd9505094c8cf8830ab.js
2096 bytes
0644
8390.1fd9505094c8cf8830ab.js.map
5157 bytes
0644
84.a6f8658e6a033d642231.js
30608 bytes
0644
84.a6f8658e6a033d642231.js.map
142543 bytes
0644
8494.4470c87b7093ddf70db7.js
2180 bytes
0644
8494.4470c87b7093ddf70db7.js.map
4863 bytes
0644
8542.1391ab96a455b01963a7.js
1514 bytes
0644
8542.1391ab96a455b01963a7.js.map
3249 bytes
0644
8566.e05562713181c6ca30fe.js
3852 bytes
0644
8566.e05562713181c6ca30fe.js.map
8781 bytes
0644
8730.3dcdd8cbf22c63b45d78.js
2109 bytes
0644
8730.3dcdd8cbf22c63b45d78.js.map
2893 bytes
0644
8786.1b0e43b80c82c73e2096.js
1535 bytes
0644
8786.1b0e43b80c82c73e2096.js.map
4055 bytes
0644
8902.37d0b14aa6ef24687b7b.js
2673 bytes
0644
8902.37d0b14aa6ef24687b7b.js.map
5993 bytes
0644
8990.5a822b8788ebf0bdba81.js
3969 bytes
0644
8990.5a822b8788ebf0bdba81.js.map
9161 bytes
0644
9034.200fc7a09b466256c9a9.js
3486 bytes
0644
9034.200fc7a09b466256c9a9.js.map
8180 bytes
0644
9038.7ae2448b9cc5c423aeca.js
4937 bytes
0644
9038.7ae2448b9cc5c423aeca.js.map
11973 bytes
0644
9118.3121c6b96ec7dc211973.js
48311 bytes
0644
9118.3121c6b96ec7dc211973.js.map
62149 bytes
0644
9150.9eb62d45f9b21cb38850.js
10056 bytes
0644
9150.9eb62d45f9b21cb38850.js.map
21143 bytes
0644
9199.9897e268d6d13e834d4c.js
2307 bytes
0644
9199.9897e268d6d13e834d4c.js.map
8853 bytes
0644
9320.c403e78b78aa6df1d0bd.js
336139 bytes
0644
9320.c403e78b78aa6df1d0bd.js.map
1624993 bytes
0644
9355.421530b20c759bb75633.js
22098 bytes
0644
9355.421530b20c759bb75633.js.map
66961 bytes
0644
9384.a0d5fc49f1b15b3e311e.js
2855 bytes
0644
9384.a0d5fc49f1b15b3e311e.js.map
3717 bytes
0644
9390.fa2af7f3d3d9600c08ee.js
4201 bytes
0644
9390.fa2af7f3d3d9600c08ee.js.map
9682 bytes
0644
946.f2494c0c39a9590349b9.js
9194 bytes
0644
946.f2494c0c39a9590349b9.js.map
22193 bytes
0644
9510.4cfa85a51931dc20573a.js
2949 bytes
0644
9510.4cfa85a51931dc20573a.js.map
6939 bytes
0644
9521.de2a74ca5eb365810ca5.js
46306 bytes
0644
9521.de2a74ca5eb365810ca5.js.map
51040 bytes
0644
9538.996ade7a03ccdb01942d.js
64493 bytes
0644
9538.996ade7a03ccdb01942d.js.map
49212 bytes
0644
9569.a8d60b39654a160cb917.js
27965 bytes
0644
9569.a8d60b39654a160cb917.js.map
99160 bytes
0644
9643.b408884004ca73c102bc.js
627 bytes
0644
9643.b408884004ca73c102bc.js.map
2195 bytes
0644
968.22e079d28acb4131d34c.js
4001 bytes
0644
968.22e079d28acb4131d34c.js.map
9740 bytes
0644
970.a61e37b9b897c8098261.js
5239 bytes
0644
970.a61e37b9b897c8098261.js.map
13858 bytes
0644
9711.d6e977bd60f0e5ba673d.js
13555 bytes
0644
9711.d6e977bd60f0e5ba673d.js.map
43973 bytes
0644
9737.3340c89ea96d33307cc7.js
1001 bytes
0644
9737.3340c89ea96d33307cc7.js.map
3504 bytes
0644
9739.5a801055fcf72bf4d06f.js
1147 bytes
0644
9739.5a801055fcf72bf4d06f.js.map
4390 bytes
0644
9772.49e918c9331237552c0b.js
141 bytes
0644
9772.49e918c9331237552c0b.js.map
416 bytes
0644
9838.b8f01dc360f0c2151291.js
4003 bytes
0644
9838.b8f01dc360f0c2151291.js.map
8118 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js
22504 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js.map
67352 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js
6369 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js.map
20602 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js
4939 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js.map
16531 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js
2702 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js.map
7735 bytes
0644
AdminSettings.845c6def917892a0c1f9.js
1903 bytes
0644
AdminSettings.845c6def917892a0c1f9.js.map
5580 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js
54554 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js.map
208792 bytes
0644
AlertGroups.efd523dc41621f9f7935.js
10088 bytes
0644
AlertGroups.efd523dc41621f9f7935.js.map
39108 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js
44623 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js.map
156842 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js
6270 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js.map
18086 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js
24687 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js.map
83377 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js
9844 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js.map
27934 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js
10523 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js.map
37393 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js
672 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js.map
1220 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js
33492 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js.map
106868 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js
3648 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js.map
10875 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js
79931 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js.map
292923 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js
31333 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js.map
98330 bytes
0644
AngularApp.7e72879caebef22a5217.js
72809 bytes
0644
AngularApp.7e72879caebef22a5217.js.map
102853 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js
8422 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js.map
23375 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js
2941 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js.map
9749 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js
470 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js.map
1195 bytes
0644
Connections.b53c715b9b9a782d8647.js
32448 bytes
0644
Connections.b53c715b9b9a782d8647.js.map
112998 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js
674 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js.map
1149 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js
22725 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js.map
69262 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js
3046 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js.map
9594 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js
18153 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js.map
58242 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js
30967 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js.map
108517 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js
2786 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js.map
8754 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js
65136 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js.map
226791 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js
331 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js.map
582 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js
10507 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js.map
37444 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js
1768 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js.map
5917 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js
9633 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js.map
29985 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js
8599 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js.map
25919 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js
2704 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js.map
7623 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js
4713 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js.map
14309 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js
20855 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js.map
58932 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js
9785 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js.map
32951 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js
1325 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js.map
3158 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js
2547 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js.map
6671 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js
1620 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js.map
3378 bytes
0644
NotificationsPage.d26b90d7348139106351.js
4646 bytes
0644
NotificationsPage.d26b90d7348139106351.js.map
25381 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js
6742 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js.map
17850 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js
6892 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js.map
19989 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js
6583 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js.map
19084 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js
7895 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js.map
25502 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js
275 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js.map
698 bytes
0644
PluginListPage.815b65d32380d0a800f7.js
12167 bytes
0644
PluginListPage.815b65d32380d0a800f7.js.map
43537 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js
314 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js.map
668 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js
552 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js.map
1012 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js
4295 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js.map
14393 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js
1124 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js.map
2993 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js
1736 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js.map
4350 bytes
0644
ServerStats.3fbd2493deb8f4598755.js
3863 bytes
0644
ServerStats.3fbd2493deb8f4598755.js.map
11534 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js
2440 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js.map
7939 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js
14806 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js.map
51593 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js
14565 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js.map
46399 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js
2360 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js.map
6096 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js
3061 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js.map
9043 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js
3229 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js.map
12316 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js
1727 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js.map
5509 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js
14081 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js.map
48740 bytes
0644
SupportBundles.567d512b3f919b8112e4.js
3058 bytes
0644
SupportBundles.567d512b3f919b8112e4.js.map
8751 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js
2779 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js.map
8882 bytes
0644
TeamList.2e23d37c91734f608f09.js
9019 bytes
0644
TeamList.2e23d37c91734f608f09.js.map
30348 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js
22839 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js.map
66001 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js
2654 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js.map
8058 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js
1470 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js.map
3788 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js
2576 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js.map
6594 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js
25463 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js.map
79671 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js
14593 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js.map
42901 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js
8800 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js.map
30059 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js
957 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js.map
3199 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js
1429 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js.map
4041 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js
3810 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js.map
10753 bytes
0644
app.b11fde05d43f9632a473.js
920821 bytes
0644
app.b11fde05d43f9632a473.js.map
69088 bytes
0644
assets-manifest.json
280835 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js
232 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js.map
600 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js
371235 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js.map
1132097 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js
485254 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js.map
2136916 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js
198 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js.map
555 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js
192 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js.map
544 bytes
0644
dark.7fa24d1908c1c96e6fcc.js
134 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js
214 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js.map
583 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js
612 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js.map
1280 bytes
0644
explore.476912733278e2a99729.js
165810 bytes
0644
explore.476912733278e2a99729.js.map
579148 bytes
0644
geomapPanel.14b9605971a38c51d262.js
417078 bytes
0644
geomapPanel.14b9605971a38c51d262.js.map
540371 bytes
0644
grafana.dark.8c716fbcf630eae84ced.css
209089 bytes
0644
grafana.light.b8b3904788f25480f4a1.css
209047 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js
8654 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js.map
28174 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js
70277 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js.map
243430 bytes
0644
graphitePlugin.d59175976346917781fe.js
75305 bytes
0644
graphitePlugin.d59175976346917781fe.js.map
272016 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js
37545 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js.map
158066 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js
68843 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js.map
265085 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js
19727 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js.map
65603 bytes
0644
light.af65e5ce03b9ed0aa2b1.js
134 bytes
0644
loki-query-field.a588d587d9d762b18f22.js
191 bytes
0644
loki-query-field.a588d587d9d762b18f22.js.map
548 bytes
0644
lokiPlugin.77364509de280321b6f8.js
185 bytes
0644
lokiPlugin.77364509de280321b6f8.js.map
536 bytes
0644
mixedPlugin.f36bd557a883d9a67538.js
180 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js
20457 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js.map
61420 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js
17323 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js.map
45415 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js
2107 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js.map
7132 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js
22866 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js.map
82180 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js
11184 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js.map
42340 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js
18902 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js.map
54304 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js
14104 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js.map
76811 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js
224 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js.map
699 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js
22269 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js.map
86896 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js
15759 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js.map
51544 bytes
0644
runtime.4b7e1b5735d2ed64b824.js
13640 bytes
0644
runtime.4b7e1b5735d2ed64b824.js.map
35122 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js
25242 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js.map
80497 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js
182 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js.map
529 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js
120550 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js.map
303302 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js
459653 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js.map
1951742 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js
13172 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js.map
46861 bytes
0644
N4ST4R_ID | Naxtarrr