Elasticsearch & Full Text Search Systems · Lekcja

Zarządzanie cyklem życia indeksów

Zautomatyzują Państwo starzenie indeksów przez fazy hot, warm, cold i delete za pomocą zasad ILM, kontrolując koszty i wydajność na dużą skalę.

Lekcja 4 z 413 kroki

Zarządzanie cyklem życia indeksów to bezpłatna lekcja Elasticsearch & Full Text Search Systems na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Elasticsearch & Full Text Search Systems, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Elasticsearch & Full Text Search Systems zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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.
Bezpłatny start

Ucz się Elasticsearch & Full Text Search Systems dzięki korepetycjom AI — za darmo

Pisz i uruchamiaj kod w przeglądarce, otrzymuj natychmiastową pomoc od korepetytora AI dostępnego 24/7 i kontynuuj naukę w sieci lub w aplikacji.

Kursy
12
Lekcje
48

Często zadawane pytania

Czy lekcja „Zarządzanie cyklem życia indeksów” jest bezpłatna?

Tak — pełny tekst „Zarządzanie cyklem życia indeksów” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Elasticsearch & Full Text Search Systems, przejdź na CoddyKit PRO. Kurs Elasticsearch & Full Text Search Systems zawiera 4 lekcji w sumie.

Co nauczysz się w „Zarządzanie cyklem życia indeksów”?

Zautomatyzują Państwo starzenie indeksów przez fazy hot, warm, cold i delete za pomocą zasad ILM, kontrolując koszty i wydajność na dużą skalę. Ćwiczysz Elasticsearch & Full Text Search Systems z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Elasticsearch & Full Text Search Systems?

Nie wymagamy żadnego doświadczenia. Elasticsearch & Full Text Search Systems w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.

Ile czasu zajmuje lekcja „Zarządzanie cyklem życia indeksów”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Elasticsearch & Full Text Search Systems?

Tak. Każda lekcja Elasticsearch & Full Text Search Systems zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Możliwości wyszukiwania geoprzestrzennego
  2. Zarządzanie danymi szeregów czasowych
  3. Strategie wdrażania produkcyjnego
  4. Zarządzanie cyklem życia indeksów
← Powrót do Elasticsearch & Full Text Search Systems