Skip to content

Commit

Permalink
Tweak frequent_items agg settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Sep 29, 2022
1 parent 3f7b3b6 commit c1ff302
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function fetchFrequentItems(
logger: Logger,
emitError: (m: string) => void
) {
// get unique fields that are left
// get unique fields from change points
const fields = [...new Set(changePoints.map((t) => t.fieldName))];

// TODO add query params
Expand Down Expand Up @@ -94,6 +94,8 @@ export async function fetchFrequentItems(
sampleProbability = Math.min(0.5, minDocCount / totalDocCount);
}

logger.debug(`frequent_items sample probability: ${sampleProbability}`);

// frequent items can be slow, so sample and use 10% min_support
const aggs: Record<string, estypes.AggregationsAggregationContainer> = {
sample: {
Expand All @@ -106,7 +108,7 @@ export async function fetchFrequentItems(
frequent_items: {
minimum_set_size: 2,
size: 200,
minimum_support: 0.01,
minimum_support: 0.1,
fields: aggFields,
},
},
Expand Down

0 comments on commit c1ff302

Please sign in to comment.