Closed
Description
In some cases, daemon can return different formats of error message for the same operation. The returned format depends on a specific error. E.g., here are two responses for the insert
request when daemon is used without Buddy:
curl -X POST localhost:9308/sql?mode=raw -d "query=create table test(f text)"
[{"total":0,"error":"","warning":""}]
curl -sX POST http://localhost:9308/insert -d '{
"index":"test",
"id":1,
"doc":
{
"f" : "a"
}
}'
{"_index":"test","_id":1,"created":true,"result":"created","status":201}
curl -sX POST http://localhost:9408/insert -d '{
"index":"test",
"id":1,
"doc":
{
"f" : "a"
}
}'
{"error":{"type":"duplicate id '1'","index":"test"},"status":409}
curl -sX POST http://localhost:9408/insert -d '{
"index":"test",
"id":-1,
"doc":
{
"f" : "a"
}
}'
{"error":"Negative document ids are not allowed"}
This can lead to problems with our OpenAPI-generated clients, so we should think of unifying those response formats in some way.