banner
Sep 1, 2022
99 Views

Tự động thêm thời gian tạo bản ghi Elasticsearch

Written by
banner

Chạy lệnh sau để mỗi khi dùng pipeline timestamp thì tự động có thể thông tin created date

PUT _ingest/pipeline/timestamp
{
  "description": "Adds timestamp to documents",
  "processors": [
    {
      "set": {
        "field": "_source.created_time",
        "value": "{{_ingest.timestamp}}"
      }
    }
  ]
}

Sau đó chạy lệnh sau để test

POST my-index-000001/_doc?pipeline=timestamp
{
  "user": {
    "id": "kimchy"
  }
}

GET /my-index-000001/_search
{
  "query":{
    "match_all":{}
  }
}

Kết quả:

Article Tags:
·
Article Categories:
config
banner

Leave a Reply

Your email address will not be published. Required fields are marked *