-
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
Filter non-aggregatable fields from vis editor UI #8421
Conversation
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.
Looking good, have a few pieces of feedback.
This means that everyone will need to refresh all of their index patterns when they move to 5.0 right? Is there a way we can automate that?
const callWithRequest = server.plugins.elasticsearch.callWithRequest; | ||
const indices = req.params.indices || ''; | ||
|
||
callWithRequest(req, 'fieldStats', { |
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.
This should probably be returning the promise, in case an error propagates up
|
||
export function registerFields(server) { | ||
server.route({ | ||
path: '/api/kibana/{indices}/fields', |
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.
This feels like a slightly misleading route for what it does.
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.
Yeah, I gave it this name because I plan to expand it to provide all the field info Kibana needs once I remove the mapping cache. That said, I agree it could be misleading atm so I'm open to giving it a different name in the interim. Any good ideas? field_info
maybe? field_stats
came to mind but seems like a bad idea since I'm filtering out most of the field_stats info.
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.
field_usability_stats
? Naming is hard
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.
field_es_compatibility
?
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.
field_capabilities
?
@spalger I updated the endpoint name and added a mechanism to automatically refresh the field list if |
if (!indexPattern.fields) { | ||
return indexPattern.refreshFields(); | ||
|
||
let promise = Promise.resolve(); |
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.
Lets move this to the top of the function so that the return on 104 can also return a promise.
@@ -23,8 +23,9 @@ uiModules.get('apps/management') | |||
{ title: 'name' }, | |||
{ title: 'type' }, | |||
{ title: 'format' }, | |||
{ title: 'searchable' }, | |||
{ title: 'aggregatable' }, |
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.
I would add a little info blurb here for both too. Something like
'Fields that can be used to aggregate when creating visualizations`
or
`Fields that can be used to search data in the filter bar'
not sure how to word this succinctly.
Apart from that, we probably should add a little blurb about this improvement in the asciidoc too.
LGTM, small suggestion about adding some doc for end-user. |
Let me know what you think |
LGTMagain. Help text is clear and to the point too! |
👍 |
This adds a simple API for getting the searchable/aggregatable status of a list of fields in a given index, list of indices, or index pattern. In the future this will probably evolve into a full blown fields info API that we can use when removing the index pattern mapping cache. For now though it's built to provide the minimum info needed to fix elastic#6769 Usage: The API exposes a single GET endpoint. ``` GET /api/kibana/{indices}/field_capabilities ``` `indices` can be a single index, a comma delimited list, or a wildcard pattern Example response: ``` { "fields": { "imsearchable": { "searchable": true, "aggregatable": false }, "imaggregatable": { "searchable": true, "aggregatable": true }, } } ```
Using the field_capabilities API added in the previous commit, this commit enhances the client side index pattern object with information about the searchable and aggregatable status of each field in the index pattern. We then use this information to filter out non-aggregatable fields from the vis editor so that users won't accidentally select them and get nasty errors. An example of a non-aggregatable field would be a `text` field without fielddata enabled (which is the default). I also added the searchable and aggregatable flags to the index pattern page so users can see the status of their fields. I removed the `indexed` column because it was mostly redundant with `searchable` and I needed the horizontal space. The addition of the searchable and aggregatable properties for index pattern fields would require users to manually refresh their field list when upgrading to 5.0. This commit also adds a check for those properties and if they're missing it automatically refreshes the field list for the user in a seamless manner.
--------- **Commit 1:** Add field_capabilities API This adds a simple API for getting the searchable/aggregatable status of a list of fields in a given index, list of indices, or index pattern. In the future this will probably evolve into a full blown fields info API that we can use when removing the index pattern mapping cache. For now though it's built to provide the minimum info needed to fix #6769 Usage: The API exposes a single GET endpoint. ``` GET /api/kibana/{indices}/field_capabilities ``` `indices` can be a single index, a comma delimited list, or a wildcard pattern Example response: ``` { "fields": { "imsearchable": { "searchable": true, "aggregatable": false }, "imaggregatable": { "searchable": true, "aggregatable": true }, } } ``` * Original sha: 1af6b76 * Authored by Matthew Bargar <[email protected]> on 2016-09-21T18:38:34Z **Commit 2:** Filter non-aggregatable fields from vis editor UI Using the field_capabilities API added in the previous commit, this commit enhances the client side index pattern object with information about the searchable and aggregatable status of each field in the index pattern. We then use this information to filter out non-aggregatable fields from the vis editor so that users won't accidentally select them and get nasty errors. An example of a non-aggregatable field would be a `text` field without fielddata enabled (which is the default). I also added the searchable and aggregatable flags to the index pattern page so users can see the status of their fields. I removed the `indexed` column because it was mostly redundant with `searchable` and I needed the horizontal space. The addition of the searchable and aggregatable properties for index pattern fields would require users to manually refresh their field list when upgrading to 5.0. This commit also adds a check for those properties and if they're missing it automatically refreshes the field list for the user in a seamless manner. * Original sha: 4a906f3 * Authored by Matthew Bargar <[email protected]> on 2016-09-21T19:18:10Z
--------- **Commit 1:** Add field_capabilities API This adds a simple API for getting the searchable/aggregatable status of a list of fields in a given index, list of indices, or index pattern. In the future this will probably evolve into a full blown fields info API that we can use when removing the index pattern mapping cache. For now though it's built to provide the minimum info needed to fix #6769 Usage: The API exposes a single GET endpoint. ``` GET /api/kibana/{indices}/field_capabilities ``` `indices` can be a single index, a comma delimited list, or a wildcard pattern Example response: ``` { "fields": { "imsearchable": { "searchable": true, "aggregatable": false }, "imaggregatable": { "searchable": true, "aggregatable": true }, } } ``` * Original sha: 1af6b76 * Authored by Matthew Bargar <[email protected]> on 2016-09-21T18:38:34Z **Commit 2:** Filter non-aggregatable fields from vis editor UI Using the field_capabilities API added in the previous commit, this commit enhances the client side index pattern object with information about the searchable and aggregatable status of each field in the index pattern. We then use this information to filter out non-aggregatable fields from the vis editor so that users won't accidentally select them and get nasty errors. An example of a non-aggregatable field would be a `text` field without fielddata enabled (which is the default). I also added the searchable and aggregatable flags to the index pattern page so users can see the status of their fields. I removed the `indexed` column because it was mostly redundant with `searchable` and I needed the horizontal space. The addition of the searchable and aggregatable properties for index pattern fields would require users to manually refresh their field list when upgrading to 5.0. This commit also adds a check for those properties and if they're missing it automatically refreshes the field list for the user in a seamless manner. * Original sha: 4a906f3 * Authored by Matthew Bargar <[email protected]> on 2016-09-21T19:18:10Z
@@ -138,7 +138,7 @@ uiModules | |||
} | |||
|
|||
function getIndexedFields(param) { | |||
let fields = $scope.agg.vis.indexPattern.fields.raw; | |||
let fields = _.filter($scope.agg.vis.indexPattern.fields.raw, 'aggregatable'); |
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.
I'm guessing that this change may have caused scripted fields to no longer show in the list for metric aggregations?
#8585
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.
quite likely...
--------- **Commit 1:** Add field_capabilities API This adds a simple API for getting the searchable/aggregatable status of a list of fields in a given index, list of indices, or index pattern. In the future this will probably evolve into a full blown fields info API that we can use when removing the index pattern mapping cache. For now though it's built to provide the minimum info needed to fix elastic#6769 Usage: The API exposes a single GET endpoint. ``` GET /api/kibana/{indices}/field_capabilities ``` `indices` can be a single index, a comma delimited list, or a wildcard pattern Example response: ``` { "fields": { "imsearchable": { "searchable": true, "aggregatable": false }, "imaggregatable": { "searchable": true, "aggregatable": true }, } } ``` * Original sha: bea909d97634b69f07013485eee41f62d5d017e0 [formerly 1af6b76] * Authored by Matthew Bargar <[email protected]> on 2016-09-21T18:38:34Z **Commit 2:** Filter non-aggregatable fields from vis editor UI Using the field_capabilities API added in the previous commit, this commit enhances the client side index pattern object with information about the searchable and aggregatable status of each field in the index pattern. We then use this information to filter out non-aggregatable fields from the vis editor so that users won't accidentally select them and get nasty errors. An example of a non-aggregatable field would be a `text` field without fielddata enabled (which is the default). I also added the searchable and aggregatable flags to the index pattern page so users can see the status of their fields. I removed the `indexed` column because it was mostly redundant with `searchable` and I needed the horizontal space. The addition of the searchable and aggregatable properties for index pattern fields would require users to manually refresh their field list when upgrading to 5.0. This commit also adds a check for those properties and if they're missing it automatically refreshes the field list for the user in a seamless manner. * Original sha: b823b877f90ce84cb6f789ea90a0fb17e53ad12f [formerly 4a906f3] * Authored by Matthew Bargar <[email protected]> on 2016-09-21T19:18:10Z Former-commit-id: 672f009
[backport] PR elastic#8421 to 5.x Former-commit-id: 481e21b
Fixes #6769 by removing non-aggregatable fields from the vis editor field selector. We get the aggregatable status thanks to elastic/elasticsearch#17980
See commit messages for detailed notes.
Obligatory screenshots:
Notice
agent
is not aggregatableIt's not available for aggregation! Only the
raw
version is, as expected