Parsing exceptions

Is there any easy way to get just the relevant error messages out of an
exception?

I know there are multiple shards and each one can potentially return a
different error message but 99% of the time, the error is because I've made
a mistake.

This means I get the same message 50+ times in a complete soup of brackets
and braces.

The best solution I have at the moment is to scroll to the end of the error
and read backwards.

Is there any way to parse the error messages into something useful? As you
can see, it's not valid json...

SearchPhaseExecutionException[

Failedtoexecutephase[
query
],
allshardsfailed;shardFailures{
[
kieUEJ4uS_eoaBV3cBz3Rw
][
elmail
][
7
]: SearchParseException[
[
elmail
][
7
]: from[
-1
],
size[
0
]: ParseFailure[
Failedtoparsesource[
{
"size": 0,
"aggs": {
"senders": {
"terms": {
"field": "from.emailAddress",
"size": 50
},
"aggs": {
"senderDate": {
"date_histogram": {
"field": "date",
"interval": "quarter"
}
}
}
}
},
"filter": {
"range": {
"date": {
"gte": "-3year"
}
}
}
}
]
]
];nested: ElasticsearchParseException[
failedtoparsedatefield[
-3year

...Snip...

}{

[
  kieUEJ4uS_eoaBV3cBz3Rw
][
  elmail
][
  0
]: SearchParseException[
  [
    elmail
  ][
    0
  ]: from[
    -1
  ],
  size[
    0
  ]: ParseFailure[
    Failedtoparsesource[
      {
        "size": 0,
        "aggs": {
          "senders": {
            "terms": {
              "field": "from.emailAddress",
              "size": 50
            },
            "aggs": {
              "senderDate": {
                "date_histogram": {
                  "field": "date",
                  "interval": "quarter"
                }
              }
            }
          }
        },
        "filter": {
          "range": {
            "date": {
              "gte": "-3year"
            }
          }
        }
      }
    ]
  ]
];nested: ElasticsearchParseException[
  failedtoparsedatefield[
    -3year
  ],
  triedbothdateformat[
    dateOptionalTime
  ],
  andtimestampnumber
];nested: IllegalArgumentException[
  Invalidformat: "-3year"ismalformedat"year"
];

}
]"

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/669d35b5-c489-4099-b21f-e96a60ab4beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.