Merge pull request #8416 from elastic/jasper/backport/8338/5.0

[backport] PR #8338 to 5.0
This commit is contained in:
Jonathan Budzenski 2016-09-21 13:37:19 -05:00 committed by GitHub
commit a2b7a46f8d

View file

@ -23,16 +23,18 @@ define(function () {
* @return {[type]} [description]
*/
let getKnownKibanaTypes = _.once(function () {
let indexName = kbnIndex;
return es.indices.getFieldMapping({
// only concerned with types in this kibana index
index: indexName,
index: kbnIndex,
// check all types
type: '*',
// limit the response to just the _source field for each index
fields: '_source'
}).then(function (resp) {
return _.keys(resp[indexName].mappings);
// kbnIndex is not sufficient here, if the kibana indexed is aliased we need to use
// the root index name as key
const index = _.keys(resp)[0];
return _.keys(resp[index].mappings);
});
});