Skip to content

Conversation

@eric-forte-elastic
Copy link
Contributor

@eric-forte-elastic eric-forte-elastic commented Jul 1, 2024

Issues

#3697

Summary

This PR adds a property to QueryRuleData that allows you to use either index or data view depending on which one is set. This PR is dependent on a validation update to main that prevents both indexes and data views from being set.

Please review and merge #3830 first and backport this to DAC-Feature before reviewing this PR. Update: 3830 is now Merged.

Note: There are a few remaining data.index calls that do not appear to support using this property. For example, in validate_eql this update is not supported as data.index is used as an index parameter to the self.es_client.eql.search function call which does not support data views.

Testing

Make a package using make to make sure the new property fills the requirements of the updated function calls that used to use .index.

@eric-forte-elastic eric-forte-elastic added enhancement New feature or request python Internal python for the repository Team: TRADE detections-as-code labels Jul 1, 2024
@eric-forte-elastic eric-forte-elastic self-assigned this Jul 1, 2024
@eric-forte-elastic eric-forte-elastic linked an issue Jul 1, 2024 that may be closed by this pull request
@Mikaayenson
Copy link
Contributor

@eric-forte-elastic any reason why we can't do this in #3830 ?

Copy link
Contributor

@terrancedejesus terrancedejesus left a comment

Choose a reason for hiding this comment

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

Great work 👍🏽

  • Added a comment about ES|QL rules having no index nor dataview
  • Checked other ...RuleData classes that inherity QueryRuleData and they seem fine with these updates
  • Did not review for small nits

As always, I'd run a build package with the changes before merging to ensure that packaging, rule validation and schema's are all good. Approving not to block.

@eric-forte-elastic
Copy link
Contributor Author

@eric-forte-elastic any reason why we can't do this in #3830 ?

Looking at the implementation, I think we could do this in 3830 (originally there was some concern that we might not be able to) However, since we have most the implementation discussion in this issue and we expect that we may merge to main fairly shortly, I think it is best to keep them separate.

@eric-forte-elastic eric-forte-elastic merged commit 8d85c3f into DAC-feature Jul 10, 2024
@eric-forte-elastic eric-forte-elastic deleted the 3697-frdac-update-handling-data-views-from-kibana branch July 10, 2024 15:53
"""Return the index or dataview depending on which is set. If neither returns empty list."""
if self.index is not None:
return self.index
elif self.dataview is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be self.data_view_id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

detections-as-code enhancement New feature or request python Internal python for the repository Team: TRADE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR][DAC] Update Handling Data Views from Kibana

5 participants