Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created October 18, 2013 16:58
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 clintongormley/7044466 to your computer and use it in GitHub Desktop.
Save clintongormley/7044466 to your computer and use it in GitHub Desktop.
POST /documents/_search
{
"query": {
"bool": {
"must": [
{
"function_score": {
"query": {
"has_child": {
"type": "comment",
"score_type": "sum",
"boost": 1,
"query": {
"constant_score": {
"query": {
"match": {
"text": "Finally!"
}
}
}
}
}
},
"boost": "1",
"script_score": {
"params": {
"cutoff": 1
},
"script": "(_score > 0) && (_score < cutoff) ? -1 :1"
},
"boost_mode": "mult"
}
},
{
"function_score": {
"query": {
"has_child": {
"type": "comment",
"score_type": "sum",
"boost": 1,
"query": {
"filtered": {
"filter": {
"range": {
"date": {
"lte": 20130204,
"gte": 20130201
}
}
}
}
}
}
},
"boost": "1",
"script_score": {
"params": {
"cutoff": 3
},
"script": "(_score > 0) && (_score < cutoff) ? -1 :1"
},
"boost_mode": "mult"
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment