Skip to content

Commit 6f73563

Browse files
Fix visualize a field through discover app (#73652) (#73801)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 59954f8 commit 6f73563

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/plugins/discover/public/application/components/sidebar/lib/visualize_url_utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function getVisualizeUrl(
155155
params: {
156156
field: field.name,
157157
size: parseInt(aggsTermSize, 10),
158-
orderBy: '2',
158+
orderBy: '1',
159159
},
160160
};
161161
}
@@ -169,7 +169,7 @@ export function getVisualizeUrl(
169169
query: state.query,
170170
vis: {
171171
type,
172-
aggs: [{ schema: 'metric', type: 'count', id: '2' }, agg],
172+
aggs: [{ schema: 'metric', type: 'count', id: '1' }, agg],
173173
},
174174
} as any),
175175
},

test/functional/apps/discover/_field_visualize.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
2727
const kibanaServer = getService('kibanaServer');
2828
const log = getService('log');
2929
const queryBar = getService('queryBar');
30-
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
30+
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker', 'visualize']);
3131
const defaultSettings = {
3232
defaultIndex: 'logstash-*',
3333
};
@@ -48,6 +48,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
4848
await PageObjects.timePicker.setDefaultAbsoluteRange();
4949
});
5050

51+
it('should be able to visualize a field and save the visualization', async () => {
52+
await PageObjects.discover.findFieldByName('type');
53+
log.debug('visualize a type field');
54+
await PageObjects.discover.clickFieldListItemVisualize('type');
55+
await PageObjects.visualize.saveVisualizationExpectSuccess('Top 5 server types');
56+
});
57+
5158
it('should visualize a field in area chart', async () => {
5259
await PageObjects.discover.findFieldByName('phpmemory');
5360
log.debug('visualize a phpmemory field');

0 commit comments

Comments
 (0)