Complete the code to define a completion suggester in the search query.
{
"suggest": {
"song-suggest": {
"prefix": "nirv",
"completion": {
"field": "[1]"
}
}
}
}The completion suggester requires the name of the field that holds the completion data. Here, title is the correct field name.
Complete the code to add a size limit to the number of suggestions returned.
{
"suggest": {
"song-suggest": {
"prefix": "nirv",
"completion": {
"field": "title",
"[1]": 5
}
}
}
}limit or max_results which are not valid parameters here.max_suggestions which does not exist.The size parameter controls how many suggestions are returned by the completion suggester.
Fix the error in the completion suggester query by completing the missing parameter.
{
"suggest": {
"song-suggest": {
"prefix": "nirv",
"completion": {
"field": "title",
"skip_duplicates": [1]
}
}
}
}The skip_duplicates parameter expects a boolean value without quotes. So true is correct.
Fill both blanks to create a completion suggester with fuzzy matching enabled and a fuzziness level of 2.
{
"suggest": {
"song-suggest": {
"prefix": "nirv",
"completion": {
"field": "title",
"[1]": {
"fuzziness": [2]
}
}
}
}
}fuzziness as the first blank instead of fuzzy.To enable fuzzy matching, set the fuzzy parameter to an object containing fuzziness set to the integer 2.
Fill all three blanks to create a completion suggester that uses the prefix "nirv", returns 3 suggestions, and skips duplicates.
{
"suggest": {
"song-suggest": {
"prefix": "[1]",
"completion": {
"field": "title",
"size": [2],
"skip_duplicates": [3]
}
}
}
}The prefix is "nirv", size is 3 to limit suggestions, and skip_duplicates is true to avoid repeated suggestions.