0Pricing
Elasticsearch & Full Text Search Systems · Pelajaran

Keamanan Tingkat Bidang dan Dokumen

Terapkan keamanan terperinci dengan membatasi akses ke bidang tertentu atau bahkan dokumen individual berdasarkan peran pengguna.

Keamanan Tingkat Bidang dan Dokumen adalah pelajaran Elasticsearch & Full Text Search Systems gratis di CoddyKit. Ini adalah pelajaran 2 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Elasticsearch & Full Text Search Systems, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Elasticsearch & Full Text Search Systems mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

Why Fine-Grained Security?

In Elasticsearch, you might not want every user to see all data. Sometimes, certain users should only access specific parts of documents or only a subset of documents.

This is where fine-grained security comes in. It allows you to control access at a much more detailed level than just index permissions.

What is Field Level Security (FLS)?

Field Level Security (FLS) lets you restrict which fields within a document a user can see. Imagine a product document with many fields.

  • A sales agent might only need to see product_name and price.
  • An inventory manager might need quantity and supplier_id.

FLS ensures users only retrieve the fields relevant to their role, hiding sensitive or irrelevant data.

Configuring FLS in Roles

FLS is configured within a user's role definition. You specify which fields are granted (allowed) or excepted (disallowed) for specific indices.

Using grant is generally safer as it follows a whitelist approach, only allowing explicitly listed fields.

{
  "applications": [],
  "cluster": [],
  "indices": [
    {
      "names": ["products"],
      "privileges": ["read"],
      "field_security": {
        "grant": ["product_name", "price"]
      }
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {}
}

FLS Example: Product Viewer Role

Let's create a role named product_viewer. Users with this role can read documents from the products index, but only see the product_name and price fields.

Other fields like internal_cost or supplier_secret would be hidden.

PUT /_security/role/product_viewer
{
  "indices": [
    {
      "names": ["products"],
      "privileges": ["read"],
      "field_security": {
        "grant": ["product_name", "price"]
      }
    }
  ]
}

What is Document Level Security (DLS)?

Document Level Security (DLS) allows you to restrict which documents a user can see. Instead of hiding fields, DLS filters entire documents based on a query.

For example, a regional sales manager should only see sales orders from their specific region, not from other regions.

Configuring DLS in Roles

DLS is configured in a role using a query object. This query acts as a filter that is automatically applied to all search requests made by users assigned to that role.

Only documents matching this query will be returned to the user, regardless of their original search request.

{
  "applications": [],
  "cluster": [],
  "indices": [
    {
      "names": ["sales_data"],
      "privileges": ["read"],
      "query": {
        "term": { "region.keyword": "east" }
      }
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {}
}

DLS Example: East Region Sales

Let's create a role named east_sales_manager. Users with this role can read documents from the sales_data index, but only those documents where the region field is east.

This effectively isolates sales data by region.

PUT /_security/role/east_sales_manager
{
  "indices": [
    {
      "names": ["sales_data"],
      "privileges": ["read"],
      "query": {
        "term": { "region.keyword": "east" }
      }
    }
  ]
}

Combining FLS and DLS

You can apply both Field Level Security and Document Level Security within a single role definition.

This means a user could be restricted to seeing only specific fields, AND only specific documents that match a filter query. This offers a very powerful way to create fine-grained access control.

Best Practices for FLS/DLS

When implementing FLS and DLS:

  • Design roles carefully: Plan out exactly what each user group needs to see.
  • Test thoroughly: Always verify that your roles provide the intended level of access, and nothing more.
  • Use `grant` for FLS: Whitelisting fields is generally more secure than blacklisting.
  • Keep DLS queries simple: Complex queries can impact performance.
  • Least privilege: Always grant the minimum necessary permissions.

Quick Check: Security Features

Which of the following statements about Elasticsearch Field and Document Level Security are true?

Recap: Fine-Grained Security

You've learned about Field Level Security (FLS) for restricting visible fields and Document Level Security (DLS) for filtering documents based on queries.

These powerful features, configured within user roles, enable you to create highly granular access control, ensuring users only see the data they are authorized for. This is crucial for maintaining data privacy and security in your Elasticsearch cluster.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Keamanan Tingkat Bidang dan Dokumen” gratis?

Ya — teks lengkap “Keamanan Tingkat Bidang dan Dokumen” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Elasticsearch & Full Text Search Systems, upgrade ke CoddyKit PRO. Kursus Elasticsearch & Full Text Search Systems mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Keamanan Tingkat Bidang dan Dokumen”?

Terapkan keamanan terperinci dengan membatasi akses ke bidang tertentu atau bahkan dokumen individual berdasarkan peran pengguna. Kamu berlatih Elasticsearch & Full Text Search Systems dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Elasticsearch & Full Text Search Systems?

Tidak diperlukan pengalaman sebelumnya. Elasticsearch & Full Text Search Systems di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 2 dari 4.

Berapa lama pelajaran “Keamanan Tingkat Bidang dan Dokumen” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Elasticsearch & Full Text Search Systems ini?

Ya. Setiap pelajaran Elasticsearch & Full Text Search Systems menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Autentikasi Pengguna dan Peran
  2. Keamanan Tingkat Bidang dan Dokumen
  3. TLS/SSL dan Keamanan Jaringan
  4. Kunci API dan Pencatatan Audit
← Kembali ke Elasticsearch & Full Text Search Systems