[ES|QL] Ignore drop commands for date histogram in discover#171769
[ES|QL] Ignore drop commands for date histogram in discover#171769dej611 merged 10 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
|
@dej611 looks great. How easy is to not display the @timestamp column in the datatable?
|
Fixed with c47ab3f . |
|
We lost the @timestamp column here and we dont want it. We want the @timestamp column to disappear when the user drops the @timestamp if possible not always.
|
| ) { | ||
| const timeFieldName = dataView.timeFieldName; | ||
|
|
||
| if (isPlainRecord) { |
There was a problem hiding this comment.
This hides the @timestamp column all the time. We don't want that. We just want to hide it when the user is dropping the field
There was a problem hiding this comment.
Fixed with 78fae0a added also a full text coverage for the new utility function.
stratoula
left a comment
There was a problem hiding this comment.
Changes LGTM, this works exactly as I am expecting 👏
|
Please excuse my naive and uninvited question, but we're also consumers of the unified histogram. 😇 Is this string manipulation safe without parsing the ES|QL AST? What happens to a query like |
| return showTimeCol; | ||
| } | ||
| // flattened is the _source content in this case | ||
| return rows.some((row) => timeFieldName in row.flattened); |
There was a problem hiding this comment.
Iterating through all results can be a long operation. Can we avoid it?
There was a problem hiding this comment.
For example, we could search in the returned ESQL fields. UnifiedDataTable accesses them via columnTypes. So in your case it could be:
return Boolean(columnTypes[timeFieldName])
| return ''; | ||
| } | ||
|
|
||
| export function cleanupESQLQuery(esql?: string): string { |
There was a problem hiding this comment.
Would be great to describe the purpose of the clean up. Or at least change the function name to something like cleanupESQLQueryForLensSuggestions
This is more a general issue and probably with #170071 will be possible to perform query manipulation like that. For now that ES|QL query will break as there's often the basic assumption that commands are separated by |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |


Summary
Fixes #169907
This PR cleans the ES|QL statement from DROP commands before sending it over for the date histogram chart in Lens.
Checklist
Delete any items that are not applicable to this PR.