I've been struggling with this for a few days. I initially posted this question on the Elastic Cloud, but they advised to post here.
I have a PHP app running in a Slim2 framework, with Elastic as a
local installation all working no problems. Elastic PHP client v2 etc
all configured fine. I'm using a config file to pass connection
parameters to the Elastic PHP client
Basically I connect to the local cluster with a 'host' = 'http://127.0.0.1:9200'
and set an index with
'es_index' => [ 'index' => 'test_index' ]
This all works fine.
So I setup an Elastic Cloud cluster to trial a production level
capability. Did that no problem, configured Shield etc, all working.
I can connect to this cluster direct from the server(s) with a simple:
curl -XGET 'http://user:password@b931c39....eu-west-1.aws.found.io:9200/'
user, password and cluster name not real in above line, but you get the idea.
That seems to work fine, but if I replace the path in the PHP config file with this endpoint
'path' => 'http://user:password@b931c391b4cb....eu-west-1.aws.found.io:9200'
I get nothing, it essentially cannot find the cluster, even though a cluster and index are present.
So I know I am making a very basic error, but I just can find any
help, or a decent example. I've tried this from a vagrant box, CURL
works, PHP doesn't. I've tried it from a Server, same problem.
Can someone point me at some help or an example? I can't see why I
can connect from any of these servers via CURL, but the path in the
config file bombs, when it works fine with a local path. I'm assuming
there is a config issue somewhere that I'm missing?
Thanks Guys
Not sure if this might help, but if I print_r the $response, I get this with the full end point
Array ( [ok] => [message] => Unknown cluster.)
If I shorten the end point to - http://user:password@b931c391b4cb....eu-west-1.aws:9200
then $response returns
Array ( [error] => IndexMissingException[[soros_test] missing] [status] => 404)
So I'm not sure if this is saying the cluster is now found, but the index is unavailable?
Of course if I cut and paste the full endpoint into the browser I get
the expected response, so I'm assuming this is a configuration issue
somewhere in elasticsearch-PHP.
Even tried turning on inline scripting but that had no effect.
Completely lost as to what to try next?
The cloud guys have suggested this is probably an issue between the elasticsearch-PHP libs and the Slim2 framework. I'm guessing this is something about the way the URL is being interpreted?