Parse Exception in Query Excecution


(samaswin) #1

Hi,
If I execute the follow query its shows a exception,
{
"from" : 0,
"size" : 20,
"query" : {
"multi_match" : {
"fields" : [ "Description", "jobStatus","rxCustomerID" ],
"query" : "no"
}
},
"sort" : [ {
"_uid" : {
"order" : "desc"
}
} ],
"highlight" : {
"pre_tags" : [ "" ],
"post_tags" : [ "
" ],
"fields" : {
"*" : { }
}
}
}

Note: The field rxCustomerID is long

Exception: NumberFormatException[For input string: "no"]; }]

Can anyone explain how to resolve that?

I need the query for multi_match only

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

I assume your mention of the field rxCustomerId is long was referring to
the datatype and not to the length of the field.

What the exception tries to express, is the problem that you cannot execute
a text search on a number field. What happens internally is, that the input
string is tried to be converted to a number (in order to execute the search
on a number based field), which fails and therefore the whole search
request fails. So omitting the field would be the simplest option, but most
likely not what you want.

Can you maybe explain, why you want to search in the number field as well?
Because the input could possibly be a number? A little more information
about what you want to do might result in someone having a workaround for
your problem.

--Alex

On Wed, Oct 16, 2013 at 7:51 AM, sam aswin samaswin@gmail.com wrote:

Hi,
If I execute the follow query its shows a exception,
{
"from" : 0,
"size" : 20,
"query" : {
"multi_match" : {
"fields" : [ "Description", "jobStatus","rxCustomerID" ],
"query" : "no"
}
},
"sort" : [ {
"_uid" : {
"order" : "desc"
}
} ],
"highlight" : {
"pre_tags" : [ "" ],
"post_tags" : [ "
" ],
"fields" : {
"*" : { }
}
}
}

Note: The field rxCustomerID is long

Exception: NumberFormatException[For input string: "no"]; }]

Can anyone explain how to resolve that?

I need the query for multi_match only

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.


(samaswin) #3

I need it for my application. Currently I converted all fields as a String.
So i didn't get the problem now.
Thanks Alexander

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #4

Hey,

alternatively you could use the lenient option, see
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_other_options(all
the options from match query also apply to multi match)

--Alex

On Wed, Oct 16, 2013 at 11:12 AM, sam aswin samaswin@gmail.com wrote:

I need it for my application. Currently I converted all fields as a
String. So i didn't get the problem now.
Thanks Alexander

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.


(samaswin) #5

Thanks Alex,
It works fine.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6