Graphrt

Elasticsearch

Pencarian Query DSL, count dan ES|QL, get dan multi get dokumen, kesehatan cluster, index dan mapping (ApiKey atau basic). Penulisan oleh agent harus diizinkan, hapus dan bulk hanya lewat node, index sistem tertutup untuk agent

Beta v0.1.0 Node.js 16 aksi
Pakai di Graphrt Desktop

Tentang

Plugin Graphrt untuk Elasticsearch REST API, mencakup pencarian Query DSL, count, ES|QL, membaca dan menulis dokumen, serta metadata index. Bisa dipakai dengan cluster yang dikelola sendiri (8.x dan 9.x), deployment Elastic Cloud dan Elastic Cloud Serverless. Dibuat dengan lapisan REST deklaratif (definition.mjs).

Yang bisa dilakukan

  • Cluster and indices: get_cluster_info, get_cluster_health, list_indices (_cat/indices as JSON, open and closed indices, hidden and system indices are left out), get_mapping
  • Search: search (Query DSL, sort, search_after, _source filtering, aggregations, highlight, kNN), count, esql_query (ES|QL with ? parameters, agents need an opt-in)
  • Documents: get_document, multi_get, index_document (PUT by id), create_document (generated id), update_document (partial doc merge, optional upsert, no scripts), delete_document (node only), delete_by_query (node only), bulk (NDJSON lines, node only)
  • api_request: any other endpoint, e.g. /<index>/_settings (agents: GET only, on an allowlist)

Aksi

Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.

  • Cluster info elasticsearch.get_cluster_info
  • Cluster health elasticsearch.get_cluster_health
  • List indices elasticsearch.list_indices
  • Get mapping elasticsearch.get_mapping
  • Search elasticsearch.search
  • Count elasticsearch.count
  • ES|QL query elasticsearch.esql_query
  • Get document elasticsearch.get_document
  • Get documents elasticsearch.multi_get
  • Index document elasticsearch.index_document
Tampilkan semua 16 aksi
  • Create document elasticsearch.create_document
  • Update document elasticsearch.update_document
  • Delete document elasticsearch.delete_document
  • Delete by query elasticsearch.delete_by_query
  • Bulk elasticsearch.bulk
  • Elasticsearch REST API request elasticsearch.api_request

Pengaturan

Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.

  • ELASTICSEARCH_URL Opsional
    Cluster URL, default http://localhost:9200. Must be https:// (plain http:// only for localhost), no credentials in it.
  • ELASTICSEARCH_API_KEY One auth
    API key, sent as Authorization: ApiKey <key> (the base64 "encoded" value)
  • ELASTICSEARCH_USERNAME One auth
    Basic auth, used when no API key is set
  • ELASTICSEARCH_TOOL_ALLOW_WRITES Opsional
    1 lets agent tools index, create and update documents
  • ELASTICSEARCH_TOOL_ALLOW_ESQL Opsional
    1 lets agent tools run esql_query (its sources are checked, see Agent policy)
  • ELASTICSEARCH_TOOL_API_EXTRA_PATHS Opsional
    More read paths for agent api_request, comma-separated, * = one segment
  • ELASTICSEARCH_PASSWORD

Cara memakainya

Di Graphrt Desktop

  1. Buka Plugins dan cari Elasticsearch.
  2. Klik Install lalu setujui.
  3. Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
  4. Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Plugin di Graphrt Desktop

Dengan CLI

terminal
$ graphrt plugin install elasticsearch
workflow.yaml
- id: errors
  type: elasticsearch.search
  index: logs-*
  size: 20
  query: { bool: { filter: [ { term: { level: error } }, { range: { "@timestamp": { gte: now-1h } } } ] } }
  sort: [ { "@timestamp": desc } ]
- id: by_host
  type: elasticsearch.esql_query
  query: "FROM logs-* | WHERE level == ? | STATS c = COUNT(*) BY host.name | SORT c DESC | LIMIT 10"
  params: [error]
- id: save
  type: elasticsearch.index_document
  index: incidents
  doc_id: "{{#run.id#}}"
  document: { summary: "{{#summary.text#}}" }
  refresh: wait_for
Plugin di docs