Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 21st, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>Hello, elasticsearch!</title>
  5.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.   <style>body { font: 100% normal 'Helvetica Neue', sans-serif; margin: 4em; }</style>
  7.   <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
  8. </head>
  9. <body>
  10.   <p>
  11.     "Hello, <span id="cluster_name">elasticsearch</span>!",
  12.     says <strong id="node_name">node</strong>,
  13.     running on <em id="host_name">localhost</em>.
  14.   </p>
  15.  
  16.   <script>
  17.   $(function() {
  18.     $.getJSON('http://localhost:9200/_cluster/nodes/_local', function(data) {
  19.       console.log(data);
  20.  
  21.       var node_id = Object.keys(data.nodes)[0]
  22.         , cluster_name = data['cluster_name']
  23.         , node_name    = data.nodes[node_id]['name']
  24.         , host_name    = data.nodes[node_id]['hostname'];
  25.  
  26.       $('#cluster_name').html( cluster_name);
  27.       $('#node_name').html(    node_name   );
  28.       $('#host_name').html(    host_name   );
  29.     })
  30.   });
  31.   </script>
  32. </body>
  33. </html>