Fixed XFES swallows elasticsearch error message

Xon

Well-known member
Affected version
2.2.0
XFES does not reliably extract the reason in all cases, and instead returns "all shards failed".

Code:
{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {...}",
        "index_uuid": "eGF-QPilSjmnXSIyciAi8A",
        "index": "index"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "index",
        "node": "KSAcwz8sRCefPVJo0wK7Xg",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {...}",
          "index_uuid": "eGF-QPilSjmnXSIyciAi8A",
          "index": "index",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Can't parse boolean value [0], expected [true] or [false]"
          }
        }
      }
    ]
  },
  "status": 400
}

Extracting the reason.type/reason.caused_by.type/reason.caused_by.reason from the failed_shards gives the actual failure reason. (probably safe to just grab from the first failed shard.
 
Last edited:
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFES release (2.2.1).

Change log:
Improve collection of error messages from Elasticsearch in certain circumstances.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom