# Parsing exceptions

**URL:** <https://discuss.elastic.co/t/parsing-exceptions/18751>\
**Category:** Elasticsearch\
**Created:** [July 20, 2014, 12:46am UTC](https://discuss.elastic.co/t/parsing-exceptions/18751 "2014-07-20T00:46:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_O](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Simon\_O](https://discuss.elastic.co/u/Simon_O)\
**Post date:** [July 20, 2014, 12:46am UTC](https://discuss.elastic.co/t/parsing-exceptions/18751/1 "2014-07-20T00:46:07Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/669d35b5-c489-4099-b21f-e96a60ab4beb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:14am UTC](https://discuss.elastic.co/t/parsing-exceptions/18751/2 "2017-07-06T01:14:42Z")

</div>


