Created
February 17, 2017 23:25
-
-
Save MaxPleaner/aa1bf7d722f58ca5bf958578a5019526 to your computer and use it in GitHub Desktop.
codementor gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search(term) | |
@client.search({ | |
index: "trends", | |
type: "trend", | |
body: { | |
suggest: { | |
name_suggest: { | |
prefix: term, | |
completion: { | |
field: "name_suggest" | |
} | |
} | |
} | |
} | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you try implementing boost as follows.
/_search
{
"query": {
"function_score": {
"query": { "match_all": {} },
"boost": "5",
"random_score": {},
"boost_mode":"multiply"
}
}
}
Like in your use case;
def search(term)
@client.search({
index: "trends",
type: "trend",
body: {
suggest: {
name_suggest: {
prefix: term,
completion: {
field: "name_suggest",
"function_score": {
"query": { "match_all": {} },
"boost": "5",
"random_score": {},
"boost_mode":"multiply"
}
}
}
}
}
})
end