Fixes #12602 - Change TSVB Fields API to use fieldCaps API#12611
Merged
simianhacker merged 4 commits intoelastic:masterfrom Jul 24, 2017
Merged
Fixes #12602 - Change TSVB Fields API to use fieldCaps API#12611simianhacker merged 4 commits intoelastic:masterfrom
simianhacker merged 4 commits intoelastic:masterfrom
Conversation
spalger
reviewed
Jun 30, 2017
| }; | ||
| const resp = await indexPatternsService.getFieldsForWildcard({ pattern: index }); | ||
| const fields = resp.filter(field => field.aggregatable); | ||
| return sortBy(uniq(fields, field => field.name), 'name'); |
Contributor
There was a problem hiding this comment.
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
Member
Author
There was a problem hiding this comment.
Good to know... I will remove that extra step :D
Contributor
|
closes #12602 |
thomasneirynck
approved these changes
Jul 20, 2017
spalger
reviewed
Jul 20, 2017
| export const getIndexPatternService = { | ||
| assign: 'indexPatternsService', | ||
| method(req, reply) { | ||
| const dataCluster = req.server.plugins.elasticsearch.getCluster('data'); |
Contributor
There was a problem hiding this comment.
When #13012 gets merged this can be simplified to req.getIndexPatternsService(), and could be moved to into the routes if desired.
simianhacker
added a commit
that referenced
this pull request
Jul 24, 2017
Member
Author
|
Back ported to 5.x with dc02424 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves changes the
/api/metrics/fieldsAPI to use fieldCaps. This PR also moves over to the IndexPatternService.