Skip to content

Commit

Permalink
Add termFacet, dateHistoFacet, use dangle
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoulliard committed Aug 26, 2013
1 parent 5cce3da commit 6d3516c
Show file tree
Hide file tree
Showing 10 changed files with 1,646 additions and 143 deletions.
98 changes: 61 additions & 37 deletions hawtio-web/src/main/webapp/app/elasticsearch/html/es.html
Expand Up @@ -10,10 +10,10 @@
<div class="row-fluid">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="defaultEsServer" title="Default ES Server">ES Server</label>
<label class="control-label" for="esServer" title="Default ES Server">ES Server</label>

<div class="controls">
<input id="defaultEsServer" name="defaultEsServer" type="text" ng-model="defaultEsServer"/>
<input id="esServer" name="esServer" type="text" ng-model="esServer"/>
</div>
</div>
<div class="control-group">
Expand All @@ -23,6 +23,25 @@
<input id="QueryTerm" name="QueryTerm" type="text" ng-model="queryTerm"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="facetField" title="Enter facet field.">Facet Field</label>

<div class="controls">
<input id="facetField" name="facetField" type="text" ng-model="facetField"/>
</div>
</div>

<div class="control-group">
<label class="control-label" for="facetType" title="Facet Type (terms, date histogram)">Facet Type</label>

<div class="controls">
<select id="facetType" ng-model="facetType">
<option value="terms">Terms</option>
<option value="histogram">Histogram</option>
<option value="date_histogram">Date Histogram</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="indice" title="Enter an index. By example - 'twitter'">Indice to be searched</label>

Expand All @@ -42,6 +61,16 @@
<input type="submit" value="ES Search" class="btn" ng-click="search()"/>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" value="ES Facet Search" class="btn" ng-click="facetTermsSearch()"/>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" value="ES Date Histogram Facet Search" class="btn" ng-click="facetDateHistogramSearch()"/>
</div>
</div>
</form>
</div>
</div>
Expand All @@ -55,26 +84,55 @@
<th>User</th>
<th>Posted Date</th>
<th>Message</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="doc in results.hits.hits">
<td>{{doc._source.user}}</td>
<td>{{doc._source.postedDate}}</td>
<td>{{doc._source.message}}</td>
<td ng-repeat="tag in doc._source.tags">{{tag}}</td>
</tr>
</tbody>
</table>
</div>
</div>

<!-- Error Panel -->
<!-- Dangle Histogram -->

<div class="row-fluid">
<div><strong>Histogram Example</strong></div>
<div class="span10" style="height:200px">
<fs:bar
width="900"
height="175"
duration="750"
bind="results.facets.termFacet"
/>
</div>
</div>

<div class="row-fluid">
<div><strong>Date Histogram Example</strong></div>
<div class="span10" style="height:200px">
<fs:date-histo
duration="750"
interval="minute"
bind="results.facets.dateHistoFacet"
/>
</div>
</div>


<!-- TODO Error Panel
<div class="row-fluid">
<div class="span12 alert alert-error panel-error" ng-hide="!panel.error">
<a class="close" ng-click="panel.error=false">&times;</a>
<i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}}
</div>
</div>
-->

<!--
<div>
Expand Down Expand Up @@ -123,38 +181,4 @@
-->
</div>

<!--
<div class="row-fluid">
<form class="span4 offset4 form-inline" ng-submit="search()">
<input class="input-xlarge" ng-model="queryTerm" type="text"
placeholder="Enter a keyword" autofocus>
<button class="btn" type="submit">Search</button>
</form>
</div>
<div class="row-fluid" style="margin-top:10%">
<div class="span4 offset4">
<span class="span5">Found {{results.hits.total}} Results</span></span>
<span class="span5 offset2">
<a href="#/search"> <i class="icon-search"></i> Return to Search</a>
</span>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>User</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="doc in results.hits.hits">
<td>{{doc._source.user}}</td>
<td>{{doc._source.message}}</td>
</tr>
</tbody>
</table>
</div>
</div>
-->
</div>
124 changes: 124 additions & 0 deletions hawtio-web/src/main/webapp/app/elasticsearch/js/data.json
@@ -0,0 +1,124 @@
[
{
"user": "davclaus",
"postedDate": "2013-08-22T18:30:00",
"message": "Elastic.js - a Javascript implementation of the ElasticSearch Query DSL and Core API",
"tags" : ["foo"]
},

{
"user": "jstrachan",
"postedDate": "2013-08-22T18:25:00",
"message": "FullScale Labs just released Elastic.js go check it out!",
"tags" : ["foo", "bar"]
},

{
"user": "dataintensive",
"postedDate": "2013-08-22T18:10:00",
"message": "We are pleased to announce Elastic.js an implementation of the #elasticsearch query dsl",
"tags" : ["foo", "bar", "baz"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:30:00",
"message": "Camel Framework",
"tags" : ["foo"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:25:00",
"message": "Camel 1 Framework",
"tags" : ["foo", "bar", "baz"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:10:00",
"message": "Karaf Framework",
"tags" : ["foo", "bar"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:10:00",
"message": "Karaf 1 Framework",
"tags" : ["bar", "baz"]
},

{
"user": "davclaus",
"postedDate": "2013-08-22T18:30:00",
"message": "Elastic.js - a Javascript implementation of the ElasticSearch Query DSL and Core API",
"tags" : ["foo", "bar", "baz"]
},

{
"user": "jstrachan",
"postedDate": "2013-08-22T18:25:00",
"message": "FullScale Labs just released Elastic.js go check it out!",
"tags" : ["foo", "baz"]
},

{
"user": "rdavies",
"postedDate": "2013-08-22T18:10:00",
"message": "We are pleased to announce Elastic.js an implementation of the #elasticsearch query dsl" ,
"tags" : ["foo", "bar", "baz"]
},

{
"user": "kimchy",
"postedDate": "2013-08-22T18:10:00",
"message": "The FullScale Labs team are awesome! Go check out Elastic.js",
"tags" : ["bar", "baz"]
},

{
"user": "jstrachan",
"postedDate": "2013-08-22T18:05:00",
"message": "Use elastic.js to write a complex query and translate it to json with our query translator",
"tags" : ["foo", "bar", "baz"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:30:00",
"message": "Elastic.js - a Javascript implementation of the ElasticSearch Query DSL and Core API",
"tags" : ["foo", "baz"]
},

{
"user": "cmoulliard",
"postedDate": "2013-08-22T18:25:00",
"message": "FullScale Labs just released Elastic.js go check it out!",
"tags" : ["baz"]
},

{
"user": "jstrachan",
"postedDate": "2013-08-22T18:10:00",
"message": "We are pleased to announce Elastic.js an implementation of the #elasticsearch query dsl",
"tags" : ["baz"]
},

{
"user": "davclaus",
"postedDate": "2013-08-22T18:10:00",
"message": "The FullScale Labs team are awesome! Go check out Elastic.js",
"tags" : ["foo"]
},

{
"user": "jstrachan",
"postedDate": "2013-08-22T18:05:00",
"message": "Use elastic.js to write a complex query and translate it to json with our query translator",
"tags" : ["foo", "bar", "baz"]
}
]




Expand Up @@ -4,7 +4,7 @@ module ES {
var base_url = 'app/elasticsearch/html';

/* Application level module which depends on filters, controllers, and services */
angular.module(pluginEsName, ['bootstrap','ngResource','elasticjs.service'])
angular.module(pluginEsName, ['bootstrap','ngResource','elasticjs.service','dangle'])

.config(['$routeProvider', function ($routeProvider) {
$routeProvider
Expand Down

0 comments on commit 6d3516c

Please sign in to comment.