Skip to content

Commit

Permalink
Add Scripted Field Support in Vis Builder (#6974) (#7013)
Browse files Browse the repository at this point in the history
(cherry picked from commit e74ed2c)

Signed-off-by: Suchit Sahoo <suchsah@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit a0eea7d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jul 23, 2024
1 parent 8f36039 commit da5b6b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('getAvailableFields', () => {
},
]);

expect(getAvailableFields(fields).length).toBe(1);
expect(getAvailableFields(fields).length).toBe(2);
});

test('should return all fields if filterFieldTypes was not specified', () => {
Expand All @@ -60,6 +60,21 @@ describe('getAvailableFields', () => {
expect(getAvailableFields(fields).length).toBe(2);
});

test('should return scripted fields', () => {
const fields = createIndexFields([
{
name: 'field 1',
scripted: true,
},
{
name: 'field 2',
scripted: true,
},
]);

expect(getAvailableFields(fields).length).toBe(2);
});

test('should filterFieldTypes', () => {
const fields = createIndexFields([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getAvailableFields = (
filterFieldTypes: FieldTypes = '*'
) => {
const filteredFields = fields.filter((field: IndexPatternField) => {
if (!field.aggregatable || isNestedField(field) || field.scripted) {
if (!field.aggregatable || isNestedField(field)) {
return false;
}

Expand Down

0 comments on commit da5b6b4

Please sign in to comment.