Skip to content

Commit 9ceed7b

Browse files
committed
replace aggs with aggregations if found
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent 30b495e commit 9ceed7b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

public/utils/config_to_template_utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,9 @@ function updatePathForExpandedQuery(path: string): string {
691691
updatedPath = addSuffixToPath(updatedPath, 'match_phrase', 'query');
692692
updatedPath = addSuffixToPath(updatedPath, 'match_phrase_prefix', 'query');
693693

694-
// TODO handle aggs
694+
// "aggs" expands to "aggregations"
695+
updatedPath = updateAggsPath(updatedPath);
696+
695697
// TODO handle range query
696698
// TODO handle geo / xy queries
697699
// TODO handle "fields" when returning subset of fields in the source response
@@ -718,3 +720,7 @@ function addSuffixToPath(path: string, prefix: string, suffix: string): string {
718720
return `${prefix}${subStr}.${suffix}`;
719721
});
720722
}
723+
724+
function updateAggsPath(path: string): string {
725+
return path.replace(/\baggs\b/g, 'aggregations');
726+
}

0 commit comments

Comments
 (0)