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

Connection::httpRequest() doesn't proccess errors received in response body #136

Closed
sizeg opened this issue Jun 30, 2017 · 4 comments
Closed
Labels
type:docs Documentation
Milestone

Comments

@sizeg
Copy link
Contributor

sizeg commented Jun 30, 2017

I'm using ES 5.2 and it returns error on post request in this manner:

200 OK

content-type: application/json; charset=UTF-8

{"took":0,"errors":true,"items":[{"create":{"_index":"music","_type":"album","_id":"42760","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse [artistTags]","caused_by":{"type":"illegal_state_exception","reason":"Can't get text on a START_OBJECT at 1:134"}}}}]}

Should \yii\elasticsearch\Connection::httpRequest() interpretates it as error and throw exception? Or we should manualy parse such kind of errors?

@cebe
Copy link
Member

cebe commented Jul 3, 2017

why does it return a HTTP 200 code in case of an error? I would consider that a bug in elasticsearch.

@sizeg
Copy link
Contributor Author

sizeg commented Jul 3, 2017

@cebe seems that it's ok for bulk commands. I found this discussions:
elastic/elasticsearch#25156
elastic/elasticsearch#18978

Shortly, each bulk can have own errors.

@beowulfenator
Copy link
Collaborator

This is not a bug. As noted above, there are two cases when Elasticsearch's code 200 response is questionable. In case of partial shard failures, I would not consider it an error. After all, we do get a result.

As for partial failures of batch requests, that is what they are, a batch. Every item in a batch can succeed or fail and it can fail in its own way. This should be described in the docs, hence the "docs" label.

beowulfenator added a commit to beowulfenator/yii2-elasticsearch that referenced this issue Jul 15, 2020
beowulfenator added a commit to beowulfenator/yii2-elasticsearch that referenced this issue Jul 15, 2020
@beowulfenator
Copy link
Collaborator

Reflected these considerations in the docs.

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

No branches or pull requests

3 participants