Skip to content

[Entity Analytics][Lead Generation][3] Entity retrieval and enrichment to get data for lead generation#256628

Merged
abhishekbhatia1710 merged 1 commit intoelastic:mainfrom
abhishekbhatia1710:ea-15948-entity-retrieval-enrichment
Mar 27, 2026
Merged

[Entity Analytics][Lead Generation][3] Entity retrieval and enrichment to get data for lead generation#256628
abhishekbhatia1710 merged 1 commit intoelastic:mainfrom
abhishekbhatia1710:ea-15948-entity-retrieval-enrichment

Conversation

@abhishekbhatia1710
Copy link
Copy Markdown
Contributor

Summary

  • Introduces a shared Entity Retriever that centralises Entity Store V2 fetching, paginated via search_after for all users/hosts, or targeted by name, replacing duplicated inline logic in the generate-leads route
  • Introduces an Entity Enricher that pre-fetches risk score history (90-day daily averages), alert summaries (severity breakdown, top rules, top alerts), asset criticality, and privileged status for a batch of entities
  • Refactors the generate-leads route to delegate entity fetching to the retriever, removing ~70 lines of inline code
  • Updates the barrel file to export both new services and their types

Closes : https://github.com/elastic/security-team/issues/15948

This PR is 3rd part of the lead generation feature being built under the Entity Analytics Lead Generation epic. It builds on the foundation and observation modules from #255272 and #256156.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@abhishekbhatia1710 abhishekbhatia1710 requested review from a team as code owners March 9, 2026 09:33
@abhishekbhatia1710 abhishekbhatia1710 self-assigned this Mar 9, 2026
@abhishekbhatia1710 abhishekbhatia1710 added backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:Entity Analytics Security Entity Analytics Team labels Mar 9, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 9, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (4)
  • reviewer:coderabbit
  • Team:Search
  • Team:Operations
  • Team:QA

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 574d5f3d-b910-4722-be90-bf04633e735c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@hop-dev hop-dev left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all my comments 🚀

@abhishekbhatia1710 abhishekbhatia1710 requested review from a team as code owners March 27, 2026 09:27
@botelastic botelastic bot added Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation labels Mar 27, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-presentation-team (Team:obs-presentation)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

Adds AlertAnalysisModule, LLMSynthesize, entity conversion, generate_leads
route handler with full orchestration, and get_leads route.

Review changes: use data clients, thin route handler, split alert module
into folder, fix escalation detection, remove dead weight field, scope
usedTitleTracker, deduplicate staleness logic, simplify LLM prompt.
@abhishekbhatia1710 abhishekbhatia1710 force-pushed the ea-15948-entity-retrieval-enrichment branch from d7cf013 to 607f80c Compare March 27, 2026 09:35
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout: [ platform / navigation ] plugin / local-serverless-security_complete - navigation - opens panel on legacy management landing page
  • [job] [logs] Jest Tests #1 / SelectedFilters should render properly

Metrics [docs]

✅ unchanged

History

cc @abhishekbhatia1710

@abhishekbhatia1710 abhishekbhatia1710 merged commit 7b3fb52 into elastic:main Mar 27, 2026
18 checks passed
kelvtanv pushed a commit to kelvtanv/kibana that referenced this pull request Mar 27, 2026
…t to get data for lead generation (elastic#256628)

## Summary

- Introduces a shared **Entity Retriever** that centralises Entity Store
V2 fetching, paginated via `search_after` for all users/hosts, or
targeted by name, replacing duplicated inline logic in the
generate-leads route
- Introduces an **Entity Enricher** that pre-fetches risk score history
(90-day daily averages), alert summaries (severity breakdown, top rules,
top alerts), asset criticality, and privileged status for a batch of
entities
- Refactors the generate-leads route to delegate entity fetching to the
retriever, removing ~70 lines of inline code
- Updates the barrel file to export both new services and their types


Closes : elastic/security-team#15948

This PR is 3rd part of the lead generation feature being built under the
[Entity Analytics Lead Generation
epic](elastic/security-team#14401). It builds
on the foundation and observation modules from elastic#255272 and elastic#256156.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Mar 30, 2026
…t to get data for lead generation (elastic#256628)

## Summary

- Introduces a shared **Entity Retriever** that centralises Entity Store
V2 fetching, paginated via `search_after` for all users/hosts, or
targeted by name, replacing duplicated inline logic in the
generate-leads route
- Introduces an **Entity Enricher** that pre-fetches risk score history
(90-day daily averages), alert summaries (severity breakdown, top rules,
top alerts), asset criticality, and privileged status for a batch of
entities
- Refactors the generate-leads route to delegate entity fetching to the
retriever, removing ~70 lines of inline code
- Updates the barrel file to export both new services and their types


Closes : elastic/security-team#15948

This PR is 3rd part of the lead generation feature being built under the
[Entity Analytics Lead Generation
epic](elastic/security-team#14401). It builds
on the foundation and observation modules from elastic#255272 and elastic#256156.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
abhishekbhatia1710 added a commit to abhishekbhatia1710/kibana that referenced this pull request Mar 31, 2026
Resolve conflicts after PRs elastic#255272 (Foundation), elastic#256156 (Observation
Modules), elastic#256628 (Entity Retrieval), and elastic#257046 (CRUD API Routes)
were merged into main.

Key resolutions:
- Keep main's authoritative versions of observation modules with
  data-driven tier tables and RiskScoreDataClient integration
- Add scheduling-specific weight properties to module configs
- Wire RiskScoreDataClient through RunPipelineParams via dependency
  injection (route uses context, task creates from CoreStart)
- Preserve main's .keyword suffix fixes in lead_data_client ES queries
- Keep scheduling branch's single-file behavioral_analysis_module
  (consolidated from subdirectory structure) and remove stale subdir
- Delete generate_leads.test.ts (coverage moved to run_pipeline.test.ts)
- Preserve Task Manager registration, enable/disable route wiring,
  and run_pipeline shared orchestration from scheduling branch

Note: pre-commit hook bypassed because ESLint failures are from
upstream kbn-evals-suite-significant-events package (pre-existing
in main), not from lead generation changes.
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…t to get data for lead generation (elastic#256628)

## Summary

- Introduces a shared **Entity Retriever** that centralises Entity Store
V2 fetching, paginated via `search_after` for all users/hosts, or
targeted by name, replacing duplicated inline logic in the
generate-leads route
- Introduces an **Entity Enricher** that pre-fetches risk score history
(90-day daily averages), alert summaries (severity breakdown, top rules,
top alerts), asset criticality, and privileged status for a batch of
entities
- Refactors the generate-leads route to delegate entity fetching to the
retriever, removing ~70 lines of inline code
- Updates the barrel file to export both new services and their types


Closes : elastic/security-team#15948

This PR is 3rd part of the lead generation feature being built under the
[Entity Analytics Lead Generation
epic](elastic/security-team#14401). It builds
on the foundation and observation modules from elastic#255272 and elastic#256156.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…t to get data for lead generation (elastic#256628)

## Summary

- Introduces a shared **Entity Retriever** that centralises Entity Store
V2 fetching, paginated via `search_after` for all users/hosts, or
targeted by name, replacing duplicated inline logic in the
generate-leads route
- Introduces an **Entity Enricher** that pre-fetches risk score history
(90-day daily averages), alert summaries (severity breakdown, top rules,
top alerts), asset criticality, and privileged status for a batch of
entities
- Refactors the generate-leads route to delegate entity fetching to the
retriever, removing ~70 lines of inline code
- Updates the barrel file to export both new services and their types


Closes : elastic/security-team#15948

This PR is 3rd part of the lead generation feature being built under the
[Entity Analytics Lead Generation
epic](elastic/security-team#14401). It builds
on the foundation and observation modules from elastic#255272 and elastic#256156.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:Entity Analytics Security Entity Analytics Team Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants