Skip to content

Fixes #12602 - Change TSVB Fields API to use fieldCaps API#12611

Merged
simianhacker merged 4 commits intoelastic:masterfrom
simianhacker:field_caps
Jul 24, 2017
Merged

Fixes #12602 - Change TSVB Fields API to use fieldCaps API#12611
simianhacker merged 4 commits intoelastic:masterfrom
simianhacker:field_caps

Conversation

@simianhacker
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

closes #12602

export const getIndexPatternService = {
assign: 'indexPatternsService',
method(req, reply) {
const dataCluster = req.server.plugins.elasticsearch.getCluster('data');
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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