Returns response for the user autocompletion.
\Symfony\Component\HttpFoundation\Request $request: The current request object containing the search string.
bool $include_anonymous: (optional) TRUE if the the name used to indicate anonymous users (e.g. "Anonymous") should be autocompleted. Defaults to FALSE.
\Symfony\Component\HttpFoundation\JsonResponse A JSON response containing the autocomplete suggestions for existing users.
\Drupal\user\UserAutocomplete::getMatches()
public function autocompleteUser(Request $request, $include_anonymous = FALSE) {
$matches = $this->userAutocomplete
->getMatches($request->query
->get('q'), $include_anonymous);
return new JsonResponse($matches);
}