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

elastic should trace the response even http status code is not 2xx #297

Closed
Jack47 opened this issue Jun 13, 2016 · 5 comments
Closed

elastic should trace the response even http status code is not 2xx #297

Jack47 opened this issue Jun 13, 2016 · 5 comments
Assignees

Comments

@Jack47
Copy link

Jack47 commented Jun 13, 2016

Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[ ] elastic.v2 (for Elasticsearch 1.x)
[X] elastic.v3 (for Elasticsearch 2.x)

Please describe the expected behavior

elastic should trace the response even the http status code is not 2xx.

Please describe the actual behavior

I want to find specific doc by it's id, this doc doesn't exist in ES, then elastic returned an error with status code 401. I set trace log for elastic and try to figure out what happened, but I can't see the corresponding http response in trace log.

Any steps to reproduce the behavior?

Try to find an not exist doc by it's id

@olivere
Copy link
Owner

olivere commented Jun 14, 2016

I'll investigate if I can change Client.PerformRequest accordingly. Thanks for reporting.

@freb
Copy link

freb commented Jul 17, 2017

I believe the issue I'm having is the same. I had a scroll request that would return an error on:

results, err := scroll.Do(ctx)

Which I then use to panic. The panic takes place because the response is a 400, but I only get a portion of the actual response that is included in err and not the full trace as configured on the client. This is all I see:

panic: elastic: Error 400 (Bad Request): all shards failed [type=search_phase_execution_exception]

I ended up using the trace output of the request to send a curl request. It's response included the additional detail I needed:

"reason":"No mapping found for [flow.] in order to sort on"

Adding reason to the error or tracing the raw response before the error is returned would help.

@olivere
Copy link
Owner

olivere commented Jul 18, 2017

@freb Yes, fixing the tracing is an open issue, but it's fixed soon by #553. You can get access to all error details that ES returns by type checking on Error.

olivere added a commit that referenced this issue Jul 18, 2017
This closes long standing issues #297 and #553.
@freb
Copy link

freb commented Jul 18, 2017

Sorry! I didn't see the separate issue. Good to know about type checking Error, I hadn't thought of that.

Anyway, thanks for the awesome library. I'm enjoying it much more than official Python library.

@olivere
Copy link
Owner

olivere commented Mar 24, 2018

Closing for it is too old. If you still see this as a problem, please file a new issue and link back to this one. Thanks.

@olivere olivere closed this as completed Mar 24, 2018
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

3 participants