also compute completion stats for 2.x shards

This commit is contained in:
Mike McCandless 2016-05-02 16:14:05 -04:00
parent 16c4c251f5
commit 0c6d6a5495
1 changed files with 4 additions and 0 deletions

View File

@ -680,6 +680,10 @@ public class IndexShard extends AbstractIndexShardComponent {
CompletionStats completionStats = new CompletionStats();
try (final Engine.Searcher currentSearcher = acquireSearcher("completion_stats")) {
completionStats.add(CompletionFieldStats.completionStats(currentSearcher.reader(), fields));
// Necessary for 2.x shards:
Completion090PostingsFormat postingsFormat = ((Completion090PostingsFormat)
PostingsFormat.forName(Completion090PostingsFormat.CODEC_NAME));
completionStats.add(postingsFormat.completionStats(currentSearcher.reader(), fields));
}
return completionStats;
}