Page MenuHomePhabricator
Paste P16419

extract elastic index settings for relforge
ActivePublic

Authored by dcausse on Jun 10 2021, 2:50 PM.
Tags
None
Referenced Files
F34660264: extract elastic index settings for relforge
Sep 28 2021, 9:54 AM
F34660263: extract elastic index settings for relforge
Sep 28 2021, 9:53 AM
F34634020: extract elastic index settings for relforge
Sep 6 2021, 10:15 AM
F34489642: extract elastic index settings for relforge
Jun 10 2021, 2:50 PM
Subscribers
#!/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:9243/index_in_relforge -d @index_settings.json -H 'Content-Type: application/json'

Event Timeline

Note that you need to be logged into production to do the first curl, and into a stat server to do the second

Cparle edited the content of this paste. (Show Details)