# Numberformat exception

**URL:** <https://discuss.elastic.co/t/numberformat-exception/21804>\
**Category:** Elasticsearch\
**Created:** [January 23, 2015, 6:54pm UTC](https://discuss.elastic.co/t/numberformat-exception/21804 "2015-01-23T18:54:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prateek](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@prateek](https://discuss.elastic.co/u/prateek)\
**Post date:** [January 23, 2015, 6:54pm UTC](https://discuss.elastic.co/t/numberformat-exception/21804/1 "2015-01-23T18:54:39Z")

</div>

I am indexing different type of fields that include number and strings.  
When I use multimatch queries (that includes both number and string fields)  
for terms such as "2001 camaro", I get NumberFormatException. I understand  
why this is happening but wondering if this can be avoided. Temporarily, I  
have fixed it by indexing all fields as strings instead of numbers.

Example:  
Fields used : year (number) and model (string)  
multimatch cross type query includes both year and model.  
search query: 2001 camaro

--  
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/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 23, 2015, 8:23pm UTC](https://discuss.elastic.co/t/numberformat-exception/21804/2 "2015-01-23T20:23:04Z")

</div>

On this issue is being worked on

> <https://github.com/elastic/elasticsearch/issues/3975>
>
> When execute this simple example it crashes:
> 
> \`\`\`
> curl -XPUT http://localhost:92…00/blog/post/1?pretty=1 -d '{"foo":123, "bar":"xyzzy"}'
> 
> curl -XGET http://localhost:9200/blog/post/\_search?pretty=1 -d '{"query": {"multi\_match": {"fields": \["foo", "bar"\], "query": "xyzzy", "useDisMax": true}}}'
> \`\`\`
> 
> stack trace:
> {
> "error" : "SearchPhaseExecutionException\[Failed to execute phase \[query\], all shards failed; shardFailures {\[BIXGo8\_wTEiO9jVc0KjZ\_w\]\[blog\]\[1\]: SearchParseException\[\[blog\]\[1\]: from\[-1\],size\[-1\]: Parse Failure \[Failed to parse source \[{\\"query\\": {\\"multi\_match\\": {\\"fields\\": \[\\"foo\\", \\"bar\\"\], \\"query\\": \\"xyzzy\\", \\"useDisMax\\": true}}}\]\]\]; nested: NumberFormatException\[For input string: \\"xyzzy\\"\]; }{\[BIXGo8\_wTEiO9jVc0KjZ\_w\]\[blog\]\[0\]: SearchParseException\[\[blog\]\[0\]: from\[-1\],size\[-1\]: Parse Failure \[Failed to parse source \[{\\"query\\": {\\"multi\_match\\": {\\"fields\\": \[\\"foo\\", \\"bar\\"\], \\"query\\": \\"xyzzy\\", \\"useDisMax\\": true}}}\]\]\]; nested: NumberFormatException\[For input string: \\"xyzzy\\"\]; }{\[BIXGo8\_wTEiO9jVc0KjZ\_w\]\[blog\]\[4\]: SearchParseException\[\[blog\]\[4\]: from\[-1\],size\[-1\]: Parse Failure \[Failed to parse source \[{\\"query\\": {\\"multi\_match\\": {\\"fields\\": \[\\"foo\\", \\"bar\\"\], \\"query\\": \\"xyzzy\\", \\"useDisMax\\": true}}}\]\]\]; nested: NumberFormatException\[For input string: \\"xyzzy\\"\]; }{\[BIXGo8\_wTEiO9jVc0KjZ\_w\]\[blog\]\[2\]: SearchParseException\[\[blog\]\[2\]: from\[-1\],size\[-1\]: Parse Failure \[Failed to parse source \[{\\"query\\": {\\"multi\_match\\": {\\"fields\\": \[\\"foo\\", \\"bar\\"\], \\"query\\": \\"xyzzy\\", \\"useDisMax\\": true}}}\]\]\]; nested: NumberFormatException\[For input string: \\"xyzzy\\"\]; }{\[BIXGo8\_wTEiO9jVc0KjZ\_w\]\[blog\]\[3\]: SearchParseException\[\[blog\]\[3\]: from\[-1\],size\[-1\]: Parse Failure \[Failed to parse source \[{\\"query\\": {\\"multi\_match\\": {\\"fields\\": \[\\"foo\\", \\"bar\\"\], \\"query\\": \\"xyzzy\\", \\"useDisMax\\": true}}}\]\]\]; nested: NumberFormatException\[For input string: \\"xyzzy\\"\]; }\]",
> "status" : 400
> }

Indexing all fields as strings seems like a plausible workaround.

Jörg

On Fri, Jan 23, 2015 at 7:54 PM, Prateek Asthana [paryanz@gmail.com](mailto:paryanz@gmail.com) wrote:

> I am indexing different type of fields that include number and strings.  
> When I use multimatch queries (that includes both number and string fields)  
> for terms such as "2001 camaro", I get NumberFormatException. I understand  
> why this is happening but wondering if this can be avoided. Temporarily, I  
> have fixed it by indexing all fields as strings instead of numbers.
> 
> Example:  
> Fields used : year (number) and model (string)  
> multimatch cross type query includes both year and model.  
> search query: 2001 camaro
> 
> --  
> 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/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/97149488-9e49-4ba8-8bdb-1a1a157e79b1%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAKdsXoHUkoL9GaoCu1g6Fv-UbLj-LWydTxvTFgWgurQA%3Dc7adA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHUkoL9GaoCu1g6Fv-UbLj-LWydTxvTFgWgurQA%3Dc7adA%40mail.gmail.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, 12:36am UTC](https://discuss.elastic.co/t/numberformat-exception/21804/3 "2017-07-06T00:36:56Z")

</div>


