Complete the code to add a phrase suggestion named "my-suggestion" to the search query.
{
"suggest": {
"my-suggestion": {
"phrase": {
"field": [1]
}
}
}
}The phrase suggestion requires the field name where the text is stored. "message" is the correct field here.
Complete the code to set the size of phrase suggestions to 3.
{
"suggest": {
"my-suggestion": {
"phrase": {
"field": "message",
"size": [1]
}
}
}
}The "size" parameter controls how many suggestions are returned. Setting it to 3 returns three suggestions.
Fix the error in the phrase suggestion by completing the code with the correct "text" parameter.
{
"suggest": {
"my-suggestion": {
"text": [1],
"phrase": {
"field": "message"
}
}
}
}The "text" parameter must be a string enclosed in quotes. "helo wrld" is the misspelled text to suggest corrections for.
Fill both blanks to add a "direct_generator" with "suggest_mode" set to "always" inside the phrase suggestion.
{
"suggest": {
"my-suggestion": {
"text": "helo wrld",
"phrase": {
"field": "message",
"direct_generator": [
{
"suggest_mode": [1]
}
]
}
}
}
}The "suggest_mode" set to "always" means suggestions are generated for all tokens, even if they are correct.
Fill all three blanks to add a phrase suggestion with "text", "field", and "size" parameters correctly set.
{
"suggest": {
"my-suggestion": {
"text": [1],
"phrase": {
"field": [2],
"size": [3]
}
}
}
}The "text" is the misspelled phrase, "field" is the text field to check, and "size" is how many suggestions to return.