Commit 53ba5040 by Amir Aharon

add reindexing

parent fa94d16c
Showing with 29 additions and 1 deletions
#create index with mapping #create index with mapping
curl -XPUT "http://localhost:9200/activityidx" -d'{ "mappings": { "activity": { "properties": { "metaData.loc": { "type": "geo_point" } } } } }' curl -XPUT "http://localhost:9200/activityidx" -d'{ "mappings": { "activity": { "properties": { "metaData.loc": { "type": "geo_point" } } } } }'
- https://www.elastic.co/blog/changing-mapping-with-zero-downtime
Steps to change mapping type by reindexing and alias on a new index (using the kibana tools):
1 - get the mapping of the original index: GET activityidx/_mapping
2 - create a json file with the changed mapping
3 - curl -XPUT localhost:9200/activityidx_v1 -H 'Content-Type: application/json' -d @index-mapping (using curl)
4 reindex to the new original to the new one:
POST _reindex
{
"conflicts": "proceed",
"source": {
"index": "activityidx"
},
"dest": {
"index": "activityidx_v1"
}
}
5 - delete the original: DELETE activityidx
6 - make an alias of activityidx to the new one:
POST _aliases
{
"actions": [
{ "add": {
"alias": "activityidx",
"index": "activityidx_v1"
}}
]
}
# delete kibana settings # delete kibana settings
curl -XDELETE http://localhost:9200/.kibana curl -XDELETE http://localhost:9200/.kibana
...@@ -18,7 +46,7 @@ curl -XPOST 'http://172.16.1.72:9200/activityidx/activity/_search' -d '{ ...@@ -18,7 +46,7 @@ curl -XPOST 'http://172.16.1.72:9200/activityidx/activity/_search' -d '{
}' }'
# delete by query # delete by query
curl -XPOST 'http://172.16.1.72:9200/activityidx/activity/_delete_by_query' -d '{ curl -XPOST 'http://172.16.1.72:9200/activityidx/activity/_delete_by_query?conflicts=proceed' -d '{
"query": { "query": {
"range": { "range": {
"published": { "published": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment