# ReduceSearchPhaseException error

**URL:** <https://discuss.elastic.co/t/reducesearchphaseexception-error/3311>\
**Category:** Elasticsearch\
**Created:** [September 7, 2010, 10:48pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311 "2010-09-07T22:48:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)\
**Post date:** [September 7, 2010, 10:48pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/1 "2010-09-07T22:48:29Z")

</div>

I'm getting an exception when trying to run this query:

{  
"sort": [  
"\_score",  
{"created": {"reverse": true}}  
],  
"from": 0, "size": 10,  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "thisquerydoesnotexist",  
"fields": ["title", "notes", "tags"],  
"default\_operator": "AND",  
"use\_dis\_max": true  
}  
},  
"filter": {  
"geo\_bounding\_box": {  
"geo": {  
"top\_left" : {  
"lat" : 47.55,  
"lon" : -124.10  
},  
"bottom\_right" : {  
"lat" : 31.06,  
"lon" : -77  
}  
}  
}  
}  
}  
}  
}'

This only seems to happen when the query does not return any results..

Full backtrace:

[15:44:43,800][DEBUG][action.search.type] [Hellion] [photos]  
[0], node[f6c014fd-94cf-4e1e-9ecf-b1f17879603f], [P], s[STARTED]:  
Failed to execute  
[org.elasticsearch.action.search.SearchRequest@50fc1387] while moving  
to second phase  
java.lang.IllegalArgumentException: field can only be null when type  
is SCORE or DOC  
at org.apache.lucene.search.SortField.initFieldType(SortField.java:  
217)  
at org.apache.lucene.search.SortField.(SortField.java:127)  
at  
org.elasticsearch.search.controller.SearchPhaseController.sortDocs(SearchPhaseController.java:  
106)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.moveToSecondPhase(TransportSearchQueryThenFetchAction.java:  
85)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:  
218)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$100(TransportSearchTypeAction.java:80)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:196)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
130)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
77)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:194)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$000(TransportSearchTypeAction.java:80)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$1.run(TransportSearchTypeAction.java:153)  
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:637)

---

<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:** [September 8, 2010, 8:54am UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/2 "2010-09-08T08:54:03Z")

</div>

Can you open an issue with a curl recreation?

On Wed, Sep 8, 2010 at 1:48 AM, Andrei [andrei@zmievski.org](mailto:andrei@zmievski.org) wrote:

> I'm getting an exception when trying to run this query:
> 
> {  
> "sort": [  
> "\_score",  
> {"created": {"reverse": true}}  
> ],  
> "from": 0, "size": 10,  
> "query": {  
> "filtered": {  
> "query": {  
> "query\_string": {  
> "query": "thisquerydoesnotexist",  
> "fields": ["title", "notes", "tags"],  
> "default\_operator": "AND",  
> "use\_dis\_max": true  
> }  
> },  
> "filter": {  
> "geo\_bounding\_box": {  
> "geo": {  
> "top\_left" : {  
> "lat" : 47.55,  
> "lon" : -124.10  
> },  
> "bottom\_right" : {  
> "lat" : 31.06,  
> "lon" : -77  
> }  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> This only seems to happen when the query does not return any results..
> 
> Full backtrace:
> 
> [15:44:43,800][DEBUG][action.search.type] [Hellion] [photos]  
> [0], node[f6c014fd-94cf-4e1e-9ecf-b1f17879603f], [P], s[STARTED]:  
> Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@50fc1387] while moving  
> to second phase  
> java.lang.IllegalArgumentException: field can only be null when type  
> is SCORE or DOC  
> at org.apache.lucene.search.SortField.initFieldType(SortField.java:  
> 217)  
> at org.apache.lucene.search.SortField.(SortField.java:127)  
> at
> 
> org.elasticsearch.search.controller.SearchPhaseController.sortDocs(SearchPhaseController.java:  
> 106)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
> $AsyncAction.moveToSecondPhase(TransportSearchQueryThenFetchAction.java:  
> 85)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:  
> 218)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$100(TransportSearchTypeAction.java:80)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:196)  
> at
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> 130)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> 77)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:194)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$000(TransportSearchTypeAction.java:80)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$1.run(TransportSearchTypeAction.java:153)  
> 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:637)

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)\
**Post date:** [September 8, 2010, 6:05pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/3 "2010-09-08T18:05:49Z")

</div>

Do I need to a sample set of indexed documents or just the query (with  
curl)?

-Andrei

On Sep 8, 1:54 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Can you open an issue with a curl recreation?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [September 8, 2010, 6:11pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/4 "2010-09-08T18:11:47Z")

</div>

On Wed, 2010-09-08 at 11:05 -0700, Andrei wrote:

> Do I need to a sample set of indexed documents or just the query (with  
> curl)?

Give a sample doc. Enough to create a test case starting from a fresh  
install.

clint

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)\
**Post date:** [September 8, 2010, 9:58pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/5 "2010-09-08T21:58:49Z")

</div>

Done.

> <https://github.com/elastic/elasticsearch/issues/362>
>
> Using ES 0.10.
> 
> To reproduce:
> 
> \`\`\`
> curl -XPUT 'http://localhost:9200/bug/' -d'{ …index: { number\_of\_shards: 1, number\_of\_replicas: 0 } }'
> curl -XPUT 'http://localhost:9200/bug/test/\_mapping' -d ' {
> "test" : {
> "properties" : {
> "user" : {"type" : "string", "index" : "not\_analyzed"},
> "title" : {"type" : "string", "boost" : 2.0},
> "notes" : {"type" : "string"},
> "tags" : {"type" : "string", "index\_name" : "tag"},
> "created" : {"type" : "date", "format" : "YYYY-MM-DD HH:mm:ss"},
> "geo" : {"type" : "geo\_point"},
> "privacy" : {"type" : "integer"}
> }
> }
> }'
> 
> 
> curl -XPUT "http://localhost:9200/bug/test/1" -d'{"tags": \["geotagged", "w", "incendio", "puglia", "vacanze", "peschici", "estate2007", "leconseguenzedellincendio", "geo:lat=41942574", "geo:lon=16012316"\], "notes": "", "created": "2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci", "title": "incendio peschici", "geo": {"lat": 41.942574, "lon": 16.012315999999998}}'
> curl -XPUT "http://localhost:9200/bug/test/2" -d'{"tags": \["columbus", "georgia", "ranger", "banquet", "airborne", "fortbenning", "ftbenning", "75thrra"\], "notes": "", "created": "2007-08-21 18:22:20", "privacy": 1000, "user": "rangerpete", "title": "20070811-191543-1D3-PSP\_3298.JPG", "geo": {"lat": 32.461877999999999, "lon": -84.995496000000003}}'
> 
> curl -XPOST "http://localhost:9200/bug/test/\_search?pretty=true" -d'
> {
> "sort": \[
> "\_score",
> {"created": {"reverse": true}}
> \],
> "from": 0, "size": 10,
> "query": {
> "filtered": {
> "query": {
> "query\_string": {
> "query": "thisquerydoesnotexist",
> "fields": \["title", "notes", "tags"\],
> "default\_operator": "AND",
> "use\_dis\_max": true
> }
> },
> "filter": {
> "geo\_bounding\_box": {
> "geo": {
> "top\_left" : {
> "lat" : 47.55,
> "lon" : -124.10
> },
> "bottom\_right" : {
> "lat" : 31.06,
> "lon" : -77
> }
> }
> }
> }
> }
> }
> }'
> \`\`\`
> 
> Full backtrace:
> 
> \`\`\`
> \[10:49:53,546\]\[DEBUG\]\[action.search.type \] \[USAgent\] \[photos\]\[0\], node\[ed4fd2d5-fa99-41ba-b0c0-9c5d46b0472d\], \[P\], s\[STARTED\]: Failed to execute \[org.elasticsearch.action.search.SearchRequest@28acaa28\] while moving to second phase
> java.lang.IllegalArgumentException: field can only be null when type is SCORE or DOC
> at org.apache.lucene.search.SortField.initFieldType(SortField.java:217)
> at org.apache.lucene.search.SortField.\<init\>(SortField.java:127)
> at org.elasticsearch.search.controller.SearchPhaseController.sortDocs(SearchPhaseController.java:106)
> at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.moveToSecondPhase(TransportSearchQueryThenFetchAction.java:85)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:218)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$100(TransportSearchTypeAction.java:80)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:196)
> at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:130)
> at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:77)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:194)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:80)
> at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.run(TransportSearchTypeAction.java:153)
> 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:637)
> \`\`\`

-Andrei

On Sep 8, 11:11 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> On Wed, 2010-09-08 at 11:05 -0700, Andrei wrote:
> 
> > Do I need to a sample set of indexed documents or just the query (with  
> > curl)?
> 
> Give a sample doc. Enough to create a test case starting from a fresh  
> install.
> 
> clint

---

<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:** [September 9, 2010, 12:48pm UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/6 "2010-09-09T12:48:11Z")

</div>

just pushed a fix for this.

On Thu, Sep 9, 2010 at 12:58 AM, Andrei [andrei@zmievski.org](mailto:andrei@zmievski.org) wrote:

> Done.
> 
> [Search failure when no results are found and sorting by score · Issue #362 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/362)
> 
> -Andrei
> 
> On Sep 8, 11:11 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:
> 
> > On Wed, 2010-09-08 at 11:05 -0700, Andrei wrote:
> > 
> > > Do I need to a sample set of indexed documents or just the query (with  
> > > curl)?
> > 
> > Give a sample doc. Enough to create a test case starting from a fresh  
> > install.
> > 
> > clint

---

<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:19am UTC](https://discuss.elastic.co/t/reducesearchphaseexception-error/3311/7 "2017-07-06T04:19:33Z")

</div>


