Hi all,
I'm trying to create a transform on ElasticSearch.
I started by creating this using console and got the expected results.
In the console I use:
POST _transform/_preview
{
"source": {
"index": "test",
"query": {
"bool":{
"filter":[
{ "term": { "os_message.request_eventname.keyword": "WebScreenServerExecuted"}}
]
}
}
},
"dest" : {
"index" : "testdest"
},
"sync" : {
"time": {
"field": "timestamp",
"delay": "60s"
}
},
"pivot": {
"group_by": {
"carrier": { "terms": { "field": "os_message.application_name.keyword" }}
},
"aggregations": {
"totalToday": {
"filter": {
"bool": {
"must": [
{"range": { "@timestamp": { "from" : "now-5d", "to": "now"}}}
]
}
}
},
"totalOld": {
"filter": {
"bool": {
"must": [
{"range": { "@timestamp": { "from" : "now-10d", "to": "now-5d"}}}
]
}
}
},
"today": {
"filter": {
"bool": {
"must": [
{"range": { "@timestamp": { "from" : "now-5d", "to": "now"}}},
{"range": {"os_message.eventdetails.D": {"gte" : 1000}}}
]
}
}
},
"old": {
"filter": {
"bool": {
"must": [
{"range": { "@timestamp": { "from" : "now-10d", "to": "now-5d"}}},
{"range": {"os_message.eventdetails.D": {"gte" : 1000}}}
]
}
}
},
"diffRequests": {
"bucket_script": {
"buckets_path": {
"today": "today>_count",
"old": "old>_count",
"totalToday": "totalToday>_count",
"totalOld": "totalOld>_count"
},
"script": "params.today - params.old"
}
},
"PercentageToday": {
"bucket_script": {
"buckets_path": {
"today": "today>_count",
"old": "old>_count",
"totalToday": "totalToday>_count",
"totalOld": "totalOld>_count"
},
"script": "params.today/params.totalToday*100"
}
}
}
}
}
And the results are:
{
"preview": [
{
"carrier": "Administration",
"totalOld": 263,
"old": 41,
"today": 4,
"totalToday": 13,
"diffRequests": -37,
"PercentageToday": 30.76923076923077
},
{
"carrier": "Auth0 Web Connector Extended",
"totalOld": 57,
"old": 2,
"today": 0,
"totalToday": 94,
"diffRequests": -2,
"PercentageToday": 0
},
{
"carrier": "Azure Login Backoffice",
"totalOld": 8,
"old": 6,
"today": 0,
"totalToday": 0,
"diffRequests": -6,
"PercentageToday": null
},
{
"carrier": "DB Cleaner on Steroids",
"totalOld": 0,
"old": 0,
"today": 0,
"totalToday": 0,
"diffRequests": 0,
"PercentageToday": null
},
{
"carrier": "Discovery",
"totalOld": 54,
"old": 9,
"today": 11,
"totalToday": 48,
"diffRequests": 2,
"PercentageToday": 22.916666666666664
}
],
"generated_dest_index": {
"mappings": {
"_meta": {
"_transform": {
"transform": "transform-preview",
"version": {
"created": "8.3.2"
},
"creation_date_in_millis": 1658333989664
},
"created_by": "transform"
},
"properties": {
"carrier": {
"type": "keyword"
},
"totalOld": {
"type": "long"
},
"old": {
"type": "long"
},
"today": {
"type": "long"
},
"totalToday": {
"type": "long"
}
}
},
"settings": {
"index": {
"number_of_shards": "1",
"auto_expand_replicas": "0-1"
}
},
"aliases": {}
}
But If I create a transform, the index is empty (no docs) but in the preview, I get some results:
Any idea why my index has not been populated?
Best regards,
Ruben Marinho