Closed
Description
DELETE *
PUT test/test/1
{
"foz": "bar"
}
GET _search?sort=foo
Rendered as a structured exception:
{
"error": {
"root_cause": [
{
"type": "search_parse_exception",
"reason": "No mapping found for [foo] in order to sort on"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test",
"node": "v04p8T35S1ySNdsF9GTl7w",
"reason": {
"type": "search_parse_exception",
"reason": "Failed to parse source [{\"sort\":[{\"foo\":{}}]}]",
"caused_by": {
"type": "search_parse_exception",
"reason": "No mapping found for [foo] in order to sort on"
}
}
}
]
},
"status": 400
}
However, if one shard succeeds, then exceptions are no longer structured:
PUT test2/test/1
{
"foo": "bar"
}
GET _search?sort=foo
Renders as:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 5,
"failed": 5,
"failures": [
{
"index": "test",
"shard": 0,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\":[{\"foo\":{}}]}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 1,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\":[{\"foo\":{}}]}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 2,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\":[{\"foo\":{}}]}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 3,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\":[{\"foo\":{}}]}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 4,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\":[{\"foo\":{}}]}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
}
]
},
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "test2",
"_type": "test",
"_id": "1",
"_score": null,
"_source": {
"foo": "bar"
},
"sort": [
"bar"
]
}
]
}
}
Similarly, errors in bulk APIs are not structured:
PUT test/test/_bulk
{"index": {"_id": 1 }}
{}
{"index": {"_id": 1 ,"_version": 2}}
{}
Returns:
{
"took": 60,
"errors": true,
"items": [
{
"index": {
"_index": "test",
"_type": "test",
"_id": "1",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"status": 201
}
},
{
"index": {
"_index": "test",
"_type": "test",
"_id": "1",
"status": 409,
"error": "[test][3][test][1]: version conflict, current [1], provided [2]"
}
}
]
}
Curiously, _msearch
doesn't return the reason if all shards failed:
GET _msearch
{"index": "test"}
{"sort": "foo"}
{"index": "_all"}
{"sort": "foo"}
Returns:
{
"responses": [
{
"error": "SearchPhaseExecutionException[all shards failed]"
},
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 5,
"failed": 5,
"failures": [
{
"index": "test",
"shard": 0,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\": \"foo\"}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 1,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\": \"foo\"}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 2,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\": \"foo\"}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 3,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\": \"foo\"}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
},
{
"index": "test",
"shard": 4,
"status": 400,
"reason": "RemoteTransportException[[Frigga][inet[/192.168.2.183:9300]][indices:data/read/search[phase/query]]]; nested: SearchParseException[Failed to parse source [{\"sort\": \"foo\"}]]; nested: SearchParseException[No mapping found for [foo] in order to sort on]; "
}
]
},
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "test2",
"_type": "test",
"_id": "1",
"_score": null,
"_source": {
"foo": "bar"
},
"sort": [
"bar"
]
}
]
}
}
]
}