Elasticsearch & Full Text Search Systems · บทเรียน

การจัดการวงจรชีวิตดัชนี

ทำให้การเลื่อนอายุของดัชนีผ่านระยะร้อน อุ่น เย็น และลบเป็นไปโดยอัตโนมัติด้วยนโยบาย ILM เพื่อควบคุมต้นทุนและประสิทธิภาพในระดับใหญ่

บทเรียน 4 จาก 413 ขั้นตอน

การจัดการวงจรชีวิตดัชนี เป็นบทเรียน Elasticsearch & Full Text Search Systems ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Elasticsearch & Full Text Search Systems และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Elasticsearch & Full Text Search Systems มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Data Gets Old

Time-based data like logs and metrics keeps growing. Recent data is queried constantly; old data rarely. Index Lifecycle Management (ILM) automates moving indices through phases so you spend resources only where they matter.

The Four Phases

ILM defines up to four phases:

  • Hot: actively written and queried.
  • Warm: no longer written, still queried.
  • Cold: rarely queried, kept cheaply.
  • Delete: removed.

Rollover

In the hot phase, rollover starts a fresh index when the current one hits a size, document count, or age limit. This keeps individual shards a manageable size.

"rollover": {
  "max_size": "50gb",
  "max_age": "7d"
}

Defining a Policy

An ILM policy lists each phase and its min_age and actions. Here data moves to warm after 7 days and is deleted after 30.

PUT _ilm/policy/logs_policy
{
  "policy": { "phases": {
    "hot":  { "actions": { "rollover": { "max_age": "1d" } } },
    "warm": { "min_age": "7d",  "actions": {} },
    "delete": { "min_age": "30d", "actions": { "delete": {} } }
  }}
}

Warm Phase Actions

In warm you can shrink the index to fewer shards, forcemerge segments for query efficiency, and move shards to cheaper warm nodes via allocation.

"warm": {
  "actions": {
    "forcemerge": { "max_num_segments": 1 },
    "shrink": { "number_of_shards": 1 }
  }
}

Cold and Frozen

The cold phase can store data as searchable snapshots on object storage, drastically cutting cost while keeping it queryable. The frozen tier takes this even further for archival data.

Attaching to an Index

A policy is linked to indices through an index template, so newly rolled-over indices inherit it automatically.

PUT _index_template/logs_template
{
  "index_patterns": ["logs-*"],
  "template": { "settings": {
    "index.lifecycle.name": "logs_policy"
  }}
}

Data Streams

Data streams are the modern way to manage append-only time-series data with ILM. They hide rollover behind a single write alias, so you just index into the stream name.

Monitoring ILM

Use the explain lifecycle API to see which phase each index is in and whether any step is stuck or errored.

GET logs-*/_ilm/explain

Cost and Performance Wins

ILM lets hot data live on fast SSD nodes while old data drifts to cheap storage and is eventually deleted automatically. This is the backbone of cost-effective, large-scale time-series clusters.

Best Practices

Roll over on size to keep shards near 30-50 GB, forcemerge only once writes stop, test policies on a sample index, and always pair ILM with snapshots for true backups (delete is permanent).

Quick Check

Test your understanding of ILM.

Recap

You learned to automate index aging:

  • ILM moves indices through hot, warm, cold, and delete phases by age.
  • Rollover keeps shards manageable; warm actions shrink and forcemerge.
  • Cold/frozen tiers use searchable snapshots for cheap storage.
  • Attach policies via templates, use data streams for time-series, and pair ILM with real snapshots.
เริ่มต้นได้ฟรี

เรียนรู้ Elasticsearch & Full Text Search Systems ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “การจัดการวงจรชีวิตดัชนี” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การจัดการวงจรชีวิตดัชนี” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Elasticsearch & Full Text Search Systems ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Elasticsearch & Full Text Search Systems มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การจัดการวงจรชีวิตดัชนี”

ทำให้การเลื่อนอายุของดัชนีผ่านระยะร้อน อุ่น เย็น และลบเป็นไปโดยอัตโนมัติด้วยนโยบาย ILM เพื่อควบคุมต้นทุนและประสิทธิภาพในระดับใหญ่ คุณปฏิบัติ Elasticsearch & Full Text Search Systems ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Elasticsearch & Full Text Search Systems หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Elasticsearch & Full Text Search Systems บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “การจัดการวงจรชีวิตดัชนี” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Elasticsearch & Full Text Search Systems นี้ได้ไหม

ได้ บทเรียน Elasticsearch & Full Text Search Systems ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ความสามารถด้านการค้นหาเชิงภูมิศาสตร์
  2. การจัดการข้อมูลอนุกรมเวลา
  3. กลยุทธ์การนำระบบขึ้นใช้งานจริง
  4. การจัดการวงจรชีวิตดัชนี
← กลับไปที่ Elasticsearch & Full Text Search Systems