yii\elasticsearch\Command::suggest PHP Method

suggest() public method

Sends a request to the _suggest API and returns the result
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html
public suggest ( string | array $suggester, array $options = [] ) : mixed
$suggester string | array the suggester body
$options array
return mixed
    public function suggest($suggester, $options = [])
    {
        if (empty($suggester)) {
            $suggester = '{}';
        }
        if (is_array($suggester)) {
            $suggester = Json::encode($suggester);
        }
        $url = [$this->index !== null ? $this->index : '_all', '_suggest'];
        return $this->db->post($url, array_merge($this->options, $options), $suggester);
    }