 #   Get ElasticSearch Cluster Information
 #
 # Commands:
-#   hubot: elasticsearch cluster [server] - Gets the cluster information for the given server
+#   hubot: elasticsearch|es cluster [server] - Gets the cluster information for the given server
 #   hubot: elasticsearch node [server] - Gets the node information for the given server
 #   hubot: elasticsearch query [server] [query] - Runs a specific query against an ElasticSearch cluster
 #   hubot: elasticsearch|es show aliases - shows the aliases for the list of ElasticSearch instances

    search msg, msg.match[1], msg.match[2], (text) ->
      msg.send(text)


  robot.respond /elasticsearch node (.*)/i, (msg) ->
    if msg.message.user.id is robot.name
      return

        firsthit = JSON.stringify(json.hits.hits[0])
        msg.send("There are #{json.hits.total} results for the search http://#{server}/_search?#{query} \nThe first result is \n#{firsthit}")

  cluster_health = (msg, alias) ->
    cluster_url = _esAliases[alias]

    if cluster_url == "" || cluster_url == undefined
      msg.send("No ES Cluster found for #{alias}")
    else
      msg.http("#{cluster_url}/_cluster/health")
        .get() (err, res, body) ->
          json = JSON.parse(body)
          cluster_name = json['cluster']
          status = json['status']
          number_of_nodes = json['number_of_nodes']
          msg.send "Cluster: #{cluster_name} \nStatus: #{status} \n Nodes: #{number_of_nodes}"

  node_health = (msg, server) ->
    msg.http("http://#{server}/")
