Moved if statement to the right place

This commit is contained in:
Jesús Ángel González 2018-04-10 15:11:06 +02:00
parent 17d1e6db31
commit a81ed136dd

View File

@ -245,22 +245,24 @@ module.exports = (server, options) => {
const isXpackEnabled = typeof xpack === 'string' && xpack.includes('x-pack');
const isSuperUser = isXpackEnabled && req.auth.credentials.roles.includes('superuser');
const data = await elasticRequest
.callWithInternalUser('search', {
index: '.kibana',
type: 'doc',
body: {
"query":{
"match":{
"type": "index-pattern"
}
}
}
});
.callWithInternalUser('search', {
index: '.kibana',
type: 'doc',
body: {
"query":{
"match":{
"type": "index-pattern"
}
}
}
});
if(data && data.hits && data.hits.hits.length === 0) throw new Error('There is no index pattern');
if(data && data.hits && data.hits.hits){
const minimum = ["@timestamp", "full_log", "manager.name", "agent.id"];
let list = [];
if(data.hits.hits.length === 0) throw new Error('There is no index pattern');
for(const index of data.hits.hits){
let valid, parsed;
try{