https://www.elastic.co/guide/en/elasticsearch/reference/6.3/docs-reindex.html

Reindex does not attempt to set up the destination index. It does not copy the settings of the source index. You should set up the destination index prior to running a _reindex action, including setting up mappings, shard counts, replicas, etc.

Reindex不会去配置目标index。它不会复制来源index的配置。你应当在运行_reindex命令前,先配置目标index。

Reindex命令不会复本来源index的配置到目标index,所以我们要先配置目标index。

一般需要对目标index先配置好 mappings, 分片数量、冗余数量等

  1. POST _reindex
  2. {
  3. "source": {
  4. "index": "source",
  5. "size": 5000
  6. },
  7. "dest": {
  8. "index": "dest",
  9. "routing": "=cat"
  10. }
  11. }
  1. POST _reindex
  2. {
  3. "source": {
  4. "index": "twitter"
  5. },
  6. "dest": {
  7. "index": "new_twitter",
  8. "version_type": "external"
  9. },
  10. "script": {
  11. "source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
  12. "lang": "painless"
  13. }
  14. }
文档更新时间: 2019-07-09 11:03   作者:admin