Fix suggestion endpoint in 6.x Client
Summary of problem or feature request
in the 6.0.1 tag and master of the driver code the \Elasticsearch\Endpoints\Suggest is broken.
Suggested fix is:
diff --git a/src/Elasticsearch/Endpoints/Suggest.php b/src/Elasticsearch/Endpoints/Suggest.php
index 1afb1f2..8fecc7f 100644
--- a/src/Elasticsearch/Endpoints/Suggest.php
+++ b/src/Elasticsearch/Endpoints/Suggest.php
@@ -38,10 +38,10 @@ class Suggest extends AbstractEndpoint
public function getURI()
{
$index = $this->index;
- $uri = "/_suggest";
+ $uri = "/_search";
if (isset($index) === true) {
- $uri = "/$index/_suggest";
+ $uri = "/$index/_search";
}
return $uri;
Fixed and tested OK in fork: https://github.com/finderly/elasticsearch-php/commit/8a52695712abef12cb5789aff28e310f03f59741
- Operating System - centOs
- PHP Version - 7.1
- ES-PHP client version 6.0.1 / master
- Elasticsearch version 6.1
Ah, actually, we need to just delete that endpoint entirely. The suggest endpoint was removed from 6.x, the user should just use search.
I'll make that change in a bit, or if you want, happy to accept a PR :)
Very true, as the differentiation / behavior is now implicit in the _search syntax, the extra one is no longer needed. I would be more than happy to make a PR, but I won't get to it until tomorrow morning MEST :)
@polyfractal https://github.com/elastic/elasticsearch-php/pull/763
The PR should be merged quickly. This API change is pretty confusing if you don't know about it, since the method isn't even marked deprecated.
Solved in #763