reindex를 사용하는 이유

Elasticsearch를 사용하다 보면 ilm(Index life management)로 인하여 일정 기간이 지나면 인덱스가 지워집니다. 그러한 상황에서 중요한 로그 데이터를 보관하기 위해서 기존의 인덱스를 복사해 두는 것이 중요합니다. 이럴 때 사용하는 것이 reindex입니다.

 

사용방법

api POST http://localhost:9200/_reindex
header Content-type: application/json
body {
  "source": {
    "index": "기존_인덱스_명"
  },
  "dest": {
    "index": "변경할_인덱스_명"
  }
}

 

reindex를 사용했던 상황

로그의 내용을 분석하기 위해 ilm을 통해 로그 인덱스가 삭제 되지 않도록 인덱스명 변경하기

api POST http://localhost:9200/_reindex
header Content-type: application/json
body {
  "source": {
    "index": "my-log-index-2021-08-24"
  },
  "dest": {
    "index": "backup-log-index"
  }
}

 

참조

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

 

Reindex API | Elasticsearch Guide [7.14] | Elastic

Deprecated in 7.6. Sort in reindex is deprecated. Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements. If used in combination with max_docs, conside

www.elastic.co

 

+ Recent posts