Question regarding TermsFacet


(Barak Yaish) #1

Hello,

I'm trying to run facets against big index (45M docs) and have some
questions:

  1. Since the number of terms is unknown, I tried passing
    Integer.MAX_VALUE as a size
    ( addFacet( FacetBuilders.termsFacet( "facet1" ).field( "runId" ).size( size ).global( true ) )
  • this caused exception in server, is this expected?

org.elasticsearch.transport.RemoteTransportException: [Catiana][inet[/
10.80.0.23:9300]][search/phase/query]
Caused by: java.util.NoSuchElementException
at java.util.TreeMap.lastKey(TreeMap.java:1936)
at java.util.TreeSet.last(TreeSet.java:384)
at
org.elasticsearch.common.collect.BoundedTreeSet.rebound(BoundedTreeSet.java:
58)
at
org.elasticsearch.common.collect.BoundedTreeSet.add(BoundedTreeSet.java:
46)
at
org.elasticsearch.search.facet.terms.strings.TermsStringFacetCollector.facet(TermsStringFacetCollector.java:
137)
at
org.elasticsearch.search.facet.FacetPhase.execute(FacetPhase.java:88)
at
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:192)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:
173)
at org.elasticsearch.search.action.SearchServiceTransportAction
$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:
376)
at org.elasticsearch.search.action.SearchServiceTransportAction
$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:
367)
at org.elasticsearch.transport.netty.MessageChannelHandler
$3.run(MessageChannelHandler.java:195)
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)

  1. Following the above, how one should do facets queries against big
    index, I used to paginate queries with setFrom(), but it's not
    available for facets.

3.Is the data known ahead to ES (during the index build) or it re-
calculated every call?

Thanks!


(system) #2