statisticalFacet does now work properly with dynamic mapping

Hi,

Not been able make statisticalFacet work with dynamic mapping.
Here is the scenario:

  1. Initially mapped 2 fields (f1 and f2) using template. Indexed values
    ("100", "200")
  2. Then mapped another 2 (f3 and f4) using template. Indexed values ("300",
    "400")
  3. When I execute statisticalFacet on f1 and f2 I get them correctly. But
    when I execute the same for f3 and f4 it throws an exception in the server
    and returns 0.0
    And the exception is --- Not sure why its a ClassCast Exception, especially
    it works for the fields that has been indexed initially but not with the
    ones indexed later.

Would appreciate your help/suggestion here.

[2011-10-24 16:41:59,749][DEBUG][action.search.type ] [Crusader]
[test-index-1][3], node[p_Rh8yZYThiqcJGRPGgebA], [P], s[STARTED]: Failed to
execute [org.elasticsearch.action.search.SearchRequest@45612e53]
org.elasticsearch.search.query.QueryPhaseExecutionException:
[test-index-1][3]: query[ConstantScore(:)],from[0],size[10]: Query Failed
[Failed to execute main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)
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)
Caused by: java.lang.ClassCastException:
org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot
be cast to org.elasticsearch.index.field.data.NumericFieldData
at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:72)
at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:71)
at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:64)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:523)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:391)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:298)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:286)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)
... 9 more

Thanks
Gautam

Got the issue. Don't bother.

Thanks

On Mon, Oct 24, 2011 at 10:17 PM, Gautam Shyamantak gautam@datarpm.comwrote:

Hi,

Not been able make statisticalFacet work with dynamic mapping.
Here is the scenario:

  1. Initially mapped 2 fields (f1 and f2) using template. Indexed values
    ("100", "200")
  2. Then mapped another 2 (f3 and f4) using template. Indexed values ("300",
    "400")
  3. When I execute statisticalFacet on f1 and f2 I get them correctly. But
    when I execute the same for f3 and f4 it throws an exception in the server
    and returns 0.0
    And the exception is --- Not sure why its a ClassCast Exception, especially
    it works for the fields that has been indexed initially but not with the
    ones indexed later.

Would appreciate your help/suggestion here.

[2011-10-24 16:41:59,749][DEBUG][action.search.type ] [Crusader]
[test-index-1][3], node[p_Rh8yZYThiqcJGRPGgebA], [P], s[STARTED]: Failed to
execute [org.elasticsearch.action.search.SearchRequest@45612e53]
org.elasticsearch.search.query.QueryPhaseExecutionException:
[test-index-1][3]: query[ConstantScore(:)],from[0],size[10]: Query Failed
[Failed to execute main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)
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)
Caused by: java.lang.ClassCastException:
org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot
be cast to org.elasticsearch.index.field.data.NumericFieldData
at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:72)
at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:71)
at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:64)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:523)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:391)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:298)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:286)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)
... 9 more

Thanks
Gautam

How did you fix this problem?
Thank you

On Monday, October 24, 2011 10:41:51 PM UTC+2, Gautam S wrote:

Got the issue. Don't bother.

Thanks

On Mon, Oct 24, 2011 at 10:17 PM, Gautam Shyamantak gautam@datarpm.comwrote:

Hi,

Not been able make statisticalFacet work with dynamic mapping.
Here is the scenario:

  1. Initially mapped 2 fields (f1 and f2) using template. Indexed values
    ("100", "200")
  2. Then mapped another 2 (f3 and f4) using template. Indexed values
    ("300", "400")
  3. When I execute statisticalFacet on f1 and f2 I get them correctly. But
    when I execute the same for f3 and f4 it throws an exception in the server
    and returns 0.0
    And the exception is --- Not sure why its a ClassCast Exception,
    especially it works for the fields that has been indexed initially but not
    with the ones indexed later.

Would appreciate your help/suggestion here.

[2011-10-24 16:41:59,749][DEBUG][action.search.type ] [Crusader]
[test-index-1][3], node[p_Rh8yZYThiqcJGRPGgebA], [P], s[STARTED]: Failed to
execute [org.elasticsearch.action.search.SearchRequest@45612e53]
org.elasticsearch.search.query.QueryPhaseExecutionException:
[test-index-1][3]: query[ConstantScore(:)],from[0],size[10]: Query Failed
[Failed to execute main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)
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)
Caused by: java.lang.ClassCastException:
org.elasticsearch.index.field.data.strings.SingleValueStringFieldData
cannot be cast to org.elasticsearch.index.field.data.NumericFieldData
at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:72)
at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:71)
at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:64)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:523)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:391)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:298)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:286)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)
... 9 more

Thanks
Gautam