Skip to content

Commit

Permalink
[Discover] Address the flaky histogram code (elastic#201809)
Browse files Browse the repository at this point in the history
- Closes elastic#201744
- Similar to elastic#184600

## Summary

This PR fixes the issues with the transition from a data view without a
time field to a data view with a time field.

Previously reported error:
![management Index patterns on aliases discover verify hits should be
able to
disc-4da8c0b87362e3312cae00dc943a984acfda9af98d821decb6f48164eaca21ae](https://github.com/user-attachments/assets/652096ef-70c1-4394-a665-6b2b15d976ec)

(cherry picked from commit f50b93c)
  • Loading branch information
jughosta committed Nov 28, 2024
1 parent eb0abce commit 230d8cb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,13 @@ export class LensVisService {
queryParams: QueryParams;
timeInterval: string | undefined;
breakdownField: DataViewField | undefined;
}): Suggestion => {
}): Suggestion | undefined => {
const { dataView } = queryParams;

if (!dataView.isTimeBased() || !dataView.timeFieldName) {
return undefined;
}

const showBreakdown = breakdownField && fieldSupportsBreakdown(breakdownField);

let columnOrder = ['date_column', 'count_column'];
Expand All @@ -343,7 +348,7 @@ export class LensVisService {
date_column: {
dataType: 'date',
isBucketed: true,
label: dataView.timeFieldName ?? '',
label: dataView.timeFieldName,
operationType: 'date_histogram',
scale: 'interval',
sourceField: dataView.timeFieldName,
Expand Down

0 comments on commit 230d8cb

Please sign in to comment.