Transforming Indexes is considering the timestamp field under "_source" while comparing the data. How to exclude this field while comparison?
Below is the query I am using to transform the data from two indexes:
PUT /_transform/compare_indexes?pretty
{
"source" : {
"index" : [
"index2",
"index5"
],
"query" : {
"match_all" : { }
}
},
"dest" : {
"index" : "compare_indexes"
},
"pivot": {
"group_by": {
"name" : {
"terms" : {
"field" : "Name"
}
}
},
"aggregations" : {
"compare" : {
"scripted_metric" : {
"map_script" : "state.doc = new HashMap(params['_source'])",
"combine_script" : "return state",
"reduce_script" : """
if (states.size() !=2 ) {
return "document_mismatch"
}
else if (states.get(0).equals(states.get(1)))
{
return "match"
}
else {
return "data_mismatch"
}
"""
}
}
}
},
"frequency": "1m",
"sync": {
"time": {
"field": "@timestamp",
"delay": "1h"
}
}
}