Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7 lang="en"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8 lang="en"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="Search based application built using ElasticSearch, elastic.js, and jQuery">
    <meta name="viewport" content="width=device-width">

    <title>Elastic.js jQuery Example</title>

    <link rel="stylesheet" href="/common/css/normalize.min.css">
    <link rel="stylesheet" href="/common/css/main.min.css">
    <link rel="stylesheet" href="/common/css/bootstrap.min.css">
    <link rel="stylesheet" href="/common/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" href="/common/css/elasticjs.css">

    <!-- project dependency libs -->
    <script src="/common/lib/modernizr-2.6.1.min.js"></script>
    <script src="/common/lib/jquery-1.8.0.min.js"></script>
    <script src="/common/lib/underscore.min.js"></script>
    <script src="/dist/elastic.min.js"></script>
    <script src="/dist/elastic-jquery-client.min.js"></script>
    <!-- project specific files -->
    <script src="js/app.js"></script>

<script type="text/template" id="searchTmpl">
    <div class="row-fluid" style="margin-top:15%">
        <span class="span4 offset4">
            <i class="icon-search"></i>
            <strong>Elastic.js jQuery Example</strong>
    <div class="row-fluid">
        <form id="formSearch" class="span4 offset4 form-inline" action="#">
            <input id="txtSearch" class="input-xlarge" type="text" 
                placeholder="Enter a keyword" autofocus>
            <button class="btn" type="submit">Search</button>
    <div class="row-fluid">
        <small class="span4 offset4" style="margin-top:20px">
            In order for this example application to work, please have an ElasticSearch instance
            running at localhost:9200.  If you would like to use another instance of 
            ElasticSearch, please update <code>js/app.js</code> with the
            correct url.

<script type="text/template" id="resultsTmpl">
    <div class="row-fluid" style="margin-top:10%">
        <div class="span4 offset4">
            <span class="span5">Found <%= %> Results</span></span>
            <span class="span5 offset2">
                <a id="goBack" href="#"> <i class="icon-search"></i> Return to Search</a>
            <table class="table table-striped table-hover">
                    <% _.each(results.hits.hits, function(doc) { %>
                            <td><%= doc._source.user %></td>
                            <td><%= doc._source.message %></td>
                    <% }); %>

    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid">
                <span class="brand">Elastic.js jQuery Example</span>
                <button id="btnIndexDocs" class="btn btn-inverse pull-right">Index Sample Docs</button>

    <div class="container-fluid">
        <div class="row-fluid">
            <div id="viewport"></div>
New to GrepCode? Check out our FAQ X