Update_by_query and routing

Hi all,

I have an index with custom routing on it... I've added a new field, and I need to use a script to derive the value that will populate it. I figured an update_by_query might be the way to go - but it seems to be impossible? I get the following error:
"type":"routing_missing_exception","reason":"routing is required for [weatherb]/[daily]/[_updatebyquery]"

The script itself works - I've run the update against an index with no routing on it.

The ctx._routing = ctx._source.wsid; line in the script is copied from when I originally reindexed into the routed version...

Anyone know a solution? Or do I just bite the bullet and do a _reindex?

curl -X POST localhost:9200/weatherb/daily/_updatebyquery -d '
{
	"script" : { 
		"inline": "ctx._routing = ctx._source.wsid; ctx._source.md = ctx._source.date.substring(5, 7)  + ctx._source.date.substring(8, 10);", 
		"lang": "painless" 
	}
}'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.