#!/bin/bash curl -s https://search.svc.eqiad.wmnet:9243/index_to_copy | jq ' def walk(f): . as $in | if type == "object" then reduce keys[] as $key ( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f elif type == "array" then map( walk(f) ) | f else f end; { settings: (.[].settings | .index.number_of_replicas = "0" | .index.auto_expand_replicas = "0-0" | .index.routing.allocation.total_shards_per_node = "-1" | delpaths([ ["index", "creation_date"], ["index", "uuid"], ["index", "version", "created"], ["index", "version", "upgraded"], ["index", "provided_name"] ]) ), mappings: (.[].mappings | delpaths([ ["page", "properties", "coordinates", "properties", "coord", "lat_lon"] ]) | # 2.x -> 5.x migration walk( if (type == "object") and (.type == "string") then .type = "text" else . end ) | walk( if (type == "object") and (.ignore_above) then del(.ignore_above) else . end ) ) }' > index_settings.json curl -s -XPUT https://relforge1003.eqiad.wmnet:9443/index_in_relforge -d @index_settings.json