Skip to content

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 #1229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
creativedevs opened this issue Jun 2, 2022 · 13 comments

Comments

@creativedevs
Copy link

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
@ezimuel
Copy link
Contributor

ezimuel commented Jun 29, 2022

@creativedevs can you give me more information, including an example of the PHP code that you are using? Thanks!

@MonkWang
Copy link

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

@rockyru
Copy link

rockyru commented Jul 23, 2022

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

@hkulekci
Copy link
Contributor

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. :)

@rockyru
Copy link

rockyru commented Jul 24, 2022

hahaha. I need to fix this asap, I have a current deployment using laravel and I got stuck in here. Dang it!

@hkulekci
Copy link
Contributor

hkulekci commented Jul 24, 2022

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

@rockyru
Copy link

rockyru commented Jul 24, 2022

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

@hkulekci
Copy link
Contributor

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.

@rockyru
Copy link

rockyru commented Jul 25, 2022

@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?

@ezimuel
Copy link
Contributor

ezimuel commented Aug 18, 2022

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.

@ezimuel
Copy link
Contributor

ezimuel commented Aug 18, 2022

@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.

@ezimuel
Copy link
Contributor

ezimuel commented Sep 21, 2022

I'm closing this issue. @rockyru let me know if you need to reopen it, thanks!

@ezimuel ezimuel closed this as completed Sep 21, 2022
@rockyru
Copy link

rockyru commented Sep 21, 2022

hi @ezimuel , yep I've resolved the issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants