diff --git a/series_functions/es.js b/series_functions/es.js index 6f12bc3c368579..fe9e1087bbc686 100644 --- a/series_functions/es.js +++ b/series_functions/es.js @@ -159,6 +159,8 @@ module.exports = new Datasource('es', { var body = buildRequest(config, tlConfig); return client.search(body).then(function (resp) { + if (!resp._shards.total) throw new Error('Elasticsearch index not found: ' + config.index); + var data = _.map(resp.aggregations.series.buckets, function (bucket) { var value; if (resp.aggregations.series.buckets[0].metric != null) {