opensearch-project/OpenSearch
Ver no GitHub[BUG] Server errors propagated with index creation requests
Open
#7.096 aberto em 11 de abr. de 2023
Indexingbuggood first issue
Métricas do repositório
- Stars
- (8.123 stars)
- Métricas de merge de PR
- (Mesclagem média 5d 9h) (266 fundiu PRs em 30d)
Description
Describe the bug
Server errors within OpenSearch are exposed to the client when trying to create an index under certain conditions.
Condition 1: When the request body is numeric
PUT /testindex7?pretty HTTP/1.1
Host: ...
User-Agent: curl/7.86.0
Authorization: Basic [...]
Content-Type: application/json
Accept: application/xml
Connection: close
Content-Length: 1
0
Response:
HTTP/1.1 500 Internal Server Error
content-type: application/json; charset=UTF-8
content-length: 390
{
"error" : {
"root_cause" : [
{
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
}
],
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
},
"status" : 500
}
Condition 2: When cluster manager is unavailable Response:
HTTP/1.1 503 Service Unavailable
content-type: application/json; charset=UTF-8
content-length: 246
{
"error" : {
"root_cause" : [
{
"type" : "cluster_manager_not_discovered_exception",
"reason" : null
}
],
"type" : "cluster_manager_not_discovered_exception",
"reason" : null
},
"status" : 503
}
To Reproduce Steps to reproduce the behavior:
- Create an index with the above conditions
Expected behavior
- The response should abstract out the underlying reason for failure by sending a
400 (Bad Request)response back to the client - This behavior can be made configurable where setting a property on the server disables or enables the stack trace and detailed response
Host/Environment (please complete the following information):
- OS: AL2
Additional context
- N/A