@Override public CollectionStatistics collectionStatistics(String field) throws IOException { if (aggregatedDfs == null) { // we are either executing the dfs phase or the search_type doesn't include the dfs phase. return super.collectionStatistics(field); } CollectionStatistics collectionStatistics = aggregatedDfs.fieldStatistics().get(field); if (collectionStatistics == null) { // we don't have stats for this - this might be a must_not clauses etc. that doesn't allow // extract terms on the query return super.collectionStatistics(field); } return collectionStatistics; }
@Override public TermStatistics termStatistics(Term term, TermContext context) throws IOException { if (aggregatedDfs == null) { // we are either executing the dfs phase or the search_type doesn't include the dfs phase. return super.termStatistics(term, context); } TermStatistics termStatistics = aggregatedDfs.termStatistics().get(term); if (termStatistics == null) { // we don't have stats for this - this might be a must_not clauses etc. that doesn't allow // extract terms on the query return super.termStatistics(term, context); } return termStatistics; }