I'm using the PHP client.
I can search no problem.
My problem is getting suggestions.
Here is my code:
$json = '
POST /my_search_engine/_suggest
{
"my_engine":{
"text":"'.$keyword.'",
"completion":{
"field":"title_suggest"
}
}
}';
$params ['body'] = $json;
$response = $client->suggest ( $params );
Here is the stack trace:
<b>Fatal error</b>: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"parse_exception","reason":"Failed to derive xcontent"},"status":400}' in /var/www/ats-site-lib/ats-site-thoracic/web/app/es_search/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:681
Stack trace:
#0 /var/www/ats-site-lib/ats-site-thoracic/web/app/es_search/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(659): Elasticsearch\Connections\Connection->tryDeserializeError(Array, 'Elasticsearch\C...')
#1 /var/www/ats-site-lib/ats-site-thoracic/web/app/es_search/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(579): Elasticsearch\Connections\Connection->tryDeserialize400Error(Array)
#2 /var/www/ats-site-lib/ats-site-thoracic/web/app/es_search/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(261): Elasticsearch in <b>/var/www/ats-site-lib/ats-site-thoracic/web/app/es_search/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php</b> on line <b>682</b><br />
Here is how a document's "title_suggest" completion field looks. I am storing an array of keywords. maybe this is the problem? :
"title_suggest": [
"Membership",
"Renewal"
]
Any help would be appreciated!