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

Fix csv generation when search:includeFrozen is enabled #152354

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Feb 28, 2023

Summary

fix #151546
see: #151546 (comment)

Since it isn't possible to freeze an index in 8.x to test you have to create an index and freeze it in 7.x and then upgrade to 8.x.

@Dosant
Copy link
Contributor Author

Dosant commented Feb 28, 2023

@tsullivan, is this what you had in mind here? #151546 (comment)

@@ -66,6 +66,8 @@ export class CsvGenerator {
index: indexPatternTitle,
keep_alive: duration,
ignore_unavailable: true,
// @ts-ignore
ignore_throttled: settings.includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is strange, but in my testing I found that this option doesn't seem to do anything when used with PIT. It seems like when PIT is used the search always includes frozen indices.

This leads to the situation that when include frozen is false (default), discover won't show them, but csv will

Copy link
Member

Choose a reason for hiding this comment

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

Hm, is there not a way to ignore frozen indices when using PIT? I don't see that mentioned in the docs. Can we run this by the ES search team?

Copy link
Member

Choose a reason for hiding this comment

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

I've reached out to the ES team, to get ideas why this happens.

Unfortunately, the change in the PR doesn't really seem to do anything, and has the side-effect of adding a ts-ignore line, since ignore_throttled isn't part of the OpenPointInTimeRequest interface. I believe we can probably drop awareness of the includeFrozen setting from this code, to resolve the bug and not add the ts-ignore line.

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep this here, but link to elastic/elasticsearch#94377 after the ts-ignore, so anyone reading the code can understand why it is ignored. When the ES issue is resolved, the functionality should just work as the user intends, and at that point we might be able to just remove the ts-ignore as part of minor cleanup.

Copy link
Member

Choose a reason for hiding this comment

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

I have merged elastic/elasticsearch#94377. I think you can remove this workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened to clean up: #153359

@Dosant Dosant added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) labels Feb 28, 2023
@Dosant Dosant requested a review from tsullivan February 28, 2023 16:28
@Dosant Dosant marked this pull request as ready for review February 28, 2023 16:28
@Dosant Dosant requested a review from a team as a code owner February 28, 2023 16:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@tsullivan
Copy link
Member

@tsullivan, is this what you had in mind here? #151546 (comment)

I think this is the right approach for the bug. Apologies that I wrote a different proposal earlier on - but I think these changes highlight that SearchSource is not putting the ignore_throttled indices option "automatically" - rather it really is controlled in the CSV Generation module.

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

Let's try to understand if always including frozen indices with PIT is intentional

@@ -66,6 +66,8 @@ export class CsvGenerator {
index: indexPatternTitle,
keep_alive: duration,
ignore_unavailable: true,
// @ts-ignore
ignore_throttled: settings.includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
Copy link
Member

Choose a reason for hiding this comment

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

Hm, is there not a way to ignore frozen indices when using PIT? I don't see that mentioned in the docs. Can we run this by the ES search team?

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

The ignore_throttled isn't part of the OpenPointInTimeRequest interface, which indicates we probably don't need to handle it at all. But let's wait to hear what the ES team has to say.

@@ -66,6 +66,8 @@ export class CsvGenerator {
index: indexPatternTitle,
keep_alive: duration,
ignore_unavailable: true,
// @ts-ignore
ignore_throttled: settings.includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
Copy link
Member

Choose a reason for hiding this comment

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

I've reached out to the ES team, to get ideas why this happens.

Unfortunately, the change in the PR doesn't really seem to do anything, and has the side-effect of adding a ts-ignore line, since ignore_throttled isn't part of the OpenPointInTimeRequest interface. I believe we can probably drop awareness of the includeFrozen setting from this code, to resolve the bug and not add the ts-ignore line.

@Dosant
Copy link
Contributor Author

Dosant commented Mar 7, 2023

@tsullivan

I believe we can probably drop awareness of the includeFrozen setting from this code, to resolve the bug and not add the ts-ignore line.

Yes, agree, this would be better if there is no intention to change the behavior on es side

The ignore_throttled isn't part of the OpenPointInTimeRequest interface, which indicates we probably don't need to handle it at all. But let's wait to hear what the ES team has to say.

it isn't part of the interface but es accepts as a valid option inside the request. So there is a validation level that allows the option, but the internal implementation doesn't seem to be using it.

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM, but first let's add a way to track the issue in ES by linking to elastic/elasticsearch#94377

@@ -66,6 +66,8 @@ export class CsvGenerator {
index: indexPatternTitle,
keep_alive: duration,
ignore_unavailable: true,
// @ts-ignore
ignore_throttled: settings.includeFrozen ? false : undefined, // "true" will cause deprecation warnings logged in ES
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep this here, but link to elastic/elasticsearch#94377 after the ts-ignore, so anyone reading the code can understand why it is ignored. When the ES issue is resolved, the functionality should just work as the user intends, and at that point we might be able to just remove the ts-ignore as part of minor cleanup.

@Dosant
Copy link
Contributor Author

Dosant commented Mar 8, 2023

Thanks @tsullivan, I added a comment and link to the issue: #152884

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 428 430 +2

Total ESLint disabled count

id before after diff
securitySolution 505 507 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Dosant Dosant added release_note:fix backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Mar 8, 2023
@Dosant Dosant merged commit 00e0f5c into elastic:main Mar 8, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 8, 2023
…2354)

fix elastic#151546
see: elastic#151546 (comment)

Since it isn't possible to freeze an index in 8.x to test you have to
create an index and freeze it in 7.x and then upgrade to 8.x.

(cherry picked from commit 00e0f5c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.7

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 8, 2023
) (#152901)

# Backport

This will backport the following commits from `main` to `8.7`:
- [Fix csv generation when `search:includeFrozen` is enabled
(#152354)](#152354)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Anton
Dosov","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-03-08T12:26:16Z","message":"Fix
csv generation when `search:includeFrozen` is enabled (#152354)\n\nfix
https://github.com/elastic/kibana/issues/151546\r\nsee:
https://github.com/elastic/kibana/issues/151546#issuecomment-1443996912\r\n\r\n\r\nSince
it isn't possible to freeze an index in 8.x to test you have
to\r\ncreate an index and freeze it in 7.x and then upgrade to
8.x.","sha":"00e0f5cae3911fec2491d3bba7684365fe74fdb5","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Reporting","Team:SharedUX","backport:prev-minor","v8.8.0"],"number":152354,"url":"https://github.com/elastic/kibana/pull/152354","mergeCommit":{"message":"Fix
csv generation when `search:includeFrozen` is enabled (#152354)\n\nfix
https://github.com/elastic/kibana/issues/151546\r\nsee:
https://github.com/elastic/kibana/issues/151546#issuecomment-1443996912\r\n\r\n\r\nSince
it isn't possible to freeze an index in 8.x to test you have
to\r\ncreate an index and freeze it in 7.x and then upgrade to
8.x.","sha":"00e0f5cae3911fec2491d3bba7684365fe74fdb5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152354","number":152354,"mergeCommit":{"message":"Fix
csv generation when `search:includeFrozen` is enabled (#152354)\n\nfix
https://github.com/elastic/kibana/issues/151546\r\nsee:
https://github.com/elastic/kibana/issues/151546#issuecomment-1443996912\r\n\r\n\r\nSince
it isn't possible to freeze an index in 8.x to test you have
to\r\ncreate an index and freeze it in 7.x and then upgrade to
8.x.","sha":"00e0f5cae3911fec2491d3bba7684365fe74fdb5"}}]}] BACKPORT-->

Co-authored-by: Anton Dosov <[email protected]>
bmorelli25 pushed a commit to bmorelli25/kibana that referenced this pull request Mar 10, 2023
…2354)

fix elastic#151546
see: elastic#151546 (comment)


Since it isn't possible to freeze an index in 8.x to test you have to
create an index and freeze it in 7.x and then upgrade to 8.x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:fix Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.7.0 v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSV Export does not work with the search:includeFrozen: true setting
6 participants