Distinct_date_histogram facet Java API issue


(Alex P-2) #1

Hey,

I am having a problem with the Lovely Systems plugin:

I have it compiled and installed, and it works fine when accessing it via
the REST API like so:
{
"query": {
"match_all" : {}
},
"facets" : {
"visits_histogram" : {
"distinct_date_histogram" : {
"field" : "timestamp",
"value_field" : "session_id",
"interval" : "day"
}
}
}
}

But if I try the same thing using the Java API:
elasticSearchService.client
.prepareSearch(indexes)
.setSearchType(SearchType.COUNT)
.setTypes('docHit')
.setQuery(QueryBuilders.matchAllQuery())
.setFacets([
visits_histogram: [
distinct_date_histogram: [
field: "timestamp",
value_field: "session_id",
interval: "day"
]
]
])

I get an error which I really can't figure out, also note that the above
code works fine for the regular date_histogram facet:

java.lang.NullPointerException
at
org.elasticsearch.search.facet.InternalFacets.readFrom(InternalFacets.java:143)
at
org.elasticsearch.search.facet.InternalFacets.readFacets(InternalFacets.java:129)
at
org.elasticsearch.search.internal.InternalSearchResponse.readFrom(InternalSearchResponse.java:88)
at
org.elasticsearch.search.internal.InternalSearchResponse.readInternalSearchResponse(InternalSearchResponse.java:80)
at
org.elasticsearch.action.search.SearchResponse.readFrom(SearchResponse.java:284)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readFrom(MultiSearchResponse.java:86)
at
org.elasticsearch.action.search.MultiSearchResponse$Item.readItem(MultiSearchResponse.java:78)
at
org.elasticsearch.action.search.MultiSearchResponse.readFrom(MultiSearchResponse.java:135)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:148)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:390)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:261)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
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:680)
Thanks!

Alex

--


(system) #2