# Multi\_match - Error executing a search

**URL:** <https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733>\
**Category:** Elasticsearch\
**Created:** [December 5, 2013, 7:05pm UTC](https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733 "2013-12-05T19:05:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luca\_Rondanini](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Luca\_Rondanini](https://discuss.elastic.co/u/Luca_Rondanini)\
**Post date:** [December 5, 2013, 7:05pm UTC](https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733/1 "2013-12-05T19:05:27Z")

</div>

Hi all,

I'm trying to execute this query:

{  
"from": 0,  
"size": 10,  
"query": {  
"multi\_match": {  
"query": "test",  
"fields": ["RequestNumber^2","RequestStatus","Description"]  
}  
}  
}

But I get the following error:

nested: NumberFormatException[For input string: "test"]

It seems like ES is expecting a number as value for the query parameter. If  
I try to change the query as

.......  
"query": 123,  
.......

It actually works, well.....it returns results and not an error!

I'm using a brand new ES instance v0.90.7.

I have the feeling that I'm just doing something stupid! Any idea?

Thanks,  
Luca

--  
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/0de0f0a9-8c1c-4d43-9ab1-a5c0a6988381%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0de0f0a9-8c1c-4d43-9ab1-a5c0a6988381%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Luca\_Rondanini](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Luca\_Rondanini](https://discuss.elastic.co/u/Luca_Rondanini)\
**Post date:** [December 5, 2013, 7:14pm UTC](https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733/2 "2013-12-05T19:14:14Z")

</div>

I think I've found my error, I'm posting here the solution for future  
readers but if anyone could confirm or add explanations it would be nice.

It seems like multi\_match tries to convert "query" based on the type of the  
field that ES is analyzing. For example: if in the fields list you have an  
integer field, ES will try to convert "query" to integer when  
"parsing/matching/analyzing" that field.

I've changed the query to

"fields": ["\_all"]

and everything looks fine now.

I've found a clue for this explanation here:

[https://groups.google.com/forum/?fromgroups#!searchin/elasticsearch/multi\_match/elasticsearch/shyPAR\_Lv\_g/-PMIArZaCjUJ](https://groups.google.com/forum/?fromgroups#!searchin/elasticsearch/multi_match/elasticsearch/shyPAR_Lv_g/-PMIArZaCjUJ)

Please, feel free to correct me if I'm wrong or you have a better  
explanation.

Thanks

On Thursday, December 5, 2013 11:05:27 AM UTC-8, Luca Rondanini wrote:

> Hi all,
> 
> I'm trying to execute this query:
> 
> {  
> "from": 0,  
> "size": 10,  
> "query": {  
> "multi\_match": {  
> "query": "test",  
> "fields": ["RequestNumber^2","RequestStatus","Description"]  
> }  
> }  
> }
> 
> But I get the following error:
> 
> nested: NumberFormatException[For input string: "test"]
> 
> It seems like ES is expecting a number as value for the query parameter.  
> If I try to change the query as
> 
> .......  
> "query": 123,  
> .......
> 
> It actually works, well.....it returns results and not an error!
> 
> I'm using a brand new ES instance v0.90.7.
> 
> I have the feeling that I'm just doing something stupid! Any idea?
> 
> Thanks,  
> Luca

--  
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/abef5152-c5f0-4cb9-8ebe-ef39b6d4d5eb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/abef5152-c5f0-4cb9-8ebe-ef39b6d4d5eb%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 6, 2013, 5:36pm UTC](https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733/3 "2013-12-06T17:36:40Z")

</div>

Correct, the analyzer used will be dependent on the field mapping:

[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java?source=cc#L120-L123](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java?source=cc#L120-L123)

Ultimately the multi\_match query will be converted into a boolean query,  
which you can construct yourself, but your problem will still remain. You  
cannot search a numeric field with a string. The \_all field is mapped  
different and therefore works.

Cheers,

Ivan

On Thu, Dec 5, 2013 at 11:14 AM, Luca Rondanini [luca.rondanini@gmail.com](mailto:luca.rondanini@gmail.com)wrote:

> I think I've found my error, I'm posting here the solution for future  
> readers but if anyone could confirm or add explanations it would be nice.
> 
> It seems like multi\_match tries to convert "query" based on the type of  
> the field that ES is analyzing. For example: if in the fields list you have  
> an integer field, ES will try to convert "query" to integer when  
> "parsing/matching/analyzing" that field.
> 
> I've changed the query to
> 
> "fields": ["\_all"]
> 
> and everything looks fine now.
> 
> I've found a clue for this explanation here:
> 
> [Redirecting to Google Groups](https://groups.google.com/forum/?fromgroups#!searchin/elasticsearch/multi_match/elasticsearch/shyPAR_Lv_g/-PMIArZaCjUJ)
> 
> Please, feel free to correct me if I'm wrong or you have a better  
> explanation.
> 
> Thanks
> 
> On Thursday, December 5, 2013 11:05:27 AM UTC-8, Luca Rondanini wrote:
> 
> > Hi all,
> > 
> > I'm trying to execute this query:
> > 
> > {  
> > "from": 0,  
> > "size": 10,  
> > "query": {  
> > "multi\_match": {  
> > "query": "test",  
> > "fields": ["RequestNumber^2","RequestStatus","Description"]  
> > }  
> > }  
> > }
> > 
> > But I get the following error:
> > 
> > nested: NumberFormatException[For input string: "test"]
> > 
> > It seems like ES is expecting a number as value for the query parameter.  
> > If I try to change the query as
> > 
> > .......  
> > "query": 123,  
> > .......
> > 
> > It actually works, well.....it returns results and not an error!
> > 
> > I'm using a brand new ES instance v0.90.7.
> > 
> > I have the feeling that I'm just doing something stupid! Any idea?
> > 
> > Thanks,  
> > Luca
> 
> --  
> 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/abef5152-c5f0-4cb9-8ebe-ef39b6d4d5eb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/abef5152-c5f0-4cb9-8ebe-ef39b6d4d5eb%40googlegroups.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CALY%3DcQC9s6nfkgxesQYd3wL5HgY5g2DFh9p-q1FfYxPOGFpO\_Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC9s6nfkgxesQYd3wL5HgY5g2DFh9p-q1FfYxPOGFpO_Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:02am UTC](https://discuss.elastic.co/t/multi-match-error-executing-a-search/14733/4 "2017-07-06T02:02:49Z")

</div>


