-
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
[Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel #52833
[Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel #52833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,10 +84,11 @@ export async function generateCsvSearch( | |
|
||
let payloadQuery: QueryFilter | undefined; | ||
let payloadSort: any[] = []; | ||
let docValueFields: any[] | undefined; | ||
if (jobParams.post && jobParams.post.state) { | ||
({ | ||
post: { | ||
state: { query: payloadQuery, sort: payloadSort = [] }, | ||
state: { query: payloadQuery, sort: payloadSort = [], docvalue_fields: docValueFields }, | ||
}, | ||
} = jobParams); | ||
} | ||
|
@@ -119,7 +120,15 @@ export async function generateCsvSearch( | |
}, | ||
}; | ||
}, {}); | ||
const docValueFields = indexPatternTimeField ? [indexPatternTimeField] : undefined; | ||
|
||
if (indexPatternTimeField) { | ||
if (docValueFields) { | ||
docValueFields = [indexPatternTimeField].concat(docValueFields); | ||
} else { | ||
docValueFields = [indexPatternTimeField]; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can no longer remember why this block of code was added, but it seems to be causing a regression where the time field value shows up as a multi-value. The effect is even baked into a unit test fixture: https://github.com/elastic/kibana/blob/a8b1a6b/x-pack/test/reporting_api_integration/fixtures.ts#L179 Noticed this while working on: #56371 |
||
|
||
const searchRequest: SearchRequest = { | ||
index: esIndex, | ||
body: { | ||
|
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.
@elastic/kibana-app can you help us understand why the
docvalue_fields
info is part of thestate
that we get from the panel info? It means the id of the saved search doc isn't enough to derive an actual ES query - the state data is additional information.