Page MenuHomePhabricator

extract elastic index settings for relforge

Authored By
dcausse
Jun 10 2021, 2:50 PM
Size
1 KB
Referenced Files
None
Subscribers
None

extract elastic index settings for relforge

#!/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

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9095806
Default Alt Text
extract elastic index settings for relforge (1 KB)

Event Timeline