Skip to content

Instantly share code, notes, and snippets.

@karmi
Created August 17, 2012 19:13

Revisions

  1. karmi revised this gist Aug 17, 2012. No changes.
  2. karmi revised this gist Aug 17, 2012. 1 changed file with 9 additions and 16 deletions.
    25 changes: 9 additions & 16 deletions __readme.md
    Original file line number Diff line number Diff line change
    @@ -7,24 +7,17 @@ World's Smallest Application Hosted in elasticsearch
    <http://www.elasticsearch.org/guide/reference/modules/plugins.html>

    Install
    -------

    plugin -install hello-elasticsearch -url https://raw.github.com/gist/dc733632435da2149963/hello-elasticsearch.zip

    open http://localhost:9200/_plugin/hello-elasticsearch/index.html
    elasticsearch plugins which don't contain any Java files are identified as “site” plugins,
    and their content is served as static files.

    Install “from source”
    ---------------------
    This makes it easy to create small, self-contained HTML applications for elasticsearch, just like this one.

    cd /tmp
    mkdir -p /tmp/hello-elasticsearch

    curl -# -L -k https://gist.github.com/gists/dc733632435da2149963/download | tar xv --strip=1 -C /tmp/hello-elasticsearch
    zip -mj hello-elasticsearch.zip /tmp/hello-elasticsearch/*
    Install
    -------

    plugin -install hello-elasticsearch -url file:///tmp/hello-elasticsearch.zip
    You can either simply copy the `index.html` file to `$ES_HOME/plugins/hello-elasticsearch/_site` directory,
    or use the `plugin` script included with elasticsearch installation:

    open http://localhost:9200/_plugin/hello-elasticsearch/index.html
    plugin -install hello-elasticsearch -url https://raw.github.com/gist/3381710/hello-elasticsearch.zip

    Done.
    The application will be available at <http://localhost:9200/_plugin/hello-elasticsearch/index.html>.
  3. karmi revised this gist Aug 17, 2012. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion __readme.md
    Original file line number Diff line number Diff line change
    @@ -7,14 +7,24 @@ World's Smallest Application Hosted in elasticsearch
    <http://www.elasticsearch.org/guide/reference/modules/plugins.html>


    Install
    -------

    plugin -install hello-elasticsearch -url https://raw.github.com/gist/dc733632435da2149963/hello-elasticsearch.zip

    open http://localhost:9200/_plugin/hello-elasticsearch/index.html

    Install “from source”
    ---------------------

    cd /tmp
    mkdir -p /tmp/hello-elasticsearch

    curl -# -L -k https://gist.github.com/gists/dc733632435da2149963/download | tar xv --strip=1 -C /tmp/hello-elasticsearch
    zip -mj hello-elasticsearch.zip /tmp/hello-elasticsearch/*

    plugin -install hello-elasticsearch -url file:///tmp/hello-elasticsearch.zip

    open http://localhost:9200/_plugin/hello-elasticsearch/index.html

    Done.
  4. karmi revised this gist Aug 17, 2012. 1 changed file with 0 additions and 0 deletions.
    Binary file added hello-elasticsearch.zip
    Binary file not shown.
  5. karmi revised this gist Aug 13, 2012. 2 changed files with 53 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions __readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    World's Smallest Application Hosted in elasticsearch
    ====================================================

    > Plugins can have “sites” in them, any plugin that exists under the plugins directory with a `_site` directory,
    > its content will be statically served when hitting `/_plugin/[plugin_name]/` url.
    > Those can be added even after the process has started.
    <http://www.elasticsearch.org/guide/reference/modules/plugins.html>


    Install
    -------

    cd /tmp
    curl -# -L -k https://gist.github.com/gists/dc733632435da2149963/download | tar xv --strip=1 -C /tmp/hello-elasticsearch
    zip -mj hello-elasticsearch.zip /tmp/hello-elasticsearch/*
    plugin -install hello-elasticsearch -url file:///tmp/hello-elasticsearch.zip
    open http://localhost:9200/_plugin/hello-elasticsearch/index.html

    Done.
    33 changes: 33 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    <!DOCTYPE html>
    <html>
    <head>
    <title>Hello, elasticsearch!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>body { font: 100% normal 'Helvetica Neue', sans-serif; margin: 4em; }</style>
    <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
    </head>
    <body>
    <p>
    &quot;Hello, <span id="cluster_name">elasticsearch</span>!&quot;,
    says <strong id="node_name">node</strong>,
    running on <em id="host_name">localhost</em>.
    </p>

    <script>
    $(function() {
    $.getJSON('http://localhost:9200/_cluster/nodes/_local', function(data) {
    console.log(data);

    var node_id = Object.keys(data.nodes)[0]
    , cluster_name = data['cluster_name']
    , node_name = data.nodes[node_id]['name']
    , host_name = data.nodes[node_id]['hostname'];

    $('#cluster_name').html( cluster_name);
    $('#node_name').html( node_name );
    $('#host_name').html( host_name );
    })
    });
    </script>
    </body>
    </html>
  6. karmi created this gist Aug 13, 2012.
    2 changes: 2 additions & 0 deletions .gitignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    .DS_Store
    tmp/