Skip to content

Instantly share code, notes, and snippets.

@allizad
Last active July 28, 2017 13:10
Show Gist options
  • Save allizad/080e300aae9d27eb6b14b365ab742b62 to your computer and use it in GitHub Desktop.
Save allizad/080e300aae9d27eb6b14b365ab742b62 to your computer and use it in GitHub Desktop.
Tuning Elasticsearch results
POST /_search
{
"_source": [ "title", "weight" ],
"query": {
"bool": {
"must": {
"multi_match": {
"query": "Upgrade",
"fields": [
"title^16",
"content_text^4",
"display_tags^8"
],
"operator": "OR",
"type": "cross_fields"
}
}
}
},
"rescore": {
"window_size": 100,
"query": {
"rescore_query": {
"function_score": {
"field_value_factor": {
"field": "weight"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment