elasticsearch/elasticsearch — Issue #1732: Error when trying to get a facet from a Date field accross indices
Author: MagmaRules
Created: 2012-02-23 14:56:44+00:00
State: open

I have a template for my two indices that defines that all fields starting with "Dt" are dates.

When i try to get a facet for one of these fields and in one index i don't have values in this field i get the error:

Caused by: java.lang.ClassCastException: org.elasticsearch.search.facet.terms.longs.InternalLongTermsFacet cannot be cast to org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet
at org.elasticsearch.search.facet.terms.strings.InternalStringTermsFacet.reduce(InternalStringTermsFacet.java:200)
at org.elasticsearch.search.facet.terms.TermsFacetProcessor.reduce(TermsFacetProcessor.java:208)
at org.elasticsearch.search.controller.SearchPhaseController.merge(SearchPhaseController.java:298)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.innerFinishHim(TransportSearchQueryThenFetchAction.java:184)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.finishHim(TransportSearchQueryThenFetchAction.java:169)

It seems that when elasticsearch doesn't find values in index1 it assumes the default of string and I end up with string for index1 and long for index2.