pg4e
pg4e copied to clipboard
issue with elasticsearch server and PUT requests
@csev - seeing some unusual errors coming back from the class Elasticsearch instance. @arwhyte suggested creating an issue here.
When attempting an autograder, seeing this:
Error: cURL error 7: Failed to connect to localhost port 9200: Connection refused
What led me to try that, was seeing this error when attempting to create an index:
SerializationError: Unknown mimetype, unable to deserialize: text/html
I’m using the same code and environment that has previously worked without issue. I have confirmed that my elasticsearch
client is 7.13.4
(must be > 6
for our ES server, and < 8
for API changes).
Doing a little digging, it sounds like there is potential for network and/or proxies to introduce this behavior?
What is strange, is that I can delete indexes via res = es.indices.delete(index=indexname, ignore=[400, 404])
. Which leads me to believe it’s related to the PUT
HTTP command that client sends for index creation.
When attempting via raw HTTP PUT
request with Postman, seeing this reponse:
<br />
<b>Warning</b>: file_get_contents(http://localhost:9200/_stats/store): failed to open stream: Connection refused in
<b>/var/www/html/elasticsearch/index.php</b> on line <b>63</b><br />
<br />
<b>Notice</b>: Trying to get property 'indices' of non-object in <b>/var/www/html/elasticsearch/index.php</b> on line
<b>65</b><br />
<br />
<b>Notice</b>: Trying to get property 'indices' of non-object in <b>/var/www/html/elasticsearch/index.php</b> on line
<b>69</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/html/elasticsearch/index.php</b> on line
<b>69</b><br />
<pre>Array
(
[type] => 2
[message] => Invalid argument supplied for foreach()
[file] => /var/www/html/elasticsearch/index.php
[line] => 69
)
</pre>
This makes me think the error is the occurring at the request --> PHP --> elasticsearch layer, which I'm assuming is acting like a reverse proxy of sorts?
Hadn't thought to actually examine the PHP code until just now. Seeing the method detection here that would explain why DELETE
requests are executing okay.
@csev, @ghukill -- ran all three assignments without issue. Passed all tests.
- elasticsearch book
- elasticsearch email
- elasticsearch tweets
So it looks like a service on the pg4e.com server went down and just needed restarting.
I should make error checking smarter in the PHP code.