Hi,
We would like to setup transform job to create statistics - how many devices are connected per hour. In our code we have added for every request, deviceId and clientId to labels data [labels.deviceId, labels.clientId].
We have created index template:
PUT _index_template/test_apm_devices_visits_per_hour
{
"template": {
"settings": {
"number_of_shards": 10,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"labels.deviceId": {
"type": "keyword"
},
"labels.clientId": {
"type": "keyword"
},
"@timestamp": {
"type": "date"
},
"visits": {
"type": "long"
}
}
}
},
"index_patterns": [
"test_apm_devices_visits_per_hour-*"
]
}
We have created the tansform:
PUT _transform/test_devices-visits-per-hour
{
"source": {
"index": "apm-*",
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d"
}
}
},
{
"wildcard": {
"service.name": {
"value": "prefix-for-service-name*"
}
}
}
]
}
}
},
"dest": {
"index": "test_apm_devices_visits_per_hour"
},
"pivot": {
"group_by": {
"labels.deviceId": {
"terms": {
"field": "labels.deviceId"
}
},
"labels.clientId": {
"terms": {
"field": "labels.clientId"
}
},
"@timestamp": {
"date_histogram": {
"field": "@timestamp",
"calendar_interval": "1h"
}
},
"service.name": {
"terms": {
"field": "service.name"
}
}
},
"aggregations": {
"visits": {
"value_count": {
"field": "labels.deviceId"
}
}
}
},
"frequency": "30m",
"sync": {
"time": {
"field": "@timestamp",
"delay": "1m"
}
},
"settings": {
"max_page_search_size": 10000
}
}
Creating index from template:
PUT test_apm_devices_visits_per_hour
Run transformation:
POST _transform/test_devices-visits-per-hour/_start
Immediately after start, we received exception.
task encountered irrecoverable failure: ElasticsearchParseException[Cannot set after key in the composite aggregation [_transform] - incompatible value in the position 0: invalid value, expected string, got Double]; nested: IllegalArgumentException[incompatible value in the position 0: invalid value, expected string, got Double]; nested: IllegalArgumentException[invalid value, expected string, got Double];; java.lang.IllegalArgumentException: incompatible value in the position 0: invalid value, expected string, got Double
Any help? Thanks in advance