修改write index

假定myidx-2019-03-25原本是myidx-alias的write index, 以下示例将使myidx-2019-04-08成为新的write index

  1. # POST _aliases
  2. {
  3. "actions": [
  4. {
  5. "add": {
  6. "index": "myidx-2019-04-08",
  7. "alias": "myidx-alias",
  8. "is_write_index": true
  9. }
  10. },
  11. {
  12. "add" : {
  13. "index" : "myidx-2019-03-25",
  14. "alias" : "myidx-alias"
  15. }
  16. }
  17. ]
  18. }

替换alias下的index

old_idx进行重索引拆出多个idx-20*新index后,将新的idx-20*索引加到alias idx中,同时将old_idx移出

  1. # POST _aliases
  2. {
  3. "actions" : [
  4. { "remove" : { "index" : "old_idx", "alias" : "idx" } },
  5. { "add" : { "index" : "idx-20*", "alias" : "idx" } }
  6. ]
  7. }