Query_string queries don't handle multiple types


(yarin) #1

Hello everyone,

I'm trying to implement a search for one of my indices using the following
query:

{
"query" : {
"query_string" : {
"query" : "some text",
"fields" : ["collected.*"]
}
}
}

The documents in the index have a field named "collected" which is dynamic
and changes between documents.

When I try to run this query I get NumberFormatException since some of the
fields are Numeric and I guess elasticsearch tries to cast the input string
to a number.
Is there any possibility to make the query_string parameter perform a 'best
effort' search without raising that exception so that it will ignore the
fields that he can't cast,

Thanks,
Yarin

--
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/d4492b49-b299-4eae-92a7-07026e19be66%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(yarin) #2

Silly me,
I've found that there's a flag for ignoring these exceptions using
"lenient"

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

On Monday, December 30, 2013 4:44:13 PM UTC+2, Yarin Miran wrote:

Hello everyone,

I'm trying to implement a search for one of my indices using the following
query:

{
"query" : {
"query_string" : {
"query" : "some text",
"fields" : ["collected.*"]
}
}
}

The documents in the index have a field named "collected" which is dynamic
and changes between documents.

When I try to run this query I get NumberFormatException since some of the
fields are Numeric and I guess elasticsearch tries to cast the input string
to a number.
Is there any possibility to make the query_string parameter perform a
'best effort' search without raising that exception so that it will ignore
the fields that he can't cast,

Thanks,
Yarin

--
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/64982b6f-0152-4a02-bfe0-85c7806b0f6b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Amit Soni) #3

I am using simple query string and also get this number format exception
for same reason. However it seems there is no "lenient" flag for simple
query string.

thoughts?

-Amit.

On Mon, Dec 30, 2013 at 6:52 AM, Yarin Miran yarin.miran@gmail.com wrote:

Silly me,
I've found that there's a flag for ignoring these exceptions using
"lenient"

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

On Monday, December 30, 2013 4:44:13 PM UTC+2, Yarin Miran wrote:

Hello everyone,

I'm trying to implement a search for one of my indices using the
following query:

{
"query" : {
"query_string" : {
"query" : "some text",
"fields" : ["collected.*"]
}
}
}

The documents in the index have a field named "collected" which is
dynamic and changes between documents.

When I try to run this query I get NumberFormatException since some of
the fields are Numeric and I guess elasticsearch tries to cast the input
string to a number.
Is there any possibility to make the query_string parameter perform a
'best effort' search without raising that exception so that it will ignore
the fields that he can't cast,

Thanks,
Yarin

--
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/64982b6f-0152-4a02-bfe0-85c7806b0f6b%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/CAAOGaQKHNGSMtFMZLUP%2BMAPZfHUPZh0M1TUKWtZf2UMqZoq-gA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4