Skip to content

Instantly share code, notes, and snippets.

View gist:3990600
app.get "/api/*", routes.proxy.get
routes.proxy.get = (req, res) ->
qIndex = req.url.indexOf("?")
queryString = req.url.substr(qIndex)
options =
host: 127.0.0.1
path: req.path + queryString
port: 8000
headers: req.headers
View gist:3352248
#connectDb.coffee
module.exports = (mongoString) ->
mongoose = require 'mongoose'
db = mongoose.createConnection mongoString
return db
#dbConfig.coffee
module.exports = (mongoInstance) ->
models = {}
View gist:3218270
a = 5
b = 10
c = 9
#using nested function
callback = (b,c) ->
return (err, doc) ->
console.log "B and C are available here"
View gist:1254824
Parent document mapping
{
"parent" : {
"properties" : {
"headline" : {
"type" : "string"
},
"doc_score" : {
"type" : "long"
View gist:1210453
curl -XPUT 'http://localhost:9200/testings/' -d '{
"index" : {
"number_of_shards" : 1
}
}'
curl -XPUT 'http://localhost:9200/testings/testing/_mapping' -d '{
"testing" : {
"properties" : {
View gist:1209369
{
"thistype" : {
"_routing" : {
"required" : true
},
"properties" : {
"open_requests" : {
"type" : "long"
}
},
View gist:1208980
tp_hash = param1['properties'];
vouches = _source.vouches;
a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
f = 0;
View gist:1202208
[2011-09-07 16:52:50,340][DEBUG][action.search.type ] [Nate Grey] [36] Failed to execute fetch phase
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:249)
at org.apache.lucene.store.NIOFSDirectory$NIOFSIndexInput.readInternal(NIOFSDirectory.java:123)
at org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:213)
at org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:39)
at org.apache.lucene.store.DataInput.readInt(DataInput.java:84)
at org.apache.lucene.store.BufferedIndexInput.readInt(BufferedIndexInput.java:153)
at org.apache.lucene.store.DataInput.readLong(DataInput.java:126)
at org.apache.lucene.store.BufferedIndexInput.readLong(BufferedIndexInput.java:166)
@cdolivares
cdolivares / gist:1202096
Created Sep 7, 2011
Custom Script Query
View gist:1202096
"query" : {
"filtered" : {
"query" : {
"custom_score" : {
"query" : {
"nested" : {
"path" : "expertises", "query" : {
"flt" : {
"fields" : ["expertises.subject_name"], "like_text : args[0]
}
View gist:1158523
{
"query" : {
"filtered" : {
"query" : {
"custom_score" : {
"query" : {
"nested" : {
"path" : "path1",
"query" : {
"flt" : {