elasticsearch | pipeline & reindex

Myeon·2020년 9월 25일
0

elastic search

목록 보기
1/3
post-thumbnail

todolist
1. @timestamp 참조하여 localDate field 생성 (UTC, +09:00)
2. create date index name pipeline
3. reindex using a pipeline

References
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/date-index-name-processor.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/date-processor.html#date-processor
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/docs-reindex.html

PUT _ingest/pipeline/pipeline_test
{
  "description" : "...",
  "processors" : [
    {
      "date" : {
        "field" : "@timestamp", // refer field
        "target_field" : "localDate", // new field
        "formats" : ["yyyy-MM-dd"],
        "timezone" : "UTC"
      }
    }
  ]
}
PUT _ingest/pipeline/pipeline_test-daily
{
  "description": "for create localDate field and reindex daily", 
  "processors" : [
    {
      "date_index_name" : {
        "field": "@timestamp",
        "timezone": "+09:00", 
        "index_name_prefix" : "test-",
        "index_name_format" : "yyyy-MM-dd",
        "date_rounding" : "d"
      }
    }
  ]
}
POST _reindex
{
  "source": {
    "index": "reindex 대상"
  },
  "dest": {
    "index": "new index",
    "pipeline": "test-pipeline"
  }
}

0개의 댓글