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

[Discover] Only request fields that are shown to user when using new fields API #91897

Closed
wylieconlon opened this issue Feb 18, 2021 · 10 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@wylieconlon
Copy link
Contributor

wylieconlon commented Feb 18, 2021

This is a bug in Discover on master

Steps to reproduce:

  1. In advanced settings, enable discover:searchFieldsFromSource
  2. Go to Discover and click Inspect. You will see the request is fields: [{ field: '*' }, ...date fields], which is normal without excluded fields
  3. Edit your index pattern to add an excluded field
  4. Go to Discover and click Inspect. You will see the request is fields: [{ field: 'field1' }, { field: 'field2' }]
  5. Click a single column, such as bytes, to add to the table
  6. Click Inspect. The request still lists every field, even ones that are not bytes.
@wylieconlon wylieconlon added bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Feb 18, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@wylieconlon wylieconlon changed the title [Discover] Requesting too many field values when using new fields API and specific columns [Discover] Requesting too many field values when using new fields API specific columns with a field exclude in index pattern Feb 18, 2021
@wylieconlon wylieconlon changed the title [Discover] Requesting too many field values when using new fields API specific columns with a field exclude in index pattern [Discover] Only request fields that are shown to user when using new fields API Feb 18, 2021
@majagrubic
Copy link
Contributor

majagrubic commented Feb 18, 2021

There is no additional request (shouldn't be?) between steps 5 and 6, so I am confused what the issue here is

@majagrubic
Copy link
Contributor

majagrubic commented Feb 18, 2021

Everything described here is the expected behavior. The inspector shows the last executed request, which was the one requesting all the fields explicitly since you have a source filter configured.

@wylieconlon
Copy link
Contributor Author

@majagrubic I see, I assumed we were making a new request when adding columns- this doesn't seem like a bug in the Discover app. Do you think it would be a bug in the saved search embeddable, which is making a larger-than-needed request?

@majagrubic
Copy link
Contributor

Search embeddable will always request '*':

const fields: Record<string, string> = { field: '*' };

Or did you have something else in mind?

@wylieconlon
Copy link
Contributor Author

@majagrubic Right, but maybe we could optimize the request to not need as much data. Are the edge cases where that wouldn't work?

@majagrubic
Copy link
Contributor

majagrubic commented Feb 19, 2021

I think fields '*' is a pretty safe bet. We can definitely look into requesting just the fields that are already configured in the search embeddable to optimize this further, but I definitely don't think it's a high priority.

@timroes
Copy link
Contributor

timroes commented Feb 19, 2021

We're needing to request all fields, since we're using the same result to show when the document is expanded (i.e. the full document). There is no additional request happening for expanded documents (for now by choice because of the performance impact), i.e. if we would only request columns configured in the table and a user would then watch the whole document it would only contain those columns and not the full document.

@majagrubic
Copy link
Contributor

Can we close this issue as it's not really an issue?

@timroes
Copy link
Contributor

timroes commented Feb 19, 2021

Update: I am not sure if I understood Wylie initially correctly when I read that issue.

I think there is an issue here, we're currently in the saves search embeddable ignoring the field filters completely. Though I am not sure if that is exactly what Wylie meant.

UPDATE2: I actually was looking at some wrong place with that comment above, so ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

4 participants