# Query\_string queries don't handle multiple types

**URL:** <https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055>\
**Category:** Elasticsearch\
**Created:** [December 30, 2013, 2:44pm UTC](https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055 "2013-12-30T14:44:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yarin](https://avatars.discourse-cdn.com/v4/letter/y/6a8cbe/32.png) [@yarin](https://discuss.elastic.co/u/yarin)\
**Post date:** [December 30, 2013, 2:44pm UTC](https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055/1 "2013-12-30T14:44:13Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![yarin](https://avatars.discourse-cdn.com/v4/letter/y/6a8cbe/32.png) [@yarin](https://discuss.elastic.co/u/yarin)\
**Post date:** [December 30, 2013, 2:52pm UTC](https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055/2 "2013-12-30T14:52:44Z")

</div>

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

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [February 4, 2014, 6:04pm UTC](https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055/3 "2014-02-04T18:04:36Z")

</div>

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](mailto:yarin.miran@gmail.com) wrote:

> Silly me,  
> I've found that there's a flag for ignoring these exceptions using  
> "lenient"
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](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](mailto: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](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](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/CAAOGaQKHNGSMtFMZLUP%2BMAPZfHUPZh0M1TUKWtZf2UMqZoq-gA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKHNGSMtFMZLUP%2BMAPZfHUPZh0M1TUKWtZf2UMqZoq-gA%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, 1:52am UTC](https://discuss.elastic.co/t/query-string-queries-dont-handle-multiple-types/15055/4 "2017-07-06T01:52:39Z")

</div>


