Skip to content
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

Merged
merged 4 commits into from
Jul 24, 2017

Conversation

simianhacker
Copy link
Member

@simianhacker simianhacker commented Jun 30, 2017

This PR moves changes the /api/metrics/fields API to use fieldCaps. This PR also moves over to the IndexPatternService.

@simianhacker simianhacker requested review from spalger and removed request for ppisljar June 30, 2017 17:22
};
const resp = await indexPatternsService.getFieldsForWildcard({ pattern: index });
const fields = resp.filter(field => field.aggregatable);
return sortBy(uniq(fields, field => field.name), 'name');
Copy link
Contributor

@spalger spalger Jun 30, 2017

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

Copy link
Member Author

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

@thomasneirynck
Copy link
Contributor

closes #12602

export const getIndexPatternService = {
assign: 'indexPatternsService',
method(req, reply) {
const dataCluster = req.server.plugins.elasticsearch.getCluster('data');
Copy link
Contributor

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.

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simianhacker simianhacker merged commit 190cd5f into elastic:master Jul 24, 2017
simianhacker added a commit that referenced this pull request Jul 24, 2017
* Fixes #12602 - Change TSVB Fields API to use fieldCaps API

* Removing obsolete test

* updating tests

* removing the extra sortBy
@simianhacker
Copy link
Member Author

Back ported to 5.x with dc02424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants