use of org.opensearch.common.util.SetBackedScalingCuckooFilter in project OpenSearch by opensearch-project.
the class StringRareTermsTests method createTestInstance.
@Override
protected InternalRareTerms<?, ?> createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations, long maxDocCount) {
BucketOrder order = BucketOrder.count(false);
DocValueFormat format = DocValueFormat.RAW;
List<StringRareTerms.Bucket> buckets = new ArrayList<>();
final int numBuckets = randomNumberOfBuckets();
for (int i = 0; i < numBuckets; ++i) {
Set<BytesRef> terms = new HashSet<>();
BytesRef term = randomValueOtherThanMany(b -> terms.add(b) == false, () -> new BytesRef(randomAlphaOfLength(10)));
int docCount = randomIntBetween(1, 100);
buckets.add(new StringRareTerms.Bucket(term, docCount, aggregations, format));
}
SetBackedScalingCuckooFilter filter = new SetBackedScalingCuckooFilter(1000, Randomness.get(), 0.01);
return new StringRareTerms(name, order, metadata, format, buckets, maxDocCount, filter);
}
Aggregations