Skip to content

Commit

Permalink
[TSVB] Field validation should not be performed on string indexes. (#…
Browse files Browse the repository at this point in the history
…97052)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
alexwizp and kibanamachine authored Apr 14, 2021
1 parent 69f570f commit 3b7ef07
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export function getIntervalAndTimefield(
(series.override_index_pattern ? series.series_time_field : panel.time_field) ||
index.indexPattern?.timeFieldName;

validateField(timeField!, index);
if (panel.use_kibana_indexes) {
validateField(timeField!, index);
}

let interval = panel.interval;
let maxBars = panel.max_bars;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export function dateHistogram(
const barTargetUiSettings = await uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET);
const timeField = annotation.time_field || annotationIndex.indexPattern?.timeFieldName || '';

validateField(timeField, annotationIndex);
if (panel.use_kibana_indexes) {
validateField(timeField, annotationIndex);
}

const { bucketSize, intervalString } = getBucketSize(
req,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function query(
const barTargetUiSettings = await uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET);
const timeField = (annotation.time_field || annotationIndex.indexPattern?.timeFieldName) ?? '';

validateField(timeField, annotationIndex);
if (panel.use_kibana_indexes) {
validateField(timeField, annotationIndex);
}

const { bucketSize } = getBucketSize(req, 'auto', capabilities, barTargetUiSettings);
const { from, to } = getTimerange(req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export function topHits(req, panel, annotation, esQueryConfig, annotationIndex)
const fields = (annotation.fields && annotation.fields.split(/[,\s]+/)) || [];
const timeField = annotation.time_field || annotationIndex.indexPattern?.timeFieldName || '';

validateField(timeField, annotationIndex);
if (panel.use_kibana_indexes) {
validateField(timeField, annotationIndex);
}

overwrite(doc, `aggs.${annotation.id}.aggs.hits.top_hits`, {
sort: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function dateHistogram(
intervalString,
bucketSize,
seriesId: series.id,
index: seriesIndex.indexPattern?.id,
index: panel.use_kibana_indexes ? seriesIndex.indexPattern?.id : undefined,
});

return next(doc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function dateHistogram(req, panel, esQueryConfig, seriesIndex, capabiliti

const meta = {
timeField,
index: seriesIndex.indexPattern?.id,
index: panel.use_kibana_indexes ? seriesIndex.indexPattern?.id : undefined,
};

const getDateHistogramForLastBucketMode = () => {
Expand Down

0 comments on commit 3b7ef07

Please sign in to comment.