Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@greatwitenorth
Created June 12, 2013 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greatwitenorth/144507f760bbe3a311a6 to your computer and use it in GitHub Desktop.
Save greatwitenorth/144507f760bbe3a311a6 to your computer and use it in GitHub Desktop.
trying to give my posts a date boost.
curl -XGET 'http://localhost:9200/spna/post/_search?pretty=true' -d '
{
"size":10,
"from":0,
"sort":[
"_score"
],
"query": {
"custom_filters_score": {
"query": "link building",
"params": {
"now": 1370970933000
},
"filters": [
{
"filter": {
"exists": {
"field": "post_date"
}
},
"script": "(0.08 / ((3.16*pow(10,-11)) * abs(now - doc['date'].date.getMillis()) + 0.05)) + 1.0"
}
]
}
},
"query":{
"filtered":{
"query" : {
"query_string" : {
"fields" : ["post_title", "post_date", "post_content", "post_author", "category"],
"query" : "link building"
}
}
}
},
"highlight" : {
"fields" : {
"post_content" : {}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment