Skip to content

Instantly share code, notes, and snippets.

@benpolzin
Created September 22, 2017 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benpolzin/790670b3e1442e794f84adbdebb4b98e to your computer and use it in GitHub Desktop.
Save benpolzin/790670b3e1442e794f84adbdebb4b98e to your computer and use it in GitHub Desktop.
ben@kibana1:~$ sudo ./6-0-post-migration-fix.sh http://localhost:9200
+ URL=http://localhost:9200
+ '[' -n '' ']'
+ AUTH=
+ CURL_CMD='curl -H '\''Content-Type: application/json'\'' '
+ echo Before
Before
+ curl -H ''\''Content-Type:' 'application/json'\''' -XGET 'http://localhost:9200/_cat/indices?v'
curl: (6) Could not resolve host: application
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
... << removed for brevity
green open .kibana-6 LaISONzyRfGlu2gzSLxvhA 1 1 99 1 291.6kb 145.8kb
... << removed for brevity
+ echo 'Disable writes on .kibana-6'
Disable writes on .kibana-6
+ curl -H ''\''Content-Type:' 'application/json'\''' -XPUT http://localhost:9200/.kibana-6/_settings '-d
{
"index.blocks.write": true
}'
curl: (6) Could not resolve host: application
{"acknowledged":true}+ echo 'Creating .kibana-6-v2'
Creating .kibana-6-v2
+ curl -H ''\''Content-Type:' 'application/json'\''' -XPUT http://localhost:9200/.kibana-6-v2 '-d
{
"settings" : {
"number_of_shards" : 1,
"index.format": 6,
"index.mapper.dynamic": false
},
"mappings" : {
"doc": {
"properties": {
"type": {
"type": "keyword"
},
"updated_at": {
"type": "date"
},
"config": {
"properties": {
"buildNum": {
"type": "keyword"
}
}
},
"index-pattern": {
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
"visualization": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
},
"search": {
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"dashboard": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"url": {
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 2048
}
}
}
}
},
"server": {
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"timelion-sheet": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"timelion_chart_height": {
"type": "integer"
},
"timelion_columns": {
"type": "integer"
},
"timelion_interval": {
"type": "keyword"
},
"timelion_other_interval": {
"type": "keyword"
},
"timelion_rows": {
"type": "integer"
},
"timelion_sheet": {
"type": "text"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"graph-workspace": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"numLinks": {
"type": "integer"
},
"numVertices": {
"type": "integer"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
},
"wsState": {
"type": "text"
}
}
}
}
}
}
}'
curl: (6) Could not resolve host: application
{"acknowledged":true,"shards_acknowledged":true,"index":".kibana-6-v2"}+ echo 'Reindexing .kibana-6 into .kibana-6-v2'
Reindexing .kibana-6 into .kibana-6-v2
+ curl -H ''\''Content-Type:' 'application/json'\''' -XPOST http://localhost:9200/_reindex '-d
{
"source": {
"index": ".kibana-6"
},
"dest": {
"index": ".kibana-6-v2"
},
"script": {
"source": "if (ctx._type != \"doc\") { ctx._source = [ ctx._type : ctx._source ]; ctx._source.type = ctx._type; ctx._id = ctx._type + \":\" + ctx._id; ctx._type = \"doc\"; }"
}
}'
curl: (6) Could not resolve host: application
{"took":1195,"timed_out":false,"total":99,"updated":0,"created":99,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}+ echo 'Update .kibana alias, removes .kibana-6 and adds .kibana-6-v2'
Update .kibana alias, removes .kibana-6 and adds .kibana-6-v2
+ curl -H ''\''Content-Type:' 'application/json'\''' -XPOST http://localhost:9200/_aliases '-d
{
"actions" : [
{ "add": { "index": ".kibana-6-v2", "alias": ".kibana" } },
{ "remove" : { "index": ".kibana-6", "alias": ".kibana" } }
]
}'
curl: (6) Could not resolve host: application
{"acknowledged":true}+ echo Done
Done
+ echo After
After
+ curl -H ''\''Content-Type:' 'application/json'\''' -XGET 'http://localhost:9200/_cat/indices/.kibana?v'
curl: (6) Could not resolve host: application
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana-6-v2 DifpwNn_T4uQcyhBH2HBfg 1 1 0 0 48.3kb 24.1kb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment