egaumer’s gists (original) (raw)
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
[ Show hidden characters]({{ revealButtonHref }})
"use strict"; |
---|
angular.module('fs.directives', []) |
.directive('rangeSlider', function() { |
return { |
restrict: 'A', |
link: function(scope, element, attrs) { |
var min = parseInt(attrs.min, 10) | |
var max = parseInt(attrs.max, 10) | |
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
[ Show hidden characters]({{ revealButtonHref }})
$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
[ Show hidden characters]({{ revealButtonHref }})
/*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
[ Show hidden characters]({{ revealButtonHref }})
# 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
[ Show hidden characters]({{ revealButtonHref }})
/* the controller */ |
---|
function blog() { |
function toAtom(results) { |
default xml namespace = "http://www.w3.org/2005/Atom"; |
var feed = ; |
feed.id = "http://host.com/feeds/blog/atom"; |
feed.title = "Sample Atom Feed"; |
feed.author.name = "Jon Smith"; |
feed.author.email = "jsmith@host.com"; |
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
[ Show hidden characters]({{ revealButtonHref }})
/* 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
[ Show hidden characters]({{ revealButtonHref }})
<head> |
<title>Simple Search</title> |
<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
[ Show hidden characters]({{ revealButtonHref }})
<head> |
<title>Simple Search</title> |
<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
[ Show hidden characters]({{ revealButtonHref }})
<head> |
<title>Simple Search</title> |
<script type="text/template" id="results"> |
<% _.each(hits.hits, function(hit) { %> |
<% }); %> |
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
[ Show hidden characters]({{ revealButtonHref }})
#!/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" : { |