Permalink
Browse files

[meteor] gitignore and bug fix when empty ES

  • Loading branch information...
netantho committed Mar 7, 2014
1 parent 3a52f04 commit b6a585d75818495534885ec90f000890cbfc8078
Showing with 11 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 logs/.gitignore
  3. +8 −3 meteor/app/server/methods.js
View
@@ -0,0 +1 @@
+meteor/packages
View
@@ -0,0 +1,2 @@
+*
+!.gitignore
@@ -18,8 +18,13 @@ Meteor.methods({
esDocStatsRequest=HTTP.get(elasticsearch.address + elasticsearch.docstatsurl)
if (esDocStatsRequest.statusCode==200 && esDocStatsRequest.data ) {
//set the current doc stats
- esHealthRequest["data"]["total_docs"]=esDocStatsRequest["data"]["_all"]["total"]["docs"].count
- console.log('Total Docs: '+ esDocStatsRequest["data"]["_all"]["total"]["docs"].count)
+ if (esDocStatsRequest["data"]["_all"]["total"]["docs"]) {
+ esHealthRequest["data"]["total_docs"]=esDocStatsRequest["data"]["_all"]["total"]["docs"].count
+ }
+ else {
+ esHealthRequest["data"]["total_docs"] = 0
+ }
+ console.log('Total Docs: '+ esHealthRequest["data"]["total_docs"])
}
//set current status of the elastic search cluster
@@ -34,4 +39,4 @@ Meteor.methods({
console.log("returned a " + esHealthRequest.statusCode)
console.log(esHealthRequest["data"])
}
- }
+ }

0 comments on commit b6a585d

Please sign in to comment.