Exception using TermsFacet

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception using TermsFacet

Pavel Penchev
Hi all,

I'm getting an exception trying to use a term facet and I can't figure out what's causing it. Can someone advise?
I'm using a 2 node setup, it contains ~8 million documents currently. Removing the TermsFacetBuilder makes the exception go away.

The mapping
-----------------------------------------------
{"myindex":
    { "properties": {
        "colour":{"type":"string"},
        "height":{"type":"integer"},
        "food":{"type":"string"},
        "name":{"type":"string"},
        "age":{"type":"integer"},
        "rating":{"type":"float"},
        }
    }
}


Java code I'm using to query
-----------------------------------------------
TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress("example.com", 9300));

SearchRequestBuilder requestBuilder = client.prepareSearch("myindex");
requestBuilder.setQuery(QueryBuilders.matchAllQuery());

HistogramFacetBuilder facetBuilder = FacetBuilders.histogramFacet("age").interval(10).field("age")
        .comparator(org.elasticsearch.search.facet.histogram.HistogramFacet.ComparatorType.KEY);
requestBuilder.addFacet(facetBuilder);

TermsFacetBuilder termBuilder = FacetBuilders.termsFacet("colour").size(20).field("colour")
        .order(org.elasticsearch.search.facet.terms.TermsFacet.ComparatorType.COUNT);
requestBuilder.addFacet(termBuilder);

SearchResponse response = requestBuilder
    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
    .setExplain(true)
    .execute()
    .actionGet();

System.out.println(response.getHits().getTotalHits());



The exception
-----------------------------------------------
Caused by: org.elasticsearch.transport.RemoteTransportException: [Caregiver][inet[/192.168.0.66:9300]][indices/search]
Caused by: org.elasticsearch.action.search.ReduceSearchPhaseException: Failed to execute phase [fetch], [reduce] ; shardFailures {[Q9jePZ8KQCu4_gM21D-aiQ][myindex][0]: QueryPhaseExecutionException[[myindex][0]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[Q9jePZ8KQCu4_gM21D-aiQ][myindex][1]: QueryPhaseExecutionException[[myindex][1]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[Q9jePZ8KQCu4_gM21D-aiQ][myindex][3]: QueryPhaseExecutionException[[myindex][3]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[hsrsr6LjQK-hud9mN1CPoQ][myindex][4]: RemoteTransportException[[Occulus][inet[/192.168.0.65:9300]][search/phase/query/id]]; nested: QueryPhaseExecutionException[[myindex][4]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: NumberFormatException[Invalid shift value in prefixCoded string (is encoded value really an INT?)]; }{[hsrsr6LjQK-hud9mN1CPoQ][myindex][2]: RemoteTransportException[[Occulus][inet[/192.168.0.65:9300]][search/phase/query/id]]; nested: QueryPhaseExecutionException[[myindex][2]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: NumberFormatException[Invalid shift value in prefixCoded string (is encoded value really an INT?)]; }
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.finishHim(TransportSearchDfsQueryThenFetchAction.java:252)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.innerExecuteFetchPhase(TransportSearchDfsQueryThenFetchAction.java:176)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.executeFetchPhase(TransportSearchDfsQueryThenFetchAction.java:164)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.access$600(TransportSearchDfsQueryThenFetchAction.java:63)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction$3.onFailure(TransportSearchDfsQueryThenFetchAction.java:156)
        at org.elasticsearch.search.action.SearchServiceTransportAction$3.handleException(SearchServiceTransportAction.java:181)
        at org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:156)
        at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:147)
        at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:99)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:302)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:214)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:274)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:261)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
        at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
        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.IndexOutOfBoundsException: index (0) must be less than size (0)
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:301)
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:280)
        at org.elasticsearch.common.collect.Iterables.get(Iterables.java:640)
        at org.elasticsearch.search.controller.SearchPhaseController.merge(SearchPhaseController.java:259)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.innerFinishHim(TransportSearchDfsQueryThenFetchAction.java:266)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.finishHim(TransportSearchDfsQueryThenFetchAction.java:250)
        ... 28 more


Thanks in advance,
Pavel

Reply | Threaded
Open this post in threaded view
|

Re: Exception using TermsFacet

kimchy
Administrator
Strange..., can you try and recreate it (easiest would be a curl recreation)...

On Thursday, June 23, 2011 at 6:35 PM, Pavel Penchev wrote:

Hi all,

I'm getting an exception trying to use a term facet and I can't figure out what's causing it. Can someone advise?
I'm using a 2 node setup, it contains ~8 million documents currently. Removing the TermsFacetBuilder makes the exception go away.

The mapping
-----------------------------------------------
{"myindex":
    { "properties": {
        "colour":{"type":"string"},
        "height":{"type":"integer"},
        "food":{"type":"string"},
        "name":{"type":"string"},
        "age":{"type":"integer"},
        "rating":{"type":"float"},
        }
    }
}


Java code I'm using to query
-----------------------------------------------
TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress("example.com", 9300));

SearchRequestBuilder requestBuilder = client.prepareSearch("myindex");
requestBuilder.setQuery(QueryBuilders.matchAllQuery());

HistogramFacetBuilder facetBuilder = FacetBuilders.histogramFacet("age").interval(10).field("age")
        .comparator(org.elasticsearch.search.facet.histogram.HistogramFacet.ComparatorType.KEY);
requestBuilder.addFacet(facetBuilder);

TermsFacetBuilder termBuilder = FacetBuilders.termsFacet("colour").size(20).field("colour")
        .order(org.elasticsearch.search.facet.terms.TermsFacet.ComparatorType.COUNT);
requestBuilder.addFacet(termBuilder);

SearchResponse response = requestBuilder
    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
    .setExplain(true)
    .execute()
    .actionGet();

System.out.println(response.getHits().getTotalHits());



The exception
-----------------------------------------------
Caused by: org.elasticsearch.transport.RemoteTransportException: [Caregiver][inet[/192.168.0.66:9300]][indices/search]
Caused by: org.elasticsearch.action.search.ReduceSearchPhaseException: Failed to execute phase [fetch], [reduce] ; shardFailures {[Q9jePZ8KQCu4_gM21D-aiQ][myindex][0]: QueryPhaseExecutionException[[myindex][0]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[Q9jePZ8KQCu4_gM21D-aiQ][myindex][1]: QueryPhaseExecutionException[[myindex][1]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[Q9jePZ8KQCu4_gM21D-aiQ][myindex][3]: QueryPhaseExecutionException[[myindex][3]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: ClassCastException[org.elasticsearch.index.field.data.strings.SingleValueStringFieldData cannot be cast to org.elasticsearch.index.field.data.NumericFieldData]; }{[hsrsr6LjQK-hud9mN1CPoQ][myindex][4]: RemoteTransportException[[Occulus][inet[/192.168.0.65:9300]][search/phase/query/id]]; nested: QueryPhaseExecutionException[[myindex][4]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: NumberFormatException[Invalid shift value in prefixCoded string (is encoded value really an INT?)]; }{[hsrsr6LjQK-hud9mN1CPoQ][myindex][2]: RemoteTransportException[[Occulus][inet[/192.168.0.65:9300]][search/phase/query/id]]; nested: QueryPhaseExecutionException[[myindex][2]: query[ConstantScore(*:*)],from[0],size[20]: Query Failed [Failed to execute main query]]; nested: NumberFormatException[Invalid shift value in prefixCoded string (is encoded value really an INT?)]; }
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.finishHim(TransportSearchDfsQueryThenFetchAction.java:252)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.innerExecuteFetchPhase(TransportSearchDfsQueryThenFetchAction.java:176)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.executeFetchPhase(TransportSearchDfsQueryThenFetchAction.java:164)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.access$600(TransportSearchDfsQueryThenFetchAction.java:63)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction$3.onFailure(TransportSearchDfsQueryThenFetchAction.java:156)
        at org.elasticsearch.search.action.SearchServiceTransportAction$3.handleException(SearchServiceTransportAction.java:181)
        at org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:156)
        at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:147)
        at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:99)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:302)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299)
        at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:214)
        at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:274)
        at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:261)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
        at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
        at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
        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.IndexOutOfBoundsException: index (0) must be less than size (0)
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:301)
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:280)
        at org.elasticsearch.common.collect.Iterables.get(Iterables.java:640)
        at org.elasticsearch.search.controller.SearchPhaseController.merge(SearchPhaseController.java:259)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.innerFinishHim(TransportSearchDfsQueryThenFetchAction.java:266)
        at org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.finishHim(TransportSearchDfsQueryThenFetchAction.java:250)
        ... 28 more


Thanks in advance,
Pavel