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

[Fleet] experimental toggles for doc-value-only #149131

Merged
merged 11 commits into from
Jan 25, 2023

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Jan 18, 2023

Summary

Closes #144357

WIP. Review can be started, but still requires a lot of testing and fixing the issue below.

How to test locally:

  • Turn on experimentalDataStreamSettings feature flag
  • Go to Add integration, System integration
  • On the first data stream, turn on the Doc value only switches, Save
  • The mapping changes are visible under Stack Management / Index Management / Component Templates e.g. logs-system.auth@package
  • The numeric switch sets index:false on all numeric field mappings (long, double, etc.)
  • The other switch sets index:false on all other field type mappings that support it (keyword, ip, date, etc.)
  • The new mappings will take effect after rollover

image

image

What works:

  • When turning the new doc-value-only numeric and other checkboxes on or off, the corresponding mapping changes are done in the component template
  • The logic also reads the package spec's template and preserves the index:false values regardless of the switch (tested manually by setting @timestamp field to index:false in the template, there is also the original field in logs-system.auth@package stream that is set to index:false in the package by default.
"original": {
    "index": false,
    "doc_values": false,
    "type": "keyword"
},

Pending:

  • Add/update unit and integration tests to verify the mapping change logic - DONE
  • Manual testing (turning the switches on/off, create/update package policy, upgrade package) - DONE
  • Clarify TODOs in the code about the supported types - DONE
  • Hitting an issue when turning on doc-value-only for "other" types (keyword, date, etc.). Could be that one of the fields doesn't support index:false setting. Didn't experience this when turning on only the numeric types. - FIXED
illegal_argument_exception: [illegal_argument_exception] Reason: updating component template [logs-system.auth@package] results in invalid composable template [logs-system.auth] after templates are merged

EDIT: found the root cause of this: Caused by: java.lang.IllegalArgumentException: data stream timestamp field [@timestamp] is not indexed

Checklist

Delete any items that are not applicable to this PR.

@juliaElastic juliaElastic added release_note:feature Makes this part of the condensed release notes v8.7.0 labels Jan 18, 2023
@juliaElastic juliaElastic self-assigned this Jan 18, 2023
@juliaElastic juliaElastic marked this pull request as ready for review January 19, 2023 16:25
@juliaElastic juliaElastic requested review from a team as code owners January 19, 2023 16:25
@nchaulet
Copy link
Member

@juliaElastic should we look at experimental feature when we install the package as we do for synthetic or tsdb so the experimental feature is keeped after a package upgrade?

@juliaElastic
Copy link
Contributor Author

juliaElastic commented Jan 19, 2023

should we look at experimental feature when we install the package as we do for synthetic or tsdb so the experimental feature is keeped after a package upgrade?

@nchaulet yeah, I think that piece is missing, I didn't have a chance to test the package upgrade scenario yet

EDIT: this is done, added the logic to the package install flow as well.
Testing steps

  • force install an older system package
  • add a package policy with doc-values-only flags enabled
  • upgrade the package
  • check that the numeric/other field mappings still have the index:false setting

image

Comment on lines 295 to 296
doc_value_only_numeric: { type: 'boolean' },
doc_value_only_other: { type: 'boolean' },
Copy link
Contributor

Choose a reason for hiding this comment

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

We're trying to limit mapping additions to what's strictly necessary. Sometimes, developers aren't aware that defining your field in mappings is only required if you need to query against them. Rest of the time, using dynamic: false is sufficient.

So I need to ask: are these new properties used for querying? Is there any value defining them in the mappings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't need to query on these fields. @joshdover @ruflin Could you confirm?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can't think of any reason we'd be querying on these right now in the application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pgayvallet updated with dynamic:false

Copy link
Contributor

Choose a reason for hiding this comment

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

++. If we ever have to query on it, we could use a runtime as the total number of these docs will be reasonable small.

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 23, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Code LGTM, one question though

The logic also reads the package spec's template and preserves the index:false values regardless of the switch (tested manually by setting @timestamp field to index:false in the template, there is also the original field in logs-system.auth@package stream that is set to index:false in the package by default.

Should the switch be toggle-able at all if index: false is present in the package spec, or should it be in a disabled state with a tooltip?

@@ -0,0 +1,65 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for creating this separate module to organize these helper utilities.

@juliaElastic
Copy link
Contributor Author

Should the switch be toggle-able at all if index: false is present in the package spec, or should it be in a disabled state with a tooltip?

So the switch refers to all numeric (or other) type fields in the package spec, while index:false is a setting per field. So unless all numeric (or other) type fields have this setting, we can't disable the switch.

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@juliaElastic juliaElastic requested a review from a team January 25, 2023 13:27
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 921.6KB 922.6KB +1.0KB

History

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

cc @juliaElastic

@juliaElastic juliaElastic merged commit 179b36f into elastic:main Jan 25, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Add experimental toggle for enabling doc-value-only indexing to data streams
9 participants