Closed2

elasticsearchのreindexを試す

bookstorebookstore

reindex をやってみる

demo-index-1 に一つドキュメントを保存して、 demo-index-2 にコピーしてみた。

PUT demo-index-1

POST demo-index-1/_doc
{
  "name": "bookstore",
  "age": 28
}

PUT demo-index-2

POST _reindex
{
  "source": {
    "index": "demo-index-1"
  },
  "dest": {
    "index": "demo-index-2"
  }
}

GET demo-index-2/_search
{
  "query": {
    "match_all": {}
  }
}

// RESPONSE
{
  "took" : 838,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "demo-index-2",
        "_id" : "vIezWH8B7IGaZjsDWOLo",
        "_score" : 1.0,
        "_source" : {
          "name" : "bookstore",
          "age" : 28
        }
      }
    ]
  }
}
このスクラップは2022/03/06にクローズされました