Skip to content
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

issue with elasticsearch server and PUT requests #8

Open
ghukill opened this issue Jun 13, 2022 · 4 comments
Open

issue with elasticsearch server and PUT requests #8

ghukill opened this issue Jun 13, 2022 · 4 comments

Comments

@ghukill
Copy link
Contributor

ghukill commented Jun 13, 2022

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

@ghukill
Copy link
Contributor Author

ghukill commented Jun 13, 2022

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.

@arwhyte
Copy link
Contributor

arwhyte commented Jun 13, 2022

@csev, @ghukill -- ran all three assignments without issue. Passed all tests.

  • elasticsearch book
  • elasticsearch email
  • elasticsearch tweets

@csev
Copy link
Owner

csev commented Jun 13, 2022

So it looks like a service on the pg4e.com server went down and just needed restarting.

@csev
Copy link
Owner

csev commented Jun 13, 2022

I should make error checking smarter in the PHP code.

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

No branches or pull requests

3 participants