[ML] Explain Log Rate Spikes: Fix wide time range display with sparse data. (#147129)

The `date_histogram` query was updated to use `min_doc_count: 0` and set
`extended_bounds` to the date pickers time range so it returns buckets
for all necessary time slots necessary for the full date histogram bar
chart.
This commit is contained in:
Walter Rafelsberger 2022-12-12 13:27:15 +01:00 committed by GitHub
parent 6b36bc4c72
commit a152bf98b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -12,9 +12,10 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { WindowParameters } from '@kbn/aiops-utils';
import { DocumentCountStats } from '../../../get_document_stats';
import { DocumentCountChart, DocumentCountChartPoint } from '../document_count_chart';
import { TotalCountHeader } from '../total_count_header';
import { DocumentCountStats } from '../../../get_document_stats';
const clearSelectionLabel = i18n.translate(
'xpack.aiops.documentCountContent.clearSelectionAriaLabel',

View file

@ -97,7 +97,7 @@ export const ExplainLogRateSpikesPage: FC<ExplainLogRateSpikesPageProps> = ({
queryLanguage: SearchQueryLanguage;
filters: Filter[];
}) => {
// When the user loads saved search and then clear or modify the query
// When the user loads a saved search and then clears or modifies the query
// we should remove the saved search and replace it with the index pattern id
if (currentSavedSearch !== null) {
setCurrentSavedSearch(null);

View file

@ -71,7 +71,11 @@ export const getDocumentCountStatsRequest = (params: DocumentStatsSearchStrategy
date_histogram: {
field: timeFieldName,
fixed_interval: `${intervalMs}ms`,
min_doc_count: 1,
min_doc_count: 0,
extended_bounds: {
min: earliestMs,
max: latestMs,
},
},
},
};