-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ES|QL] Hide field statistics tab and Dashboard when ES|QL is in use, disable Index data visualizer for MATCH and QSRT functions #197538
Changes from 4 commits
f5fa6c6
8736c72
b35e69c
2957796
aff1b6f
a6145ce
ae086fc
1f9cef4
38d47b9
fafcc26
db63c8b
b2b7222
7321cf5
4215c9c
347e1ec
989a523
2dd74e9
3ec8263
cd06f88
2c4f740
0dfc116
881e57b
7ea2efb
b3c356e
bafff15
a8cd5be
6b7ee45
dc99c68
9d4f0f1
eabc053
62c5496
5ccbdf7
47f6210
ed826d0
5cf259a
2f2b2fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
import type { AggregateQuery, Query } from '@kbn/es-query'; | ||
import { Walker } from '@kbn/esql-ast'; | ||
import { parse } from '@kbn/esql-ast'; | ||
import { isOfAggregateQueryType } from '@kbn/es-query'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
const FIELD_STATISTICS_LABEL = i18n.translate('unifiedFieldList.fieldStats.fieldStatisticsLabel', { | ||
defaultMessage: `Field statistics`, | ||
}); | ||
|
||
export const FIELD_DATA_LABEL = i18n.translate('unifiedFieldList.fieldStats.fieldDataLabel', { | ||
defaultMessage: `Field data`, | ||
}); | ||
|
||
export const getReasonIfFieldStatsUnavailableForQuery = ( | ||
query?: AggregateQuery | Query | { [key: string]: any }, | ||
label: string = FIELD_STATISTICS_LABEL | ||
): string | undefined => { | ||
if (isOfAggregateQueryType(query)) { | ||
const { root } = parse(query.esql); | ||
|
||
if (Walker.hasFunction(root, 'match') || Walker.hasFunction(root, 'qstr')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quynh lets add this check to the esql-utils, these fucntions have a lot of limitations so it will get in handy for other consumers too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a util here |
||
return i18n.translate( | ||
'unifiedFieldList.fieldStats.notAvailableForMatchESQLQueryDescription', | ||
{ | ||
defaultMessage: `{label} is unavailable for ES|QL queries containing 'MATCH' or 'QSTR' functions.`, | ||
values: { label }, | ||
} | ||
); | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: should we also skip the request to ES in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Definitely. Thanks for catching that. I'll make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!