﻿---
title: Scope too broad
description: A cross-project search machine learning datafeeds with flat-world routing (empty project_routing) or a broad _alias: expression searches every matching...
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7403/troubleshoot/elasticsearch/machine-learning/cps-datafeed-scope-too-broad
products:
  - Elastic Cloud Serverless
  - Elasticsearch
  - Machine Learning
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Unavailable
---

# Scope too broad
A cross-project search machine learning datafeeds with flat-world routing (empty `project_routing`) or a broad `_alias:` expression searches every matching linked project on each extraction cycle. As you link more projects, run times increase and the anomaly detection jobs model ingests more data than necessary for your use case.
<tip>
  If you can't find your issue here, explore the other [troubleshooting topics](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7403/troubleshoot) or [contact us](/elastic/docs-content/pull/7403/troubleshoot#contact-us).
</tip>


## Diagnose scope too broad

**Symptoms**
- datafeeds extraction cycles take noticeably longer after new projects were linked.
- `GET _ml/datafeeds/{datafeed_id}/_stats` shows searches fanning out to many linked projects you do not need for detection.
- `project_routing` is empty, omitted, or uses a wide wildcard such as `_alias:*` that matches most linked aliases.
- The job was created via API without an explicit routing expression and now searches all linked projects by default.

**Check effective scope**
```json
```

Compare `project_routing` with the number of linked projects in `_remote/info` and the per-project activity in `remote_cluster_stats`.

## Resolve scope too broad

**Narrow `project_routing`**
Close the job, then update routing to include only the projects you need. Elasticsearch may retain a model snapshot when you change scope with the job closed — use it if detection shifts after narrowing.
Examples:
```json

{
  "project_routing": "_origin"
}
```

```json

{
  "project_routing": "_alias:production-*"
}
```

- `_origin` or `_alias:_origin` — local project only.
- `_alias:production-*` — linked projects whose tags match the expression.

See [Project routing in CPS](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7403/explore-analyze/cross-project-search/cross-project-search-project-routing) and the [`project_routing` quick reference](/elastic/docs-content/pull/7403/troubleshoot/elasticsearch/machine-learning#project_routing-quick-reference).
**Set routing at create time**
When creating datafeeds through the API, set `project_routing` explicitly instead of relying on flat-world defaults if you do not intend to search all linked projects.
**Verify improvement**
After narrowing scope, compare extraction timing in `_stats` and confirm `remote_cluster_stats` lists only the intended projects.