Automatically select index if only one

This commit is contained in:
Lukas Olson 2016-12-29 11:46:05 -07:00
parent 5cdc3a521f
commit c8fc69fcff

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 () {