kibana/packages/kbn-es-query/index.ts
Clint Andrew Hall 450f9f62e2
[ES|QL] Bypass no data views screen (#174316)
> Derived from https://github.com/elastic/kibana/pull/173068
> Further addresses https://github.com/elastic/kibana/issues/169873

## Summary

- We're adding a link to the No Data Prompt to send a person to explore
their data using ES|QL if there exists any ingested data but no data
view.
- This PR populates the query bar with the first available index (some
special handling for logs index.
2a9edec678)
- All consumers of the prompt/no data view are updated in this PR.
- [x] ~There's an issue where, if you're in Discover, clicking the link
won't refresh the page. .~ This is fixed on Discover side by
reinitializing the state container when user clicks the "try es|ql" link
and URL state updates.
- [x] ~There is an issue that you can save the es|ql chart from
Discover, but Dashboard's empty screen blocks the navigation because
data views don't exist
https://github.com/elastic/kibana/pull/174316#issuecomment-1914722657~.
This is fixed by allowing the dashboard to work without the default data
view. Hopefully, this won't lead to major issues
- [x] ~ES|QL panels can't be created without the default data views~
this is fixed by trying to fallback to an ad-hoc dataview, plan to move
that code to the utils introduced here
https://github.com/elastic/kibana/pull/174736/
- [x] fix circular deps
- [x] Add functional tests


## Visuals



af3592c1-f4c8-43bb-a128-3268b7761367




### Storybook Stories

#### Can access ES|QL

![Screenshot 2024-01-31 at 17 05
47](370d0351-198e-4dc3-b22e-86f497ad4df5)


#### Cannot access (e.g. preview is unavailable - _not implemented_)

![Screenshot 2024-01-31 at 17 05
59](c2bf52ab-9fa8-4f25-9e5d-512d4f4342fa)


---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Rachel Shen <rshen@elastic.co>
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
2024-02-05 15:09:27 +01:00

130 lines
2.7 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export type {
BoolQuery,
DataViewBase,
DataViewFieldBase,
EsQueryConfig,
EsQueryFiltersConfig,
IFieldSubType,
IFieldSubTypeMulti,
IFieldSubTypeNested,
} from './src/es_query';
export type {
CustomFilter,
ExistsFilter,
FieldFilter,
Filter,
FilterCompareOptions,
FilterMeta,
LatLon,
MatchAllFilter,
PhraseFilter,
PhrasesFilter,
Query,
AggregateQuery,
QueryStringFilter,
RangeFilter,
RangeFilterMeta,
RangeFilterParams,
ScriptedPhraseFilter,
ScriptedRangeFilter,
TimeRange,
CombinedFilter,
} from './src/filters';
export type { DslQuery, KueryNode, KueryParseOptions, KueryQueryOptions } from './src/kuery';
export {
buildEsQuery,
buildQueryFromFilters,
filterToQueryDsl,
decorateQuery,
luceneStringToDsl,
migrateFilter,
fromCombinedFilter,
isOfQueryType,
isOfEsqlQueryType,
isOfAggregateQueryType,
getAggregateQueryMode,
getLanguageDisplayName,
} from './src/es_query';
export {
COMPARE_ALL_OPTIONS,
FILTERS,
FilterStateStore,
buildCustomFilter,
buildEmptyFilter,
buildExistsFilter,
buildFilter,
buildCombinedFilter,
buildPhraseFilter,
buildPhrasesFilter,
buildQueryFilter,
buildRangeFilter,
cleanFilter,
compareFilters,
dedupFilters,
disableFilter,
enableFilter,
getConvertedValueForField,
getFilterField,
getFilterParams,
getPhraseFilterField,
getPhraseFilterValue,
getPhraseScript,
getRangeScript,
isExistsFilter,
isFilter,
isFilterDisabled,
isFilterPinned,
isFilters,
isMatchAllFilter,
isCombinedFilter,
isPhraseFilter,
isPhrasesFilter,
isQueryStringFilter,
isRangeFilter,
isScriptedPhraseFilter,
isScriptedRangeFilter,
onlyDisabledFiltersChanged,
pinFilter,
toggleFilterDisabled,
toggleFilterNegated,
toggleFilterPinned,
uniqFilters,
unpinFilter,
updateFilter,
extractTimeFilter,
extractTimeRange,
convertRangeFilterToTimeRange,
BooleanRelation,
} from './src/filters';
export {
KQLSyntaxError,
fromKueryExpression,
toKqlExpression,
nodeBuilder,
nodeTypes,
toElasticsearchQuery,
escapeKuery,
escapeQuotes,
} from './src/kuery';
export {
getDataViewFieldSubtypeMulti,
getDataViewFieldSubtypeNested,
isDataViewFieldSubtypeMulti,
isDataViewFieldSubtypeNested,
} from './src/utils';
export type { ExecutionContextSearch } from './src/expressions/types';