Hi,
I am trying to perform a wildcard query on date type, which is not allowed by ES, so I see an exception being thrown from ES as below:
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "Can only use wildcard queries on keyword, text and wildcard fields - not on [OrderDate] which is of type [date]",
"index_uuid": "cypJ5a9eTlmGhQkJy_BJAQ",
"index": "order_202109"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "order_202109",
"node": "TkkTI0EhTsC2_5QxtzN0Rw",
"reason": {
"type": "query_shard_exception",
"reason": "Can only use wildcard queries on keyword, text and wildcard fields - not on [OrderDate] which is of type [date]",
"index_uuid": "cypJ5a9eTlmGhQkJy_BJAQ",
"index": "order_202109"
}
}
]
},
"status": 400
}
But when I get the rootCause from ElasticsearchException
Throwable cause = ElasticsearchException.getRootCause();
cause.getMessage();
It only gives me
"type": "search_phase_execution_exception",
"reason": "all shards failed",
Is there any utility method to extract the actual error root cause, which is
"type": "query_shard_exception",
"reason": "Can only use wildcard queries on keyword, text and wildcard fields - not on [OrderDate] which is of type [date]"
Thank you:)