Given the following Elasticsearch completion suggester query, what will be the returned suggestion text?
{
"suggest": {
"song-suggest": {
"prefix": "lov",
"completion": {
"field": "suggest",
"size": 1
}
}
}
}Check the indexed suggestions that start with the prefix "lov".
The completion suggester returns suggestions starting with the prefix "lov". Assuming the indexed data contains "love story" as a suggestion, it will be returned as the top suggestion.
To use the completion suggester in Elasticsearch, which field mapping type must be used?
Look for the specialized field type designed for fast prefix suggestions.
The completion suggester requires the field to be mapped as type "completion" to enable fast prefix-based suggestions.
Consider this query that returns no suggestions despite data being indexed:
{
"suggest": {
"user-suggest": {
"prefix": "jo",
"completion": {
"field": "user_suggest",
"skip_duplicates": true
}
}
}
}What is the most likely cause?
Check the field mapping type for "user_suggest".
If the field is not mapped as "completion" type, the completion suggester will not work and return no suggestions.
Which of the following JSON queries correctly uses a context filter in a completion suggester?
Check the correct key name and value type for contexts in completion suggester.
The "contexts" key expects an object where each context name maps to an array of context values.
Given this query:
{
"suggest": {
"city-suggest": {
"prefix": "new",
"completion": {
"field": "city_suggest",
"size": 3
}
}
}
}And the indexed suggestions are: "new york", "newark", "new orleans", "newcastle", "newport". How many suggestions will be returned?
Look at the "size" parameter in the query.
The "size" parameter limits the number of suggestions returned to 3, even if more matches exist.