-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Reporting] Not able to generate CSV report on object fields; Discover is able #25068
Comments
It looks like Discover uses a completely different search (
That means that the columns are shown/hidden possibly in some part of the browser memory, getting intialized from the visState data for saved searches. That would not work for CSV export. CSV export gets the its search request body passed from the Discover app (the Here's an example of the search request body generated for a test index, when the Discover table only has the
The bad part is the Really ugly workaround: remove the |
@gammon @kobelb @elastic/kibana-discovery I've been going back where
It seems like it's enough to just use |
I unfortunately don't have any memory of this aspect of CSV reporting, so I'm afraid I won't be much help here. |
I don't know what all the ramifications of removing it would be, but we do present stored fields to the user so removing it would likely be a breaking change. |
Pinging @elastic/kibana-app |
@tsullivan maybe if one of the sub-fields in the object is marked as stored:true in the mappings. |
@joelgriffith this should go into the test plan for #34571 |
I took a look at this today. I just wanted to jot down my findings as well as my suggested solution. Currently, Discover doesn't do any sort of "filtering" which fields are queried and returned from Elasticsearch. Discover requests all of the stored fields (those inside
Then, in Discover, we build the field list/selector based on those found inside However, when you generate a CSV report, things work a little differently. Since we don't need to display any sort of field list/selector (and the fields are already determined), we explicitly call kibana/src/legacy/ui/public/courier/search_source/search_source.js Lines 569 to 580 in bbd8980
The bug is here inside these lines of code. The code currently looks at which fields are scripted fields, and which are docvalue fields, then takes the remaining list of fields and sets both
The only place this code is currently called happens is inside
My proposed solution is, when we fetch the field list when creating an index pattern or refreshing an index pattern, to add additional metadata to the field about whether or not it is stored. (This is available via the mapping as the Elasticsearch documentation: |
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
I'm coming back to this after responding to https://discuss.elastic.co/t/cannot-generate-csv-on-nested-field/214062/2
I am in favor of seeing this bug solved however necessary. @lukasolson when you find that the CSV export flow uses a lot of code that isn't used elsewhere ( I have a big concern that, we're using Courier helper code to generate the job parameters created for the report generation request, and that code has a chance of going away or being repurposed with any future changes to Discover's architecture. This bug is related to that concern, so I'd like to ask if there is a way we could simplify the work being done in the browser for these parameters, and move more of that work towards common utilities available on the server? I'm brainstorming ideas about how we would build a CSV export architecture that is API powered so it can be used in automation? If we have the most modern architecture for Discover that we need, what would this integration look like? It has been hard for me to come up with ideas and chase bug fixes on this, because so much of the work needed to make the data formatted properly and mapped into a data table is only accessible in UI code, which is unavailable for automation purposes. |
I commented on this @elastic/kibana-app-arch issue: #65069 (comment) Reporting needs the enhancement of having the SearchSource module available on the server, so that our generation API can simply include the ID of the saved search. We should be able to generate the same query that is used in the browser without using any helper code in Reporting. It seems like that issue will start to get us there. |
Pinging @elastic/kibana-app-services (Team:AppServices) |
This is in-progress: #88303 |
This will be fixed in #88303 but only when "Read fields from _source" is OFF |
Kibana version: First reported with 6.2.2, reproducible in 6.4.2
Describe the bug:
Steps to reproduce:
disabled
field [fieldName] isn't a leaf field
Representing the field value works in Discover, presumably because Discover has a request body that uses the
source
option. CSV generation fails, presumably because the request body usesstored_fields
in the request body.Asking for stored fields is currently potentially problematic because not all fields have stored fields. To quote @colings86
The text was updated successfully, but these errors were encountered: