# Receiving 'ReduceSearchPhaseException' -- kills the search

**URL:** https://discuss.elastic.co/t/receiving-reducesearchphaseexception-kills-the-search/6227
**Category:** Elasticsearch
**Created:** [December 22, 2011, 11:43pm UTC](https://discuss.elastic.co/t/receiving-reducesearchphaseexception-kills-the-search/6227 "2011-12-22T23:43:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Bryan\_Green](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_green/32/3028_2.png) [@Bryan\_Green](https://discuss.elastic.co/u/Bryan_Green)
#### Post date: [December 22, 2011, 11:43pm UTC](https://discuss.elastic.co/t/receiving-reducesearchphaseexception-kills-the-search/6227/1 "2011-12-22T23:43:16Z")

</div>

Hiya,

I get this message when searching across indexes where the item type  
does not exist at all. If I run my query below just on the index where  
this object does for sure exist then I do not get this error.

The issue might be also that I would like elasticsearch to silently  
fail when the facet cannot be cast on an object.

I notice that even if data exists on one of the three indexes, the  
search still fails.

I am open to further discussion.

Thanks and have a warm winter,  
Bryan Green

Specifically, it is the long UPCID field that is causing this issue.

[22-Dec-2011 17:33:41] Elasticsearch error:  
ReduceSearchPhaseException[Failed to execute phase [fetch],  
[reduce] ]; nested:  
ClassCastException[org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet  
cannot be cast to  
org.elasticsearch.search.facet.terms.longs.InternalLongTermsFacet];  
url:system,library,kk/borrowed\_item/\_search curl\_results:  
{"error":"ReduceSearchPhaseException[Failed to execute phase [fetch],  
[reduce] ]; nested:  
ClassCastException[org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet  
cannot be cast to  
org.elasticsearch.search.facet.terms.longs.InternalLongTermsFacet];  
","status":500}

{  
"from": 0,  
"size": 0,  
"facets": {  
"collection": {  
"terms": {  
"field": "collection",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"\_type": {  
"terms": {  
"field": "\_type",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"statustype": {  
"terms": {  
"field": "instances.statustype",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"region": {  
"terms": {  
"field": "region",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"subject": {  
"terms": {  
"field": "subject",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"user\_id": {  
"terms": {  
"field": "user\_id",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"upcid": {  
"terms": {  
"field": "upcid",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"title": {  
"terms": {  
"field": "title",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"duration": {  
"terms": {  
"field": "duration",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"check\_out\_date": {  
"terms": {  
"field": "check\_out\_date",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"renew\_date": {  
"terms": {  
"field": "renew\_date",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"due\_date": {  
"terms": {  
"field": "due\_date",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
},  
"check\_in\_date": {  
"terms": {  
"field": "check\_in\_date",  
"size": "100",  
"order": "count"  
},  
"facet\_filter": []  
}  
}  
}

---

<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 22, 2011, 11:49pm UTC](https://discuss.elastic.co/t/receiving-reducesearchphaseexception-kills-the-search/6227/2 "2011-12-22T23:49:35Z")

</div>

When you facet on a field across index types, they need to be of the same  
field type (string, long). You can name the field differently.

On Fri, Dec 23, 2011 at 1:43 AM, Bryan Green [bryogreen@gmail.com](mailto:bryogreen@gmail.com) wrote:

> Hiya,
> 
> I get this message when searching across indexes where the item type  
> does not exist at all. If I run my query below just on the index where  
> this object does for sure exist then I do not get this error.
> 
> The issue might be also that I would like elasticsearch to silently  
> fail when the facet cannot be cast on an object.
> 
> I notice that even if data exists on one of the three indexes, the  
> search still fails.
> 
> I am open to further discussion.
> 
> Thanks and have a warm winter,  
> Bryan Green
> 
> Specifically, it is the long UPCID field that is causing this issue.
> 
> [22-Dec-2011 17:33:41] Elasticsearch error:  
> ReduceSearchPhaseException[Failed to execute phase [fetch],  
> [reduce] ]; nested:
> 
> ClassCastException[org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet  
> cannot be cast to  
> org.elasticsearch.search.facet.terms.longs.InternalLongTermsFacet];  
> url:system,library,kk/borrowed\_item/\_search curl\_results:  
> {"error":"ReduceSearchPhaseException[Failed to execute phase [fetch],  
> [reduce] ]; nested:
> 
> ClassCastException[org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet  
> cannot be cast to  
> org.elasticsearch.search.facet.terms.longs.InternalLongTermsFacet];  
> ","status":500}
> 
> {  
> "from": 0,  
> "size": 0,  
> "facets": {  
> "collection": {  
> "terms": {  
> "field": "collection",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "\_type": {  
> "terms": {  
> "field": "\_type",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "statustype": {  
> "terms": {  
> "field": "instances.statustype",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "region": {  
> "terms": {  
> "field": "region",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "subject": {  
> "terms": {  
> "field": "subject",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "user\_id": {  
> "terms": {  
> "field": "user\_id",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "upcid": {  
> "terms": {  
> "field": "upcid",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "title": {  
> "terms": {  
> "field": "title",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "duration": {  
> "terms": {  
> "field": "duration",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "check\_out\_date": {  
> "terms": {  
> "field": "check\_out\_date",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "renew\_date": {  
> "terms": {  
> "field": "renew\_date",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "due\_date": {  
> "terms": {  
> "field": "due\_date",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> },  
> "check\_in\_date": {  
> "terms": {  
> "field": "check\_in\_date",  
> "size": "100",  
> "order": "count"  
> },  
> "facet\_filter":   
> }  
> }  
> }

---

<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, 3:44am UTC](https://discuss.elastic.co/t/receiving-reducesearchphaseexception-kills-the-search/6227/3 "2017-07-06T03:44:29Z")

</div>


