mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
(cherry picked from commit 081973f5e0
)
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
This commit is contained in:
parent
2fb0328899
commit
d7b67f4c41
3 changed files with 11 additions and 11 deletions
|
@ -5,15 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { DataViewFieldBase } from '@kbn/es-query';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataPublicPluginStart, IFieldType, IIndexPattern } from 'src/plugins/data/public';
|
||||
import { DataPublicPluginStart, IIndexPattern } from 'src/plugins/data/public';
|
||||
import { prefixIndexPattern } from '../../../../common/ccs_utils';
|
||||
import {
|
||||
INDEX_PATTERN_BEATS,
|
||||
INDEX_PATTERN_ELASTICSEARCH,
|
||||
INDEX_PATTERN_KIBANA,
|
||||
INDEX_PATTERN_LOGSTASH,
|
||||
} from '../../../../common/constants';
|
||||
import { prefixIndexPattern } from '../../../../common/ccs_utils';
|
||||
import { MonitoringConfig } from '../../../types';
|
||||
|
||||
const INDEX_PATTERNS = `${INDEX_PATTERN_ELASTICSEARCH},${INDEX_PATTERN_KIBANA},${INDEX_PATTERN_LOGSTASH},${INDEX_PATTERN_BEATS}`;
|
||||
|
@ -24,7 +25,7 @@ export const useDerivedIndexPattern = (
|
|||
): { loading: boolean; derivedIndexPattern: IIndexPattern } => {
|
||||
const indexPattern = prefixIndexPattern(config || ({} as MonitoringConfig), INDEX_PATTERNS, '*');
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [fields, setFields] = useState<IFieldType[]>([]);
|
||||
const [fields, setFields] = useState<DataViewFieldBase[]>([]);
|
||||
useEffect(() => {
|
||||
(async function fetchData() {
|
||||
const result = await data.indexPatterns.getFieldsForWildcard({
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { fromKueryExpression } from '@kbn/es-query';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { WithKueryAutocompletion } from './with_kuery_autocompletion';
|
||||
import { IIndexPattern, QuerySuggestion } from '../../../../../../src/plugins/data/public';
|
||||
import { AutocompleteField } from './autocomplete_field';
|
||||
import { esKuery, IIndexPattern, QuerySuggestion } from '../../../../../../src/plugins/data/public';
|
||||
import { WithKueryAutocompletion } from './with_kuery_autocompletion';
|
||||
|
||||
type LoadSuggestionsFn = (
|
||||
e: string,
|
||||
|
@ -31,7 +31,7 @@ interface Props {
|
|||
|
||||
function validateQuery(query: string) {
|
||||
try {
|
||||
esKuery.fromKueryExpression(query);
|
||||
fromKueryExpression(query);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { esKuery, IIndexPattern } from '../../../../../src/plugins/data/public';
|
||||
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
|
||||
import { IIndexPattern } from '../../../../../src/plugins/data/public';
|
||||
|
||||
export const convertKueryToElasticSearchQuery = (
|
||||
kueryExpression: string,
|
||||
|
@ -13,9 +14,7 @@ export const convertKueryToElasticSearchQuery = (
|
|||
) => {
|
||||
try {
|
||||
return kueryExpression
|
||||
? JSON.stringify(
|
||||
esKuery.toElasticsearchQuery(esKuery.fromKueryExpression(kueryExpression), indexPattern)
|
||||
)
|
||||
? JSON.stringify(toElasticsearchQuery(fromKueryExpression(kueryExpression), indexPattern))
|
||||
: '';
|
||||
} catch (err) {
|
||||
return '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue