-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #12602 - Change TSVB Fields API to use fieldCaps API #12611
Conversation
}; | ||
const resp = await indexPatternsService.getFieldsForWildcard({ pattern: index }); | ||
const fields = resp.filter(field => field.aggregatable); | ||
return sortBy(uniq(fields, field => field.name), 'name'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't any harm in uniq+sorting the fields, but just so you know that's how they are returned by the getFieldsForWildcard()
API https://github.com/elastic/kibana/blob/master/src/server/index_patterns/service/lib/field_capabilities/__tests__/field_capabilities.js#L67-L77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know... I will remove that extra step :D
closes #12602 |
export const getIndexPatternService = { | ||
assign: 'indexPatternsService', | ||
method(req, reply) { | ||
const dataCluster = req.server.plugins.elasticsearch.getCluster('data'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When #13012 gets merged this can be simplified to req.getIndexPatternsService()
, and could be moved to into the routes if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Back ported to 5.x with dc02424 |
This PR moves changes the
/api/metrics/fields
API to use fieldCaps. This PR also moves over to the IndexPatternService.