[Security Solution] Optimize bulk rule import
Epic: https://github.com/elastic/kibana/issues/264906
Summary
Optimize the _import endpoint for bulk rule import.
The endpoint should use true bulk operations under the hood. All initPromisePool and p-map usages should be replaced with true bulk calls. All bulk fetches (reads) and creation/updates (writes) should be done in true bulk. All N+1 patterns should be eliminated.
Details
Two sequential optimizations are planned at the moment (see the sub-tickets).
After both optimizations are merged, a follow-up audit of the endpoint will determine whether further improvements are required.
Main scope
- https://github.com/elastic/kibana/issues/264909
- https://github.com/elastic/kibana/issues/275204
- Audit
_importpost-optimization; open sub-tickets for any issues found
Additional improvements
In addition, in order to maximize the speed of importing certain kinds of rules, we should work on these optimizations too:
- Importing enabled rules
- Skip unnecessary repeat imports during
overwrite=true - Importing rules with actions
Post optimization: Raise current import limits
After this work has been carried out, we should also raise bulk import upload limits past the 10MB we have at the moment.
Resources
- Initiative: https://github.com/elastic/security-team/issues/16958 (internal)
- Performance testing repo: https://github.com/elastic/security-detection-rules-performance-testing
Source: elastic/kibana