Slide 18
Slide 18 text
def update = false
def statuses = ['available','full','on_demand','error','pending']
if ctx._source.ranking == null || ctx._source.ranking > ranking {
update = true
ctx._source.ranking = ranking
}
if ctx._source.best_price == null || ctx._source.best_price > best_price {
update = true
ctx._source.best_price = best_price
}
status_index = statuses.indexOf(status)
if (status_index >= 0 && statuses.indexOf(ctx._source.status) > status_index) {
update = true
ctx._source.status = status
}
if (update == false) {
ctx.op = "none"
}