elasticsearch-php
elasticsearch-php copied to clipboard
Elastic\Elasticsearch\Exception\ProductCheckException: The client noticed that the server is not Elasticsearch and we do not support this unknown product in file vendor\elasticsearch\elasticsearch\src\Traits\ProductCheckTrait.php on line 32
Summary of problem or feature request
Getting error Elastic\Elasticsearch\Exception\ProductCheckException: The client noticed that the server is not Elasticsearch and we do not support this unknown product in file \elasticsearch\elasticsearch\src\Traits\ProductCheckTrait.php on line 32
Code snippet of problem
System details
- Operating System
- PHP Version 8
- ES-PHP client version
- Elasticsearch version 8.2.2
@creativedevs can you give me more information, including an example of the PHP code that you are using? Thanks!
Getting error Elastic\Elasticsearch\Exception\ProductCheckException: The client noticed that the server is not Elasticsearch and we do not support this unknown product in file \elasticsearch\elasticsearch\src\Traits\ProductCheckTrait.php on line 32
PHP Version 7.4 elasticsearch/elasticsearch package version 8.3.2 Elasticsearch version 7.8.0
Still no fix for this? I am facing the same issue
PHP Version 8.1 elasticsearch/elasticsearch package version 8.2 Elasticsearch version 8.3
I think this is not a bug. This is a feature. @rockyru @MonkWang @creativedevs Elasticsearch PHP Client supporting just only for Elasticsearch. Not for the similar other solutions. :)
hahaha. I need to fix this asap, I have a current deployment using laravel and I got stuck in here. Dang it!
Could you please execute and share your response with the following request :
curl -XGET 'http://localhost:9200' --verbose
I am getting the following response :
* Trying 127.0.0.1:9200...
* Connected to localhost (127.0.0.1) port 9200 (#0)
> GET / HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< X-elastic-product: Elasticsearch
< content-type: application/json
< content-length: 535
<
{
"name" : "node-1",
"cluster_name" : "test-cluster",
"cluster_uuid" : "......",
"version" : {
"number" : "8.0.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "1b6a7ece17463df5ff54a3e1302d825889aa1161",
"build_date" : "2022-02-03T16:47:57.507843096Z",
"build_snapshot" : false,
"lucene_version" : "9.0.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
* Connection #0 to host localhost left intact
As you see here, on the response header, there is X-elastic-product header as follow :
< X-elastic-product: Elasticsearch
Do you get on your server? The trait checks whether the requests coming from Elasticsearch server or not. Normally, with version 8.x, you need to get this header for all responses according to this PR. So, as I said before, this is a feature :D
This is what I am getting @hkulekci
- Trying 127.0.0.1...
- TCP_NODELAY set
- Connected to localhost (127.0.0.1) port 9200 (#0)
GET / HTTP/1.1 Host: localhost:9200 User-Agent: curl/7.58.0 Accept: /
- Empty reply from server
- Connection #0 to host localhost left intact curl: (52) Empty reply from server
So the problem is not the client, and your problem is the server. Somehow your server could not return the response correctly because / endpoint of Elasticsearch should return a response that seems to be my previous answer.
@hkulekci but Kibana is working fine. It is just the Elasticsearch that is not returning anything when I try to access it with its default port. Any idea?
Getting error Elastic\Elasticsearch\Exception\ProductCheckException: The client noticed that the server is not Elasticsearch and we do not support this unknown product in file \elasticsearch\elasticsearch\src\Traits\ProductCheckTrait.php on line 32
PHP Version 7.4 elasticsearch/elasticsearch package version 8.3.2 Elasticsearch version 7.8.0
@MonkWang I just noticed that you are using elasticsearch-php 8.x with Elasticsearch server 7.x. You need to use elasticsearch-php 7.x in order to connect to Elasticsearch 7.x. This is also reported in the README here.
@rockyru did you solve the issue? Are you using an official Elasticsearch server version? Elasticsearch 8 uses security by default, that means you need to use https and a valid credential to connect to it. You can read how to configure elasticsearch-php to connect to Elasticsearch 8 here.
I'm closing this issue. @rockyru let me know if you need to reopen it, thanks!
hi @ezimuel , yep I've resolved the issue. Thank you!