# Query\_string error

**URL:** <https://discuss.elastic.co/t/query-string-error/3704>\
**Category:** Elasticsearch\
**Created:** [December 28, 2010, 10:34pm UTC](https://discuss.elastic.co/t/query-string-error/3704 "2010-12-28T22:34:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evan\_Stenmark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evan_stenmark/32/3289_2.png) [@Evan\_Stenmark](https://discuss.elastic.co/u/Evan_Stenmark)\
**Post date:** [December 28, 2010, 10:34pm UTC](https://discuss.elastic.co/t/query-string-error/3704/1 "2010-12-28T22:34:54Z")

</div>

I recently upgraded to .13 and now I think I'm seeing an issue with  
query\_string with multiple fields.

If I use this query like:  
{  
"query":{  
"query\_string":{  
"fields":[  
"somedata.1234.field1"  
],  
"query":"myquery"  
}  
}  
}

I get results and no error, but this query:

{  
"query":{  
"query\_string":{  
"fields":[  
"somedata.1234.field1",  
"somedata.1234.field2"  
],  
"query":"myquery"  
}  
}  
}

gives me this error (sorry it comes back to me without much  
formatting):

SearchPhaseExecutionException[Failed to execute phase [query], total  
failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
QueryPhaseExecutionException[[nodedata][0]:  
query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
org.elasticsearch.index.field.data.strings.StringFieldDataType  
$1@58e090c8\>]: Query Failed [Failed to execute main query]];  
nested: }  
...[cutting out several more lines of essentially repeated data in the  
error]...

Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![Evan\_Stenmark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evan_stenmark/32/3289_2.png) [@Evan\_Stenmark](https://discuss.elastic.co/u/Evan_Stenmark)\
**Post date:** [December 28, 2010, 10:40pm UTC](https://discuss.elastic.co/t/query-string-error/3704/2 "2010-12-28T22:40:09Z")

</div>

Upon further inspection, that's not the root issue.

The full search looks like this (I've renamed fields/data):

{  
"from":0,  
"size":"50",  
"sort":{"extrasorts.sort\_name":"asc"},  
"fields":["\_id"],  
"query":{  
"constant\_score":{  
"filter":{  
"and":[  
{  
"term":{  
"node":1  
}  
},  
{  
"term":{  
"is\_searchable":1  
}  
},  
{  
"range":{  
"somedata.5555.someDateField":{  
"from":"2010-12-28T16:12:11-06:00"  
}  
}  
},  
{  
"term":{  
"somedata.1111.somefield":1  
}  
},  
{  
"query":{  
"query\_string":{  
"fields":[  
"somedata.1234.field1",  
"somedata.1234.field2"  
],  
"query":"myquery"  
}  
}  
},  
{  
"terms":{  
"tier":[  
"1",  
"2"  
]  
}  
}  
]  
},  
"boost":1.2  
}  
}  
}

I tried pulling out all of the filters inside of the 'and' except for  
the query\_string portion and the search worked. So I'm not sure where  
the error is. I'm still trying to track it down. But let me know if  
you see anything sticking out.

On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:

> I recently upgraded to .13 and now I think I'm seeing an issue with  
> query\_string with multiple fields.
> 
> If I use this query like:  
> {  
> "query":{  
> "query\_string":{  
> "fields":[  
> "somedata.1234.field1"  
> ],  
> "query":"myquery"  
> }  
> }
> 
> }
> 
> I get results and no error, but this query:
> 
> {  
> "query":{  
> "query\_string":{  
> "fields":[  
> "somedata.1234.field1",  
> "somedata.1234.field2"  
> ],  
> "query":"myquery"  
> }  
> }
> 
> }
> 
> gives me this error (sorry it comes back to me without much  
> formatting):
> 
> SearchPhaseExecutionException[Failed to execute phase [query], total  
> failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> QueryPhaseExecutionException[[nodedata][0]:  
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> org.elasticsearch.index.field.data.strings.StringFieldDataType  
> $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> nested: }  
> ...[cutting out several more lines of essentially repeated data in the  
> error]...
> 
> Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![Evan\_Stenmark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evan_stenmark/32/3289_2.png) [@Evan\_Stenmark](https://discuss.elastic.co/u/Evan_Stenmark)\
**Post date:** [December 28, 2010, 11:02pm UTC](https://discuss.elastic.co/t/query-string-error/3704/3 "2010-12-28T23:02:01Z")

</div>

From the elasticsearch.log:

[2010-12-28 16:54:02,338][DEBUG][action.search.type] [Llan the  
Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
s[STARTED]: Failed to execute  
[org.elasticsearch.action.search.SearchRequest@a4cc1d]  
org.elasticsearch.search.query.QueryPhaseExecutionException:  
[node226233][0]:  
query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@47a2308f^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
org.elasticsearch.index.field.data.strings.StringFieldDataType  
$1@26d5587e\>]: Query Failed [Failed to execute main query]  
at  
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
173)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
131)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
76)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:619)  
Caused by: java.lang.NullPointerException

Even if I take out the 'sort' part:

[2010-12-28 17:01:01,321][DEBUG][action.search.type] [Llan the  
Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
s[STARTED]: Failed to execute  
[org.elasticsearch.action.search.SearchRequest@49033a5]  
org.elasticsearch.search.query.QueryPhaseExecutionException:  
[node226233][0]:  
query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@efdb83f7^1.2],from[0],size[50]:  
Query Failed [Failed to execute main query]  
at  
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
173)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
131)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
76)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:619)  
Caused by: java.lang.NullPointerException

On Dec 28, 4:40 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:

> Upon further inspection, that's not the root issue.
> 
> The full search looks like this (I've renamed fields/data):
> 
> {  
> "from":0,  
> "size":"50",  
> "sort":{"extrasorts.sort\_name":"asc"},  
> "fields":["\_id"],  
> "query":{  
> "constant\_score":{  
> "filter":{  
> "and":[  
> {  
> "term":{  
> "node":1  
> }  
> },  
> {  
> "term":{  
> "is\_searchable":1  
> }  
> },  
> {  
> "range":{  
> "somedata.5555.someDateField":{  
> "from":"2010-12-28T16:12:11-06:00"  
> }  
> }  
> },  
> {  
> "term":{  
> "somedata.1111.somefield":1  
> }  
> },  
> {  
> "query":{  
> "query\_string":{  
> "fields":[  
> "somedata.1234.field1",  
> "somedata.1234.field2"  
> ],  
> "query":"myquery"  
> }  
> }  
> },  
> {  
> "terms":{  
> "tier":[  
> "1",  
> "2"  
> ]  
> }  
> }  
> ]  
> },  
> "boost":1.2  
> }  
> }
> 
> }
> 
> I tried pulling out all of the filters inside of the 'and' except for  
> the query\_string portion and the search worked. So I'm not sure where  
> the error is. I'm still trying to track it down. But let me know if  
> you see anything sticking out.
> 
> On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > I recently upgraded to .13 and now I think I'm seeing an issue with  
> > query\_string with multiple fields.
> 
> > If I use this query like:  
> > {  
> > "query":{  
> > "query\_string":{  
> > "fields":[  
> > "somedata.1234.field1"  
> > ],  
> > "query":"myquery"  
> > }  
> > }
> 
> > }
> 
> > I get results and no error, but this query:
> 
> > {  
> > "query":{  
> > "query\_string":{  
> > "fields":[  
> > "somedata.1234.field1",  
> > "somedata.1234.field2"  
> > ],  
> > "query":"myquery"  
> > }  
> > }
> 
> > }
> 
> > gives me this error (sorry it comes back to me without much  
> > formatting):
> 
> > SearchPhaseExecutionException[Failed to execute phase [query], total  
> > failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> > QueryPhaseExecutionException[[nodedata][0]:  
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> > nested: }  
> > ...[cutting out several more lines of essentially repeated data in the  
> > error]...
> 
> > Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 28, 2010, 11:12pm UTC](https://discuss.elastic.co/t/query-string-error/3704/4 "2010-12-28T23:12:54Z")

</div>

Can you recreate it with curl? A simple script that creates the index,  
initializes it with some data (you can probably do with 2-3 docs), and then  
executes the curl request with the search request that causes the error?

As a side note, when it comes to performance, you should execute use a  
filtered query, with the query\_string as the query, and the rest of the  
filters in an and filter.

-shay.banon

On Wed, Dec 29, 2010 at 1:02 AM, Evan Stenmark [stenmark@gmail.com](mailto:stenmark@gmail.com) wrote:

> From the elasticsearch.log:
> 
> [2010-12-28 16:54:02,338][DEBUG][action.search.type] [Llan the  
> Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@a4cc1d]  
> org.elasticsearch.search.query.QueryPhaseExecutionException:  
> [node226233][0]:
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@47a2308f  
> ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> org.elasticsearch.index.field.data.strings.StringFieldDataType  
> $1@26d5587e\>]: Query Failed [Failed to execute main query]  
> at  
> org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> at
> 
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
> 173)  
> at
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> 131)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> 76)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:619)  
> Caused by: java.lang.NullPointerException
> 
> Even if I take out the 'sort' part:
> 
> [2010-12-28 17:01:01,321][DEBUG][action.search.type] [Llan the  
> Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@49033a5]  
> org.elasticsearch.search.query.QueryPhaseExecutionException:  
> [node226233][0]:
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@efdb83f7  
> ^1.2],from[0],size[50]:  
> Query Failed [Failed to execute main query]  
> at  
> org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> at
> 
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
> 173)  
> at
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> 131)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> 76)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:619)  
> Caused by: java.lang.NullPointerException
> 
> On Dec 28, 4:40 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > Upon further inspection, that's not the root issue.
> > 
> > The full search looks like this (I've renamed fields/data):
> > 
> > {  
> > "from":0,  
> > "size":"50",  
> > "sort":{"extrasorts.sort\_name":"asc"},  
> > "fields":["\_id"],  
> > "query":{  
> > "constant\_score":{  
> > "filter":{  
> > "and":[  
> > {  
> > "term":{  
> > "node":1  
> > }  
> > },  
> > {  
> > "term":{  
> > "is\_searchable":1  
> > }  
> > },  
> > {  
> > "range":{
> 
> "somedata.5555.someDateField":{
> 
> > 
> 
> "from":"2010-12-28T16:12:11-06:00"
> 
> > ```
> > }
> > }
> > },
> > {
> > "term":{
> > 
> > ```
> 
> "somedata.1111.somefield":1
> 
> > ```
> > }
> > },
> > {
> > "query":{
> > "query_string":{
> > 
> > ```
> 
> "fields":[
> 
> > 
> 
> "somedata.1234.field1",
> 
> > 
> 
> "somedata.1234.field2"
> 
> > ```
> > ],
> > 
> > ```
> 
> "query":"myquery"
> 
> > ```
> > }
> > }
> > },
> > {
> > "terms":{
> > "tier":[
> > "1",
> > "2"
> > ]
> > }
> > }
> > ]
> > },
> > "boost":1.2
> > }
> > }
> > 
> > ```
> > 
> > }
> > 
> > I tried pulling out all of the filters inside of the 'and' except for  
> > the query\_string portion and the search worked. So I'm not sure where  
> > the error is. I'm still trying to track it down. But let me know if  
> > you see anything sticking out.
> > 
> > On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> > 
> > > I recently upgraded to .13 and now I think I'm seeing an issue with  
> > > query\_string with multiple fields.
> > 
> > > If I use this query like:  
> > > {  
> > > "query":{  
> > > "query\_string":{  
> > > "fields":[  
> > > "somedata.1234.field1"  
> > > ],  
> > > "query":"myquery"  
> > > }  
> > > }
> > 
> > > }
> > 
> > > I get results and no error, but this query:
> > 
> > > {  
> > > "query":{  
> > > "query\_string":{  
> > > "fields":[  
> > > "somedata.1234.field1",  
> > > "somedata.1234.field2"  
> > > ],  
> > > "query":"myquery"  
> > > }  
> > > }
> > 
> > > }
> > 
> > > gives me this error (sorry it comes back to me without much  
> > > formatting):
> > 
> > > SearchPhaseExecutionException[Failed to execute phase [query], total  
> > > failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> > > QueryPhaseExecutionException[[nodedata][0]:
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e  
> ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":
> 
> > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> > > nested: }  
> > > ...[cutting out several more lines of essentially repeated data in the  
> > > error]...
> > 
> > > Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![Evan\_Stenmark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evan_stenmark/32/3289_2.png) [@Evan\_Stenmark](https://discuss.elastic.co/u/Evan_Stenmark)\
**Post date:** [December 29, 2010, 4:37pm UTC](https://discuss.elastic.co/t/query-string-error/3704/5 "2010-12-29T16:37:06Z")

</div>

I changed it to be  
query  
filtered  
query  
query\_string  
...  
filter  
and  
...

Upon doing that, I'm not getting anymore errors. I assume that's the  
format you suggested for better performance.

Thanks for the help!

On Dec 28, 5:12 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Can you recreate it with curl? A simple script that creates the index,  
> initializes it with some data (you can probably do with 2-3 docs), and then  
> executes the curl request with the search request that causes the error?
> 
> As a side note, when it comes to performance, you should execute use a  
> filtered query, with the query\_string as the query, and the rest of the  
> filters in an and filter.
> 
> -shay.banon
> 
> On Wed, Dec 29, 2010 at 1:02 AM, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > From the elasticsearch.log:
> 
> > [2010-12-28 16:54:02,338][DEBUG][action.search.type] [Llan the  
> > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > s[STARTED]: Failed to execute  
> > [org.elasticsearch.action.search.SearchRequest@a4cc1d]  
> > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > [node226233][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@47a2308f  
> > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > $1@26d5587e\>]: Query Failed [Failed to execute main query]  
> > at  
> > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > at
> 
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
> > 173)  
> > at
> 
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> > 131)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> > 76)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:619)  
> > Caused by: java.lang.NullPointerException
> 
> > Even if I take out the 'sort' part:
> 
> > [2010-12-28 17:01:01,321][DEBUG][action.search.type] [Llan the  
> > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > s[STARTED]: Failed to execute  
> > [org.elasticsearch.action.search.SearchRequest@49033a5]  
> > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > [node226233][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@efdb83f7  
> > ^1.2],from[0],size[50]:  
> > Query Failed [Failed to execute main query]  
> > at  
> > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > at
> 
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
> > 173)  
> > at
> 
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> > 131)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> > 76)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:619)  
> > Caused by: java.lang.NullPointerException
> 
> > On Dec 28, 4:40 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> > 
> > > Upon further inspection, that's not the root issue.
> 
> > > The full search looks like this (I've renamed fields/data):
> 
> > > {  
> > > "from":0,  
> > > "size":"50",  
> > > "sort":{"extrasorts.sort\_name":"asc"},  
> > > "fields":["\_id"],  
> > > "query":{  
> > > "constant\_score":{  
> > > "filter":{  
> > > "and":[  
> > > {  
> > > "term":{  
> > > "node":1  
> > > }  
> > > },  
> > > {  
> > > "term":{  
> > > "is\_searchable":1  
> > > }  
> > > },  
> > > {  
> > > "range":{
> 
> > "somedata.5555.someDateField":{
> 
> > "from":"2010-12-28T16:12:11-06:00"
> > 
> > > ```
> > > }
> > > }
> > > },
> > > {
> > > "term":{
> > > 
> > > ```
> 
> > "somedata.1111.somefield":1
> > 
> > > ```
> > > }
> > > },
> > > {
> > > "query":{
> > > "query_string":{
> > > 
> > > ```
> 
> > "fields":[
> 
> > "somedata.1234.field1",
> 
> > "somedata.1234.field2"
> > 
> > > ```
> > > ],
> > > 
> > > ```
> 
> > "query":"myquery"
> > 
> > > ```
> > > }
> > > }
> > > },
> > > {
> > > "terms":{
> > > "tier":[
> > > "1",
> > > "2"
> > > ]
> > > }
> > > }
> > > ]
> > > },
> > > "boost":1.2
> > > }
> > > }
> > > 
> > > ```
> 
> > > }
> 
> > > I tried pulling out all of the filters inside of the 'and' except for  
> > > the query\_string portion and the search worked. So I'm not sure where  
> > > the error is. I'm still trying to track it down. But let me know if  
> > > you see anything sticking out.
> 
> > > On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > > > I recently upgraded to .13 and now I think I'm seeing an issue with  
> > > > query\_string with multiple fields.
> 
> > > > If I use this query like:  
> > > > {  
> > > > "query":{  
> > > > "query\_string":{  
> > > > "fields":[  
> > > > "somedata.1234.field1"  
> > > > ],  
> > > > "query":"myquery"  
> > > > }  
> > > > }
> 
> > > > }
> 
> > > > I get results and no error, but this query:
> 
> > > > {  
> > > > "query":{  
> > > > "query\_string":{  
> > > > "fields":[  
> > > > "somedata.1234.field1",  
> > > > "somedata.1234.field2"  
> > > > ],  
> > > > "query":"myquery"  
> > > > }  
> > > > }
> 
> > > > }
> 
> > > > gives me this error (sorry it comes back to me without much  
> > > > formatting):
> 
> > > > SearchPhaseExecutionException[Failed to execute phase [query], total  
> > > > failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> > > > QueryPhaseExecutionException[[nodedata][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e  
> > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":
> > 
> > > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > > $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> > > > nested: }  
> > > > ...[cutting out several more lines of essentially repeated data in the  
> > > > error]...
> 
> > > > Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 29, 2010, 4:57pm UTC](https://discuss.elastic.co/t/query-string-error/3704/6 "2010-12-29T16:57:10Z")

</div>

Great that it works, I would still like to check why the previous one did  
not work (or at the very least, improve the cryptic error message). Is there  
still a chance for a curl recreation?

On Wed, Dec 29, 2010 at 6:37 PM, Evan Stenmark [stenmark@gmail.com](mailto:stenmark@gmail.com) wrote:

> I changed it to be  
> query  
> filtered  
> query  
> query\_string  
> ...  
> filter  
> and  
> ...
> 
> Upon doing that, I'm not getting anymore errors. I assume that's the  
> format you suggested for better performance.
> 
> Thanks for the help!
> 
> On Dec 28, 5:12 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Can you recreate it with curl? A simple script that creates the index,  
> > initializes it with some data (you can probably do with 2-3 docs), and  
> > then  
> > executes the curl request with the search request that causes the error?
> > 
> > As a side note, when it comes to performance, you should execute use a  
> > filtered query, with the query\_string as the query, and the rest of the  
> > filters in an and filter.
> > 
> > -shay.banon
> > 
> > On Wed, Dec 29, 2010 at 1:02 AM, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com)  
> > wrote:
> > 
> > > From the elasticsearch.log:
> > 
> > > [2010-12-28 16:54:02,338][DEBUG][action.search.type] [Llan the  
> > > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > > s[STARTED]: Failed to execute  
> > > [org.elasticsearch.action.search.SearchRequest@a4cc1d]  
> > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > [node226233][0]:
> > 
> > >
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@47a2308f
> 
> > > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > $1@26d5587e\>]: Query Failed [Failed to execute main query]  
> > > at  
> > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > > at
> > 
> > >
> 
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:
> 
> > > 1. at
> > 
> > >
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:
> 
> > > 1. at
> 
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > >
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:
> 
> > > 1. at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > > at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > > at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:619)  
> > > Caused by: java.lang.NullPointerException
> > 
> > > Even if I take out the 'sort' part:
> > 
> > > [2010-12-28 17:01:01,321][DEBUG][action.search.type] [Llan the  
> > > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > > s[STARTED]: Failed to execute  
> > > [org.elasticsearch.action.search.SearchRequest@49033a5]  
> > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > [node226233][0]:
> > 
> > >
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@efdb83f7
> 
> > > ^1.2],from[0],size[50]:  
> > > Query Failed [Failed to execute main query]  
> > > at  
> > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > > at
> > 
> > >
> 
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:
> 
> > > 1. at
> > 
> > >
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:
> 
> > > 1. at
> 
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > >
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:
> 
> > > 1. at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > > at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > > at  
> > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:619)  
> > > Caused by: java.lang.NullPointerException
> > 
> > > On Dec 28, 4:40 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> > > 
> > > > Upon further inspection, that's not the root issue.
> > 
> > > > The full search looks like this (I've renamed fields/data):
> > 
> > > > {  
> > > > "from":0,  
> > > > "size":"50",  
> > > > "sort":{"extrasorts.sort\_name":"asc"},  
> > > > "fields":["\_id"],  
> > > > "query":{  
> > > > "constant\_score":{  
> > > > "filter":{  
> > > > "and":[  
> > > > {  
> > > > "term":{  
> > > > "node":1  
> > > > }  
> > > > },  
> > > > {  
> > > > "term":{
> 
> "is\_searchable":1
> 
> > > > ```
> > > > }
> > > > },
> > > > {
> > > > "range":{
> > > > 
> > > > ```
> > 
> > > "somedata.5555.someDateField":{
> > 
> > > "from":"2010-12-28T16:12:11-06:00"
> > > 
> > > > ```
> > > > }
> > > > }
> > > > },
> > > > {
> > > > "term":{
> > > > 
> > > > ```
> > 
> > > "somedata.1111.somefield":1
> > > 
> > > > ```
> > > > }
> > > > },
> > > > {
> > > > "query":{
> > > > 
> > > > ```
> 
> "query\_string":{
> 
> > > "fields":[
> > 
> > > "somedata.1234.field1",
> > 
> > > "somedata.1234.field2"
> > > 
> > > > ```
> > > > ],
> > > > 
> > > > ```
> > 
> > > "query":"myquery"
> > > 
> > > > ```
> > > > }
> > > > }
> > > > },
> > > > {
> > > > "terms":{
> > > > "tier":[
> > > > "1",
> > > > "2"
> > > > ]
> > > > }
> > > > }
> > > > ]
> > > > },
> > > > "boost":1.2
> > > > }
> > > > }
> > > > 
> > > > ```
> > 
> > > > }
> > 
> > > > I tried pulling out all of the filters inside of the 'and' except for  
> > > > the query\_string portion and the search worked. So I'm not sure  
> > > > where  
> > > > the error is. I'm still trying to track it down. But let me know if  
> > > > you see anything sticking out.
> > 
> > > > On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> > 
> > > > > I recently upgraded to .13 and now I think I'm seeing an issue with  
> > > > > query\_string with multiple fields.
> > 
> > > > > If I use this query like:  
> > > > > {  
> > > > > "query":{  
> > > > > "query\_string":{  
> > > > > "fields":[  
> > > > > "somedata.1234.field1"  
> > > > > ],  
> > > > > "query":"myquery"  
> > > > > }  
> > > > > }
> > 
> > > > > }
> > 
> > > > > I get results and no error, but this query:
> > 
> > > > > {  
> > > > > "query":{  
> > > > > "query\_string":{  
> > > > > "fields":[  
> > > > > "somedata.1234.field1",  
> > > > > "somedata.1234.field2"  
> > > > > ],  
> > > > > "query":"myquery"  
> > > > > }  
> > > > > }
> > 
> > > > > }
> > 
> > > > > gives me this error (sorry it comes back to me without much  
> > > > > formatting):
> > 
> > > > > SearchPhaseExecutionException[Failed to execute phase [query],  
> > > > > total  
> > > > > failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> > > > > QueryPhaseExecutionException[[nodedata][0]:
> > 
> > >
> 
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e
> 
> > > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":
> > > 
> > > > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > > > $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> > > > > nested: }  
> > > > > ...[cutting out several more lines of essentially repeated data in  
> > > > > the  
> > > > > error]...
> > 
> > > > > Was there something changed in query\_string that I'm missing?

---

<div class="post-metadata">

**Author:** ![Evan\_Stenmark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/evan_stenmark/32/3289_2.png) [@Evan\_Stenmark](https://discuss.elastic.co/u/Evan_Stenmark)\
**Post date:** [December 30, 2010, 4:16am UTC](https://discuss.elastic.co/t/query-string-error/3704/7 "2010-12-30T04:16:21Z")

</div>

I'm going to try and get something together.

On Dec 29, 10:57 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Great that it works, I would still like to check why the previous one did  
> not work (or at the very least, improve the cryptic error message). Is there  
> still a chance for a curl recreation?
> 
> On Wed, Dec 29, 2010 at 6:37 PM, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > I changed it to be  
> > query  
> > filtered  
> > query  
> > query\_string  
> > ...  
> > filter  
> > and  
> > ...
> 
> > Upon doing that, I'm not getting anymore errors. I assume that's the  
> > format you suggested for better performance.
> 
> > Thanks for the help!
> 
> > On Dec 28, 5:12 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Can you recreate it with curl? A simple script that creates the index,  
> > > initializes it with some data (you can probably do with 2-3 docs), and  
> > > then  
> > > executes the curl request with the search request that causes the error?
> 
> > > As a side note, when it comes to performance, you should execute use a  
> > > filtered query, with the query\_string as the query, and the rest of the  
> > > filters in an and filter.
> 
> > > -shay.banon
> 
> > > On Wed, Dec 29, 2010 at 1:02 AM, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com)  
> > > wrote:
> > > 
> > > > From the elasticsearch.log:
> 
> > > > [2010-12-28 16:54:02,338][DEBUG][action.search.type] [Llan the  
> > > > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > > > s[STARTED]: Failed to execute  
> > > > [org.elasticsearch.action.search.SearchRequest@a4cc1d]  
> > > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > > [node226233][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@47a2308f
> > 
> > > > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":  
> > > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > > $1@26d5587e\>]: Query Failed [Failed to execute main query]  
> > > > at  
> > > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > > > at
> 
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:
> > 
> > > > 1. at
> 
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:
> > 
> > > > 1. at
> 
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:
> > 
> > > > 1. at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > > > at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > > > at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > $Worker.run(ThreadPoolExecutor.java:908)  
> > > > at java.lang.Thread.run(Thread.java:619)  
> > > > Caused by: java.lang.NullPointerException
> 
> > > > Even if I take out the 'sort' part:
> 
> > > > [2010-12-28 17:01:01,321][DEBUG][action.search.type] [Llan the  
> > > > Sorcerer] [node226233][0], node[ev3EtX0OQd2vJFNtTj-\_Rw], [P],  
> > > > s[STARTED]: Failed to execute  
> > > > [org.elasticsearch.action.search.SearchRequest@49033a5]  
> > > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > > [node226233][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@efdb83f7
> > 
> > > > ^1.2],from[0],size[50]:  
> > > > Query Failed [Failed to execute main query]  
> > > > at  
> > > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114)  
> > > > at
> 
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:
> > 
> > > > 1. at
> 
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:
> > 
> > > > 1. at
> 
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> > $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:
> > 
> > > > 1. at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> > > > at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> > > > at  
> > > > org.elasticsearch.action.search.type.TransportSearchTypeAction  
> > > > $BaseAsyncAction$1.run(TransportSearchTypeAction.java:150)  
> > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > $Worker.run(ThreadPoolExecutor.java:908)  
> > > > at java.lang.Thread.run(Thread.java:619)  
> > > > Caused by: java.lang.NullPointerException
> 
> > > > On Dec 28, 4:40 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> > > > 
> > > > > Upon further inspection, that's not the root issue.
> 
> > > > > The full search looks like this (I've renamed fields/data):
> 
> > > > > {  
> > > > > "from":0,  
> > > > > "size":"50",  
> > > > > "sort":{"extrasorts.sort\_name":"asc"},  
> > > > > "fields":["\_id"],  
> > > > > "query":{  
> > > > > "constant\_score":{  
> > > > > "filter":{  
> > > > > "and":[  
> > > > > {  
> > > > > "term":{  
> > > > > "node":1  
> > > > > }  
> > > > > },  
> > > > > {  
> > > > > "term":{
> 
> > "is\_searchable":1
> > 
> > > > > ```
> > > > > }
> > > > > },
> > > > > {
> > > > > "range":{
> > > > > 
> > > > > ```
> 
> > > > "somedata.5555.someDateField":{
> 
> > > > "from":"2010-12-28T16:12:11-06:00"
> > > > 
> > > > > ```
> > > > > }
> > > > > }
> > > > > },
> > > > > {
> > > > > "term":{
> > > > > 
> > > > > ```
> 
> > > > "somedata.1111.somefield":1
> > > > 
> > > > > ```
> > > > > }
> > > > > },
> > > > > {
> > > > > "query":{
> > > > > 
> > > > > ```
> 
> > "query\_string":{
> 
> > > > "fields":[
> 
> > > > "somedata.1234.field1",
> 
> > > > "somedata.1234.field2"
> > > > 
> > > > > ```
> > > > > ],
> > > > > 
> > > > > ```
> 
> > > > "query":"myquery"
> > > > 
> > > > > ```
> > > > > }
> > > > > }
> > > > > },
> > > > > {
> > > > > "terms":{
> > > > > "tier":[
> > > > > "1",
> > > > > "2"
> > > > > ]
> > > > > }
> > > > > }
> > > > > ]
> > > > > },
> > > > > "boost":1.2
> > > > > }
> > > > > }
> > > > > 
> > > > > ```
> 
> > > > > }
> 
> > > > > I tried pulling out all of the filters inside of the 'and' except for  
> > > > > the query\_string portion and the search worked. So I'm not sure  
> > > > > where  
> > > > > the error is. I'm still trying to track it down. But let me know if  
> > > > > you see anything sticking out.
> 
> > > > > On Dec 28, 4:34 pm, Evan Stenmark [stenm...@gmail.com](mailto:stenm...@gmail.com) wrote:
> 
> > > > > > I recently upgraded to .13 and now I think I'm seeing an issue with  
> > > > > > query\_string with multiple fields.
> 
> > > > > > If I use this query like:  
> > > > > > {  
> > > > > > "query":{  
> > > > > > "query\_string":{  
> > > > > > "fields":[  
> > > > > > "somedata.1234.field1"  
> > > > > > ],  
> > > > > > "query":"myquery"  
> > > > > > }  
> > > > > > }
> 
> > > > > > }
> 
> > > > > > I get results and no error, but this query:
> 
> > > > > > {  
> > > > > > "query":{  
> > > > > > "query\_string":{  
> > > > > > "fields":[  
> > > > > > "somedata.1234.field1",  
> > > > > > "somedata.1234.field2"  
> > > > > > ],  
> > > > > > "query":"myquery"  
> > > > > > }  
> > > > > > }
> 
> > > > > > }
> 
> > > > > > gives me this error (sorry it comes back to me without much  
> > > > > > formatting):
> 
> > > > > > SearchPhaseExecutionException[Failed to execute phase [query],  
> > > > > > total  
> > > > > > failure; shardFailures {[ev3EtX0OQd2vJFNtTj-\_Rw][nodedata][0]:  
> > > > > > QueryPhaseExecutionException[[nodedata][0]:
> 
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@744f214e
> > 
> > > > ^1.2],from[0],size[50],sort[\<custom:"extrasorts.sort\_name":
> > > > 
> > > > > > org.elasticsearch.index.field.data.strings.StringFieldDataType  
> > > > > > $1@58e090c8\>]: Query Failed [Failed to execute main query]];  
> > > > > > nested: }  
> > > > > > ...[cutting out several more lines of essentially repeated data in  
> > > > > > the  
> > > > > > error]...
> 
> ...
> 
> read more »

---

<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, 4:14am UTC](https://discuss.elastic.co/t/query-string-error/3704/8 "2017-07-06T04:14:40Z")

</div>


