hi
I could use below logic successfully in Watcher transforms
def documents = ctx.payload.hits.hits.stream()
.map(hit -> [
"sum_other_doc_count": hit._source.event_dataset.sum_other_doc_count
])
.collect(Collectors.toList());
return [ "_doc" : documents];
But I want to simulate simialr in the DEV tools -> Painless Lab
. So I've taken the same sample data input for Watcher and copied into "parameters" within the Painless Lab. Now changed the logic as below, but is NOT working. Seems like map() etc is not working in painless lab
?
def doc = params.aggregations.stream()
.map(hit -> [
"sum_other_doc_count": "hit.event_dataset.sum_other_doc_count"
]);
return doc;
I wanted to simulate the same logic in Watcher within Painless Lab without changing the logic. Any help would be appreciated.
Data Attached below
{event_dataset={doc_count_error_upper_bound=0, sum_other_doc_count=783, buckets=[{doc_count=1553, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=1553, key=1451606400000}]}, key=Low Tide Media}, {doc_count=1370, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=1370, key=1451606400000}]}, key=Elitelligence}, {doc_count=1218, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=1218, key=1451606400000}]}, key=Oceanavigations}, {doc_count=1055, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=1055, key=1451606400000}]}, key=Tigress Enterprises}, {doc_count=947, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=947, key=1451606400000}]}, key=Pyramidustries}, {doc_count=525, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=525, key=1451606400000}]}, key=Angeldale}, {doc_count=458, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=458, key=1451606400000}]}, key=Gnomehouse}, {doc_count=415, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=415, key=1451606400000}]}, key=Spherecords}, {doc_count=345, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=345, key=1451606400000}]}, key=Microlutions}, {doc_count=263, time_aggs={buckets=[{key_as_string=2016-01-01T00:00:00.000Z, doc_count=263, key=1451606400000}]}, key=Spritechnologies}]}}