/** * Run a suggestion request. * * @param \Elodex\Suggest $suggest * @param string|null $index * @return \Elodex\SuggestResult */ public function suggest(Suggest $suggest, $index = null) { $indexName = $index ?: $this->getDefaultIndex(); $params = ['index' => $indexName]; $params['body'] = $suggest->toArray(); // Perform the suggest request. $results = $this->client->suggest($params); return new SuggestResult($results); }
public function suggest($params = []) { if (!isset($params['index'])) { $params['index'] = $this->getSearchIndex(); } $this->requestToScreen($params, 'SUGGEST'); try { return parent::suggest($params); } catch (\Exception $e) { $this->registerErrorForException($e); return array(); } }
/** * Execute a map statement on index;. * * @param array $suggestions * * @return array */ public function suggestStatement(array $suggestions) { return $this->elastic->suggest($this->setStatementIndex($suggestions)); }