diff --git a/src/core_plugins/tile_map/public/coordinate_maps_visualization.js b/src/core_plugins/tile_map/public/coordinate_maps_visualization.js
index 3fec239c504c1..7d4d3d78c2f5a 100644
--- a/src/core_plugins/tile_map/public/coordinate_maps_visualization.js
+++ b/src/core_plugins/tile_map/public/coordinate_maps_visualization.js
@@ -171,7 +171,7 @@ export function CoordinateMapsVisualizationProvider(Notifier, Private) {
return;
}
- const indexPatternName = agg.vis.indexPattern.id;
+ const indexPatternName = agg._indexPattern.id;
const field = agg.fieldName();
const filter = { meta: { negate: false, index: indexPatternName } };
filter[filterName] = { ignore_unmapped: true };
diff --git a/src/ui/public/agg_types/__tests__/buckets/date_histogram/_editor.js b/src/ui/public/agg_types/__tests__/buckets/date_histogram/_editor.js
index 40202efa568b2..11326c1e8a736 100644
--- a/src/ui/public/agg_types/__tests__/buckets/date_histogram/_editor.js
+++ b/src/ui/public/agg_types/__tests__/buckets/date_histogram/_editor.js
@@ -58,7 +58,7 @@ describe('editor', function () {
]
});
- const $el = $('');
+ const $el = $('');
const $parentScope = $injector.get('$rootScope').$new();
agg = $parentScope.agg = vis.aggs.bySchemaName.segment[0];
diff --git a/src/ui/public/agg_types/buckets/create_filter/date_histogram.js b/src/ui/public/agg_types/buckets/create_filter/date_histogram.js
index 37f6c818cd203..5431fbf7925b3 100644
--- a/src/ui/public/agg_types/buckets/create_filter/date_histogram.js
+++ b/src/ui/public/agg_types/buckets/create_filter/date_histogram.js
@@ -28,5 +28,5 @@ export function createFilterDateHistogram(agg, key) {
gte: start.valueOf(),
lt: start.add(interval).valueOf(),
format: 'epoch_millis'
- }, agg.vis.indexPattern);
+ }, agg._indexPattern);
}
diff --git a/src/ui/public/agg_types/buckets/create_filter/date_range.js b/src/ui/public/agg_types/buckets/create_filter/date_range.js
index fd482a3d836f7..09d027e16bef0 100644
--- a/src/ui/public/agg_types/buckets/create_filter/date_range.js
+++ b/src/ui/public/agg_types/buckets/create_filter/date_range.js
@@ -31,5 +31,5 @@ export function createFilterDateRange(agg, key) {
if (range.to) filter.lt = +range.to;
if (range.to && range.from) filter.format = 'epoch_millis';
- return buildRangeFilter(agg.params.field, filter, agg.vis.indexPattern);
+ return buildRangeFilter(agg.params.field, filter, agg._indexPattern);
}
diff --git a/src/ui/public/agg_types/buckets/create_filter/filters.js b/src/ui/public/agg_types/buckets/create_filter/filters.js
index 7104360dc5bfd..794b4f773c7cc 100644
--- a/src/ui/public/agg_types/buckets/create_filter/filters.js
+++ b/src/ui/public/agg_types/buckets/create_filter/filters.js
@@ -26,6 +26,6 @@ export function createFilterFilters(aggConfig, key) {
const filter = dslFilters[key];
if (filter) {
- return buildQueryFilter(filter.query, aggConfig.vis.indexPattern.id);
+ return buildQueryFilter(filter.query, aggConfig._indexPattern.id);
}
}
diff --git a/src/ui/public/agg_types/buckets/create_filter/histogram.js b/src/ui/public/agg_types/buckets/create_filter/histogram.js
index 9f2408730362f..343469e207209 100644
--- a/src/ui/public/agg_types/buckets/create_filter/histogram.js
+++ b/src/ui/public/agg_types/buckets/create_filter/histogram.js
@@ -25,7 +25,7 @@ export function createFilterHistogram(aggConfig, key) {
return buildRangeFilter(
aggConfig.params.field,
{ gte: value, lt: value + aggConfig.params.interval },
- aggConfig.vis.indexPattern,
+ aggConfig._indexPattern,
aggConfig.fieldFormatter()(key)
);
}
diff --git a/src/ui/public/agg_types/buckets/create_filter/ip_range.js b/src/ui/public/agg_types/buckets/create_filter/ip_range.js
index bb98cf29bd63e..41e2af1477106 100644
--- a/src/ui/public/agg_types/buckets/create_filter/ip_range.js
+++ b/src/ui/public/agg_types/buckets/create_filter/ip_range.js
@@ -32,5 +32,5 @@ export function createFilterIpRange(aggConfig, key) {
};
}
- return buildRangeFilter(aggConfig.params.field, { gte: range.from, lte: range.to }, aggConfig.vis.indexPattern);
+ return buildRangeFilter(aggConfig.params.field, { gte: range.from, lte: range.to }, aggConfig._indexPattern);
}
diff --git a/src/ui/public/agg_types/buckets/create_filter/range.js b/src/ui/public/agg_types/buckets/create_filter/range.js
index f13c4fafa0f8d..f6516f6d06c61 100644
--- a/src/ui/public/agg_types/buckets/create_filter/range.js
+++ b/src/ui/public/agg_types/buckets/create_filter/range.js
@@ -23,7 +23,7 @@ export function createFilterRange(aggConfig, key) {
return buildRangeFilter(
aggConfig.params.field,
key,
- aggConfig.vis.indexPattern,
+ aggConfig._indexPattern,
aggConfig.fieldFormatter()(key)
);
}
diff --git a/src/ui/public/agg_types/buckets/date_histogram.js b/src/ui/public/agg_types/buckets/date_histogram.js
index 1c164addf8e28..81b7799052393 100644
--- a/src/ui/public/agg_types/buckets/date_histogram.js
+++ b/src/ui/public/agg_types/buckets/date_histogram.js
@@ -92,7 +92,7 @@ export const dateHistogramBucketAgg = new BucketAggType({
name: 'field',
filterFieldTypes: 'date',
default: function (agg) {
- return agg.vis.indexPattern.timeFieldName;
+ return agg._indexPattern.timeFieldName;
},
onChange: function (agg) {
if (_.get(agg, 'params.interval.val') === 'auto' && !agg.fieldIsTimeField()) {
diff --git a/src/ui/public/agg_types/buckets/date_range.js b/src/ui/public/agg_types/buckets/date_range.js
index 5b57f80355cac..e2dd39a74444d 100644
--- a/src/ui/public/agg_types/buckets/date_range.js
+++ b/src/ui/public/agg_types/buckets/date_range.js
@@ -43,7 +43,7 @@ export const dateRangeBucketAgg = new BucketAggType({
name: 'field',
filterFieldTypes: 'date',
default: function (agg) {
- return agg.vis.indexPattern.timeFieldName;
+ return agg._indexPattern.timeFieldName;
}
}, {
name: 'ranges',
diff --git a/src/ui/public/agg_types/controls/field.html b/src/ui/public/agg_types/controls/field.html
index 4bbb1c18357b9..b6a0edc1d1630 100644
--- a/src/ui/public/agg_types/controls/field.html
+++ b/src/ui/public/agg_types/controls/field.html
@@ -33,7 +33,7 @@
- No Compatible Fields: The "{{ vis.indexPattern.title }}" index pattern does not contain any of the following field types: {{ agg.type.params.byName.field.filterFieldTypes | commaList:false }}
+ No Compatible Fields: The "{{ agg._indexPattern.title }}" index pattern does not contain any of the following field types: {{ agg.type.params.byName.field.filterFieldTypes | commaList:false }}
diff --git a/src/ui/public/agg_types/controls/order_agg.html b/src/ui/public/agg_types/controls/order_agg.html
index 61f2cec29a490..fd3f80158d526 100644
--- a/src/ui/public/agg_types/controls/order_agg.html
+++ b/src/ui/public/agg_types/controls/order_agg.html
@@ -24,7 +24,7 @@
diff --git a/src/ui/public/agg_types/controls/sub_agg.html b/src/ui/public/agg_types/controls/sub_agg.html
index 76936a5861960..1378bc896ab2c 100644
--- a/src/ui/public/agg_types/controls/sub_agg.html
+++ b/src/ui/public/agg_types/controls/sub_agg.html
@@ -25,7 +25,7 @@
diff --git a/src/ui/public/agg_types/controls/sub_metric.html b/src/ui/public/agg_types/controls/sub_metric.html
index d6805e7560b83..d5d53902378b5 100644
--- a/src/ui/public/agg_types/controls/sub_metric.html
+++ b/src/ui/public/agg_types/controls/sub_metric.html
@@ -5,7 +5,7 @@
diff --git a/src/ui/public/agg_types/metrics/top_hit.js b/src/ui/public/agg_types/metrics/top_hit.js
index a28b0e56426df..9b44f4938b8f8 100644
--- a/src/ui/public/agg_types/metrics/top_hit.js
+++ b/src/ui/public/agg_types/metrics/top_hit.js
@@ -137,7 +137,7 @@ export const topHitMetricAgg = new MetricAggType({
editor: null,
filterFieldTypes: [ 'number', 'date', 'ip', 'string' ],
default: function (agg) {
- return agg.vis.indexPattern.timeFieldName;
+ return agg._indexPattern.timeFieldName;
},
write: _.noop // prevent default write, it is handled below
},
@@ -187,7 +187,7 @@ export const topHitMetricAgg = new MetricAggType({
const path = agg.params.field.name;
let values = _(hits).map(hit => {
- return path === '_source' ? hit._source : agg.vis.indexPattern.flattenHit(hit, true)[path];
+ return path === '_source' ? hit._source : agg._indexPattern.flattenHit(hit, true)[path];
})
.flatten()
.value();
diff --git a/src/ui/public/vis/agg_config.js b/src/ui/public/vis/agg_config.js
index 458470ed3a5a3..aa571b2f83efb 100644
--- a/src/ui/public/vis/agg_config.js
+++ b/src/ui/public/vis/agg_config.js
@@ -65,6 +65,7 @@ class AggConfig {
constructor(vis, opts = {}) {
this.id = String(opts.id || AggConfig.nextId(vis.aggs));
this.vis = vis;
+ this._indexPattern = vis.indexPattern;
this._opts = opts;
this.enabled = typeof opts.enabled === 'boolean' ? opts.enabled : true;