Multi_match - Error executing a search


#1

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.
To view this discussion on the web visit 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.


#2

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

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.
To view this discussion on the web visit 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.


(Ivan Brusic) #3

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

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.comwrote:

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

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.
To view this discussion on the web visit
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.

--
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/CALY%3DcQC9s6nfkgxesQYd3wL5HgY5g2DFh9p-q1FfYxPOGFpO_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4