Skip to content

Instantly share code, notes, and snippets.

@jordancardwell
Created October 7, 2016 18:37
Show Gist options
  • Save jordancardwell/29945d0a3807a137b7275d7917aa17c1 to your computer and use it in GitHub Desktop.
Save jordancardwell/29945d0a3807a137b7275d7917aa17c1 to your computer and use it in GitHub Desktop.
//this matches 'frodo' and sends results to the top, since `name` field is boosted
// but also matches 'theodore' and 'rudolpho'
{
"size":100,
"from":0,
"query":{
"multi_match":{
"query":"frodo",
"fields":[
"name",
"ngram"
],
"type":"best_fields"
}
}
}
//I then tried to throw in the `minimum_must_match` option
// hoping it would filter out large strings that only had one matching trigram for instance
{
"size":100,
"from":0,
"query":{
"multi_match":{
"query":"frodo",
"fields":[
"name",
"ngram"
],
"type":"best_fields",
"minimum_should_match": "90%",
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment