Skip to main content

Posts

Showing posts from July, 2017

Aggregation based comparison in Watch condition and hard-coded variables

Watch: Compare Vs Script condition If you need to do comparisons with aggregation buckets in watchers, then instead of this: "condition": { "compare": { "ctx.payload.aggregations.agg1.buckets.0.doc_count": { "gte": 5 } } } please prefer this, as this takes care of "Index out of bound" exceptions: "condition": { "script": { "source": "return (ctx.payload.aggregations.agg1.buckets.size() > 0 && ctx.payload.aggregations.agg1.buckets.0.doc_count >= params.threshold)", "lang": "painless", "params": { "threshold": 5 } } } Hard-coded variables in scripts ElasticSearch throws circuit_breaking_exception error when it sees more than 15 new dynamic scripts within a minute. Sometimes this error is also thrown when master goes down abruptly. This is so because, it has to compile every new/unique script it s