Automatically select index if only one (#9679)

This commit is contained in:
Lukas Olson 2017-01-02 09:17:17 -07:00 committed by GitHub
parent 78dd094c5e
commit b4d754a578

View file

@ -31,7 +31,13 @@ module.exports = function (opts) {
}
if (!defined && route.requireDefaultIndex) {
throw new NoDefaultIndexPattern();
// If there is only one index pattern, set it as default
if (patterns.length === 1) {
defaultId = patterns[0];
config.set('defaultIndex', defaultId);
} else {
throw new NoDefaultIndexPattern();
}
}
return notify.event('loading default index pattern', function () {