This works fine and return the results as long as I'm using the HTTP
endpoint. But when I use the HTTPS endpoint. It throws "No alive nodes
found in your cluster" error and terminates. Please help.
Hey all, I'm the maintainer of the ES-PHP library. That error can come from a few different places. For the next major version, I'm planning on cleaning up the exception hierarchy, so that issues like this are more explicit.
To summarize, there are a few situations where this error can occur. Most generally, it means the client simply couldn't find any valid nodes to talk to. This could happen because:
All your nodes are down (likely not the issue, but worth mentioning)
Firewall / port issues. Make sure your firewall is configured to allow the appropriate port
SELinux policies. By default, SELinux only allows outbound access to "standard" ports like 80, 443, etc, which can block the "non-standard" ports used by ES (9200). You'll likely need to modify your SELinux policy, or switch ES's port. This sometime shows as a cURL error 7 exception in the client, depending on how recent your version is
Out-dated or missing root certificates. If your client works over standard HTTP but not HTTPS, it's likely a misconfigured root certificate. The docs have instructions on how to include CaCurlBundle, which will include a recently updated bundle of root certificates. Alternatively, you could just update the root certs globally on your OS.
String escaping. Similarly, if your user/pass includes a dollar sign ($) and you are double-quoting your string ("), PHP will attempt to find a variable to replace with. Usually it's a nonsense variable $adi8ejd29, PHP emits a notice (which may be suppressed by your config) and the authentication fails.
Slightly newer versions of the client report this better, and the next major version will overhaul this entire hierarchy of exceptions and how they are reported.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.