I am looking for some help with a watcher that I am trying to run. Basically I am trying to run a search query that will return a value if there is a difference between two aggregations.
Below is the script I am running in dev tools to compare the cardinality of number of documents in 15 min intervals to the cumulative cardinality of number of documents over a 1 hour period. I only want the script to output for differences between the two values and at the moment it is outputting regardless of whether there is a difference of not;
int i = params._source.aggregations.book_name.buckets.pull_tag.buckets.per_15m.buckets.total_docs.value;
int j = params._source.aggregations.book_name.buckets.pull_tag.buckets.per_15m.buckets.card.value;
if ( i != j )