This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
angular.module('fs.directives', []) | |
.directive('rangeSlider', function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
var min = parseInt(attrs.min, 10) || 0; | |
var max = parseInt(attrs.max, 10) || 100; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.pager = { | |
pageChange: function(pageNum) { | |
$scope.search(resultPager.get(pageNum)); | |
}, | |
next: function() { | |
this.pageChange(resultPager.next()); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint globalstrict:true */ | |
/*global angular:true */ | |
'use strict'; | |
angular.module('demo', [ | |
'demo.controllers', | |
'demo.directives', | |
'elasticjs.service' | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple match all query with term facet | |
ejs.Request() | |
.indices("myindex") | |
.types("mytype") | |
.query(ejs.MatchAllQuery()) | |
.facet( | |
ejs.TermsFacet('url') | |
.field('url') | |
.size(20)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* the controller */ | |
function blog() { | |
function toAtom(results) { | |
default xml namespace = "http://www.w3.org/2005/Atom"; | |
var feed = <feed/>; | |
feed.id = "http://host.com/feeds/blog/atom"; | |
feed.title = "Sample Atom Feed"; | |
feed.author.name = "Jon Smith"; | |
feed.author.email = "[email protected]"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* the controller */ | |
function session() { | |
function doGet(session) { | |
return { body: ["This method is public"] }; | |
} | |
function doPut(session) { | |
if (!session) { | |
/* user not logged in - send redirect */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Simple Search</title> | |
<!-- Example search template using underscore.js --> | |
<script type="text/template" id="results"> | |
<li><%= title %></li> | |
</script> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Simple Search</title> | |
<!-- Example search template using underscore.js --> | |
<script type="text/template" id="results"> | |
<% _.each(hits.hits, function(hit) { %> | |
<li><%= hit._source.text %></li> | |
<% }); %> | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<title>Simple Search</title> | |
<!-- Example search template using underscore.js --> | |
<script type="text/template" id="results"> | |
<% _.each(hits.hits, function(hit) { %> | |
<li><%= hit._source.title %> published on <%= hit._source.date %></li> | |
<% }); %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run this before feeding example documents | |
# create the collection | |
curl -XPUT -H 'Content-Type:application/json' 'http://localhost:2600/v1/restaurant' | |
# explicitly define the location field to be of type 'geo_point' | |
curl -XPUT -H 'Content-Type:application/json' 'http://localhost:2600/v1/restaurant/locations/_mapping' -d '{ | |
"locations" : { |
NewerOlder