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

Filter non-aggregatable fields from vis editor UI #8421

Merged
merged 2 commits into from
Sep 23, 2016
Merged

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented Sep 21, 2016

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 aggregatable

screen shot 2016-09-21 at 7 37 38 pm

It's not available for aggregation! Only the raw version is, as expected

screen shot 2016-09-21 at 7 39 38 pm

@Bargs Bargs added the review label Sep 21, 2016
@thomasneirynck thomasneirynck self-assigned this Sep 22, 2016
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.

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', {
Copy link
Contributor

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',
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

field_es_compatibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

field_capabilities?

@Bargs
Copy link
Contributor Author

Bargs commented Sep 22, 2016

@spalger I updated the endpoint name and added a mechanism to automatically refresh the field list if aggregatable and searchable are missing. That was a great catch on the issue with upgrading. Should be ready for another look.

if (!indexPattern.fields) {
return indexPattern.refreshFields();

let promise = Promise.resolve();
Copy link
Contributor

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' },
Copy link
Contributor

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.

@thomasneirynck
Copy link
Contributor

LGTM, small suggestion about adding some doc for end-user.

@Bargs
Copy link
Contributor Author

Bargs commented Sep 22, 2016

@spalger @thomasneirynck

  • Tests are passing now
  • Added helpful tool tips on the index pattern page
  • Updated that function to always return a promise

Let me know what you think

@thomasneirynck
Copy link
Contributor

LGTMagain. Help text is clear and to the point too!

@spalger
Copy link
Contributor

spalger commented Sep 23, 2016

👍

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.
@Bargs Bargs merged commit a2f5c89 into elastic:master Sep 23, 2016
This was referenced Sep 23, 2016
elastic-jasper added a commit that referenced this pull request Sep 23, 2016
---------

**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
elastic-jasper added a commit that referenced this pull request Sep 23, 2016
---------

**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
Bargs pushed a commit that referenced this pull request Sep 23, 2016
Bargs pushed a commit that referenced this pull request Sep 23, 2016
spalger pushed a commit to spalger/kibana that referenced this pull request Sep 28, 2016
@@ -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');
Copy link

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

quite likely...

@Bargs Bargs added the v6.0.0 label Oct 11, 2016
@epixa epixa added the v5.0.0 label Oct 26, 2016
@Bargs Bargs mentioned this pull request Nov 1, 2016
3 tasks
@epixa epixa added v5.1.1 and removed v5.1.0 labels Dec 8, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
---------

**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
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
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.

5 participants