Skip to content

[ML] Data frame transform _preview endpoint missing mapping fields #46070

@walterra

Description

@walterra

The decuded mappings introduced in #43742 seems to miss exposing mappings based on scripted fields. For example, using the following in Kibana Dev Console:

POST _data_frame/transforms/_preview
{
  "source": {
    "index": [
      "filebeat-nginx-elasticco-anon-2017"
    ]
  },
  "pivot": {
    "group_by": {
      "source.address": {
        "terms": {
          "field": "source.address"
        }
      }
    },
    "aggregations": {
      "@timestamp_max": {
        "max": {
          "field": "@timestamp"
        }
      },
      "@timestamp_min": {
        "min": {
          "field": "@timestamp"
        }
      },
      "duration": {
        "bucket_script": {
          "buckets_path": {
            "min": "@timestamp_min",
            "max": "@timestamp_max"
          },
          "script": "(params.max - params.min)/1000"
        }
      }
    }
  }
}

Will return:

{
  "preview" : [
    {
      "duration" : 3236636.783,
      "@timestamp_min" : "2017-02-01T06:02:10.303Z",
      "@timestamp_max" : "2017-03-10T17:06:07.086Z",
      "source" : {
        "address" : ""
      }
    },
    ...
   {
      "duration" : 0.0,
      "@timestamp_min" : "2017-02-09T08:07:07.963Z",
      "@timestamp_max" : "2017-02-09T08:07:07.963Z",
      "source" : {
        "address" : "0.104.130.123"
      }
    }
  ],
  "mappings" : {
    "properties" : {
      "@timestamp_min" : {
        "type" : "date"
      },
      "@timestamp_max" : {
        "type" : "date"
      },
      "source.address" : {
        "type" : "keyword"
      }
    }
  }
}

You can see that duration is part of the preview documents, but it's missing from the mappings part.

This affects the Kibana data frame transforms wizard in 7.3+: For the transforms preview table, the columns visible are based on the mappings, so the duration column will not show up at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions