# Logs ML event.dataset type error

**URL:** <https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510>\
**Category:** Logs\
**Tags:** elastic-stack-machine-learning\
**Created:** [December 20, 2021, 10:51pm UTC](https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510 "2021-12-20T22:51:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Travis\_Marble](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/travis_marble/32/86415_2.png) [@Travis\_Marble](https://discuss.elastic.co/u/Travis_Marble)\
**Post date:** [December 20, 2021, 10:51pm UTC](https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510/1 "2021-12-20T22:51:08Z")

</div>

I am trying to setup Logs ML anomaly detection and getting the following error

at least one index has a field event.dataset without the correct type

![image](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a96380a5b3e02997c42748afc051bcda6a665f73.png)

Here is the typings for my index, I have seen various questions about this on here, and people have said ensure its got the right type, but never clarified which type it needs to be

```auto
{
  "logs-kiosk" : {
    "mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "alias",
          "path" : "timestamp"
        },
        "agent" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "agentId" : {
          "type" : "integer"
        },
        "event" : {
          "properties" : {
            "dataset" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "level" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "message" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "payload" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "source" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "timestamp" : {
          "type" : "date"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![simianhacker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simianhacker/32/3383_2.png) [@simianhacker](https://discuss.elastic.co/u/simianhacker)\
**Post date:** [December 20, 2021, 11:14pm UTC](https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510/2 "2021-12-20T23:14:36Z")

</div>

Most of the `{ "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }` should be `{ "type": "keyword", "ingore_above": 256 }` for this to work properly, there are some exceptions (see ECS reference below). The problem being that when `event.dataset` is a `text` field it can't be used with aggregations.

Logs (and the ML jobs) expects the schema to follow ECS: [ECS Field Reference | Elastic Common Schema (ECS) Reference [1.12] | Elastic](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html)

---

<div class="post-metadata">

**Author:** ![Travis\_Marble](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/travis_marble/32/86415_2.png) [@Travis\_Marble](https://discuss.elastic.co/u/Travis_Marble)\
**Post date:** [December 22, 2021, 12:08am UTC](https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510/3 "2021-12-22T00:08:02Z")

</div>

Thanks, I will give this a try, pretty sure it will work, but will report back. Also, thanks for the schema.

Update - This worked, Thanks again.

---

<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:** [January 19, 2022, 12:08am UTC](https://discuss.elastic.co/t/logs-ml-event-dataset-type-error/292510/4 "2022-01-19T00:08:53Z")

</div>

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