# ML - Updated analytics task state to \[failed\] with reason \[Limit of total fields \[1000\] has been exceeded\]

**URL:** <https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [November 10, 2021, 12:06pm UTC](https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886 "2021-11-10T12:06:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciment](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@ciment](https://discuss.elastic.co/u/ciment)\
**Post date:** [November 10, 2021, 12:06pm UTC](https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886/1 "2021-11-10T12:06:32Z")

</div>

Hi,

I want to setup ML job with outlier detection for http statuses 4xx and 5xx. I use ELK stack version 7.15.1.

This is the json of ML job.

```auto
{
  "id": "ml-http-4xx",
  "create_time": 1636545614078,
  "version": "7.15.1",
  "description": "",
  "source": {
    "index": [
      "apm-*-transaction*"
    ],
    "query": {
      "bool": {
        "filter": [
          {
            "bool": {
              "should": [
                {
                  "range": {
                    "http.response.status_code": {
                      "gte": "400"
                    }
                  }
                }
              ],
              "minimum_should_match": 1
            }
          },
          {
            "bool": {
              "should": [
                {
                  "range": {
                    "http.response.status_code": {
                      "lte": "500"
                    }
                  }
                }
              ],
              "minimum_should_match": 1
            }
          }
        ]
      }
    }
  },
  "dest": {
    "index": "ml-http-4xx",
    "results_field": "ml"
  },
  "analysis": {
    "outlier_detection": {
      "compute_feature_influence": true,
      "outlier_fraction": 0.05,
      "standardization_enabled": true
    }
  },
  "analyzed_fields": {
    "includes": [
      "http.response.status_code"
    ],
    "excludes": []
  },
  "model_memory_limit": "55mb",
  "allow_lazy_start": false,
  "max_num_threads": 1
}

```

After starting the job, I received the error and job state is failed:

```auto
Updated analytics task state to [failed] with reason [Limit of total fields [1000] has been exceeded]

```

I use `apm-*-transaction*` index pattern, because when I used `apm-*`, I got exception due to metric mappings.

Any help? Thanks

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [November 10, 2021, 1:12pm UTC](https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886/2 "2021-11-10T13:12:01Z")

</div>

1. Are you sure you don't want to do [anomaly detection](https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html) instead of [outlier detection](https://www.elastic.co/guide/en/machine-learning/current/dfa-outlier-detection.html)? I know they sound similar, but anomaly detection jobs can also run on data continuously, including real-time.

2. You say you want 4xx and 5xx codes but your query looks like \>400 and \<500 which would ONLY give you 4xx codes.

---

<div class="post-metadata">

**Author:** ![ciment](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@ciment](https://discuss.elastic.co/u/ciment)\
**Post date:** [November 16, 2021, 11:24am UTC](https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886/3 "2021-11-16T11:24:48Z")

</div>

Hi Rich,

Yes, You're right.

1. I made a mistake, it should be anomaly detection.
2. I forgot add condition to select 5xx code.

I've tried anomaly detection and it works now.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 14, 2021, 11:25am UTC](https://discuss.elastic.co/t/ml-updated-analytics-task-state-to-failed-with-reason-limit-of-total-fields-1000-has-been-exceeded/288886/4 "2021-12-14T11:25:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
