api

package
v4.0.0-7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package api provides service interfaces for interacting with OpenSearch REST API endpoints.

The api package contains 16 service interfaces, each corresponding to a major OpenSearch feature area:

  • DocumentService: Document CRUD operations
  • SearchService: Search, count, scroll, and validate operations
  • IndicesService: Index lifecycle and settings management
  • ClusterService: Cluster health, state, and settings
  • NodesService: Node information and statistics
  • CatService: Human-readable cluster information (_cat APIs)
  • IngestService: Ingest pipeline management
  • SnapshotService: Snapshot and repository management
  • TasksService: Task management and monitoring
  • ScriptService: Script management
  • SecurityService: Security plugin operations (roles, users, tenants)
  • IsmService: Index State Management operations
  • SmService: Snapshot Management operations
  • AlertingService: Alerting monitor operations
  • TransformService: Transform job operations
  • CcrService: Cross-Cluster Replication operations

Accessing Services

Services are accessed through the root Client interface:

client, err := opensearch.New(&opensearch.Config{
    URL:      "https://localhost:9200",
    Username: "admin",
    Password: "admin",
})
if err != nil {
    log.Fatal(err)
}

// Index a document
doc := map[string]any{
    "title": "My Document",
    "tags":  []string{"example", "test"},
}
resp, err := client.Document().Index(ctx, "my-index", "doc-1", doc, nil)

// Search for documents
query := map[string]any{
    "query": map[string]any{
        "match": map[string]any{
            "title": "Document",
        },
    },
}
result, err := client.Search().Search(ctx, []string{"my-index"}, query, nil)

Request Parameters

Many methods accept a params parameter (map[string]string) for query string arguments. Common parameters include:

params := map[string]string{
    "routing":               "custom-routing",
    "wait_for_active_shards": "2",
    "refresh":               "true",
    "timeout":               "5s",
}

Refer to the OpenSearch documentation for all available parameters for each API endpoint.

Example (SearchWithPIT)

Example_searchWithPIT demonstrates how to paginate through all documents in an index using a Point In Time (PIT) context and search_after.

The pattern is:

  1. Create a PIT for the target index.
  2. Defer a call to DeletePIT so the PIT is released when the function returns.
  3. Issue successive Search requests using the PIT id and search_after, advancing the cursor with the sort values of the last hit, until no hits are returned.
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/disaster37/opensearch/v4/api"
)

func main() {
	ctx := context.Background()

	var searchSvc api.SearchService
	if searchSvc == nil {
		fmt.Println("SearchService.SearchWithPIT(ctx, *SearchRequest)")
		return
	}

	// 1. Create a PIT that stays alive for 2 minutes.
	pitResp, err := searchSvc.CreatePIT(ctx, &api.CreatePITRequest{
		Indices:   []string{"my-index"},
		KeepAlive: "2m",
	})
	if err != nil {
		log.Fatal(err)
	}
	pitId := pitResp.PitId

	// 2. Defer deletion of the PIT so cluster resources are freed even on early return.
	defer func() {
		_, _ = searchSvc.DeletePIT(ctx, &api.DeletePITRequest{
			PitIds: []string{pitId},
		})
	}()

	// 3. Iterate using search_after until no more hits arrive.
	const pageSize = 100
	var searchAfter []any // nil on first request
	totalDocs := 0

	for {
		body := map[string]any{
			// Attach the PIT to the request body instead of specifying an index.
			"pit": map[string]any{
				"id":         pitId,
				"keep_alive": "2m", // extend the PIT on every page
			},
			"query": map[string]any{
				"match_all": map[string]any{},
			},
			// A tie-breaker sort is required for deterministic search_after pagination.
			// "_shard_doc" is a synthetic field available in PIT searches.
			"sort": []map[string]any{
				{"@timestamp": map[string]any{"order": "asc"}},
				{"_shard_doc": map[string]any{"order": "asc"}},
			},
			"size": pageSize,
		}

		if searchAfter != nil {
			body["search_after"] = searchAfter
		}

		result, err := searchSvc.Search(ctx, &api.SearchRequest{
			// No Indices field – the index is encoded in the PIT id.
			Body: body,
		})
		if err != nil {
			log.Fatal(err)
		}

		hits := result.Hits.Hits
		if len(hits) == 0 {
			break // all pages consumed
		}

		for _, hit := range hits {
			_ = hit // process each document here
			totalDocs++
		}

		// Advance the cursor to the sort values of the last hit on this page.
		searchAfter = hits[len(hits)-1].Sort
	}

	fmt.Printf("iterated %d documents via PIT pagination\n", totalDocs)
}
Output:
SearchService.SearchWithPIT(ctx, *SearchRequest)

Index

Examples

Constants

View Source
const (
	ExpandWildcardOpen   = "open"
	ExpandWildcardClosed = "closed"
	ExpandWildcardNone   = "none"
	ExpandWildcardAll    = "all"
)

ExpandWildcard values. Can be combined (e.g. "open,closed").

Variables

This section is empty.

Functions

This section is empty.

Types

type AdDeleteDetectorResponse

type AdDeleteDetectorResponse struct {
	Index   *string `json:"_index,omitempty"`
	ID      *string `json:"_id,omitempty"`
	Version *int64  `json:"_version,omitempty"`
	Result  *string `json:"result,omitempty"`
}

AdDeleteDetectorResponse represents the response from deleting an anomaly detector.

type AdDetector

type AdDetector struct {
	Name               string           `json:"name"`
	Description        *string          `json:"description,omitempty"`
	TimeField          string           `json:"time_field,omitempty"`
	Indices            []string         `json:"indices,omitempty"`
	FeatureAttributes  []map[string]any `json:"feature_attributes,omitempty"`
	DetectionInterval  map[string]any   `json:"detection_interval,omitempty"`
	DetectionDateRange map[string]any   `json:"detection_date_range,omitempty"`
	FilterQuery        map[string]any   `json:"filter_query,omitempty"`
	UiMetadata         map[string]any   `json:"ui_metadata,omitempty"`
	SchemaVersion      *int64           `json:"schema_version,omitempty"`
	LastUpdateTime     *int64           `json:"last_update_time,omitempty"`
	CurState           *string          `json:"cur_state,omitempty"`
	StateError         *string          `json:"state_error,omitempty"`
}

AdDetector represents an anomaly detector definition.

type AdExecuteDetectorResponse

type AdExecuteDetectorResponse struct {
	AnomalyGrade  float64          `json:"anomaly_grade,omitempty"`
	Confidence    float64          `json:"confidence,omitempty"`
	DataStartTime string           `json:"data_start_time,omitempty"`
	DataEndTime   string           `json:"data_end_time,omitempty"`
	Features      []map[string]any `json:"features,omitempty"`
}

AdExecuteDetectorResponse represents the response from executing an anomaly detector.

type AdGetDetectorResponse

type AdGetDetectorResponse struct {
	Id             string     `json:"_id,omitempty"`
	Version        int64      `json:"_version,omitempty"`
	SequenceNumber int64      `json:"_seq_no,omitempty"`
	PrimaryTerm    int64      `json:"_primary_term,omitempty"`
	Detector       AdDetector `json:"anomaly_detector,omitempty"`
}

AdGetDetectorResponse represents the response from getting an anomaly detector.

type AdIndexDetectorRequest

type AdIndexDetectorRequest struct {
	DetectorId string
	Body       any `validate:"required"`
}

AdIndexDetectorRequest holds the parameters for creating or updating an anomaly detector.

func (*AdIndexDetectorRequest) Validate

func (r *AdIndexDetectorRequest) Validate() error

Validate validates the AdIndexDetectorRequest.

type AdIndexDetectorResponse

type AdIndexDetectorResponse struct {
	Id             string     `json:"_id,omitempty"`
	Version        int64      `json:"_version,omitempty"`
	SequenceNumber int64      `json:"_seq_no,omitempty"`
	PrimaryTerm    int64      `json:"_primary_term,omitempty"`
	Detector       AdDetector `json:"anomaly_detector,omitempty"`
}

AdIndexDetectorResponse represents the response from creating, updating, or getting an anomaly detector. The same envelope shape is returned by both the index/update and the get endpoints, so it is reused for GetDetector.

type AdPreviewDetectorResponse

type AdPreviewDetectorResponse struct {
	AnomalyResult []map[string]any `json:"anomaly_result,omitempty"`
}

AdPreviewDetectorResponse represents the response from previewing an anomaly detector.

type AdSearchDetectorsResponse

type AdSearchDetectorsResponse struct {
	Total     int64         `json:"total_anomaly_detectors"`
	Detectors []AdSearchHit `json:"anomaly_detectors"`
}

AdSearchDetectorsResponse wraps the search detectors hits.

type AdSearchHit

type AdSearchHit struct {
	Id     string     `json:"_id"`
	Source AdDetector `json:"detector"`
}

AdSearchHit represents a single detector search hit.

type AdSearchResultsResponse

type AdSearchResultsResponse struct {
	Total   int64            `json:"total_results"`
	Results []map[string]any `json:"results"`
}

AdSearchResultsResponse wraps the search anomaly results. The same envelope shape (`total_results` + `results`) is returned by both the regular and the top-anomalies endpoints, so SearchTopResults also returns this type.

type AdService

type AdService interface {
	IndexDetector(ctx context.Context, req *AdIndexDetectorRequest) (*AdIndexDetectorResponse, error)
	GetDetector(ctx context.Context, detectorId string) (*AdIndexDetectorResponse, error)
	DeleteDetector(ctx context.Context, detectorId string) (*AdDeleteDetectorResponse, error)
	ExecuteDetector(ctx context.Context, detectorId string, body any) (*AdExecuteDetectorResponse, error)
	PreviewDetector(ctx context.Context, detectorId string, body any) (*AdPreviewDetectorResponse, error)
	SearchDetectors(ctx context.Context, body any) (*AdSearchDetectorsResponse, error)
	SearchResults(ctx context.Context, body any) (*AdSearchResultsResponse, error)
	SearchTopResults(ctx context.Context, detectorId string, body any) (*AdSearchResultsResponse, error)
	AdStats(ctx context.Context, stat string) (*AdStatsResponse, error)
	ValidateDetector(ctx context.Context, body any) (*AdValidateResponse, error)
}

AdService defines the interface for interacting with the OpenSearch Anomaly Detection plugin.

func NewAdService

func NewAdService(client *resty.Client, logger *logrus.Entry) AdService

NewAdService creates a new AdService with the given REST client and logger.

type AdStatsResponse

type AdStatsResponse map[string]any

AdStatsResponse represents anomalies detection stats.

type AdValidateResponse

type AdValidateResponse struct {
	Error   *string `json:"error,omitempty"`
	Message *string `json:"message,omitempty"`
}

AdValidateResponse represents the result of validating an anomaly detector.

type AddBlockRequest

type AddBlockRequest struct {
	Indices []string `validate:"required,min=1"`
	Block   string   `validate:"required"`
}

func (*AddBlockRequest) Validate

func (r *AddBlockRequest) Validate() error

type AlertingAcknowledgeAlertResponse

type AlertingAcknowledgeAlertResponse struct {
	MissingAlertIds      []string                    `json:"missing_alert_ids,omitempty"`
	FailedAlertIds       []string                    `json:"failed_alert_ids,omitempty"`
	AcknowledgedAlertIds []AlertingAcknowledgedAlert `json:"acknowledged_alerts,omitempty"`
}

AlertingAcknowledgeAlertResponse represents the result of acknowledging alerts.

type AlertingAcknowledgedAlert

type AlertingAcknowledgedAlert struct {
	Id      string         `json:"_id"`
	Version int64          `json:"_version"`
	Source  map[string]any `json:"_source,omitempty"`
}

AlertingAcknowledgedAlert represents a single acknowledged alert.

type AlertingAlert

type AlertingAlert struct {
	Id               string           `json:"id"`
	MonitorId        string           `json:"monitor_id"`
	MonitorVersion   int64            `json:"monitor_version,omitempty"`
	MonitorName      string           `json:"monitor_name"`
	State            string           `json:"state"`
	Severity         string           `json:"severity,omitempty"`
	TriggerName      string           `json:"trigger_name,omitempty"`
	StartTime        string           `json:"start_time,omitempty"`
	EndTime          string           `json:"end_time,omitempty"`
	AcknowledgedTime string           `json:"acknowledged_time,omitempty"`
	ErrorMessage     string           `json:"error_message,omitempty"`
	AlertHistory     []map[string]any `json:"alert_history,omitempty"`
}

AlertingAlert represents a single alert.

type AlertingDeleteMonitorResponse

type AlertingDeleteMonitorResponse struct {
	Index          *string        `json:"_index,omitempty"`
	ID             *string        `json:"_id,omitempty"`
	Version        *int64         `json:"_version,omitempty"`
	Result         *string        `json:"result,omitempty"`
	ForcedRefresh  *bool          `json:"forced_refresh,omitempty"`
	Shards         map[string]any `json:"_shards,omitempty"`
	SequenceNumber *int64         `json:"_seq_no,omitempty"`
	PrimaryTerm    *int64         `json:"_primary_term,omitempty"`
}

AlertingDeleteMonitorResponse represents the response from the Alerting delete monitor API, confirming the deletion with the document ID, version, and result status.

type AlertingDeleteWorkflowResponse

type AlertingDeleteWorkflowResponse struct {
	Index          *string        `json:"_index,omitempty"`
	ID             *string        `json:"_id,omitempty"`
	Version        *int64         `json:"_version,omitempty"`
	Result         *string        `json:"result,omitempty"`
	ForcedRefresh  *bool          `json:"forced_refresh,omitempty"`
	Shards         map[string]any `json:"_shards,omitempty"`
	SequenceNumber *int64         `json:"_seq_no,omitempty"`
	PrimaryTerm    *int64         `json:"_primary_term,omitempty"`
}

AlertingDeleteWorkflowResponse represents the response from deleting a workflow.

type AlertingDestination

type AlertingDestination struct {
	Id              string `json:"id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	SchemaVersion   int64  `json:"schema_version,omitempty"`
	SeqNo           int64  `json:"seq_no,omitempty"`
	PrimaryTerm     int64  `json:"primary_term,omitempty"`
	LastUpdatedTime string `json:"last_update_time,omitempty"`
}

AlertingDestination represents a single notification destination.

type AlertingExecuteMonitorResponse

type AlertingExecuteMonitorResponse struct {
	MonitorName    string         `json:"monitor_name,omitempty"`
	PeriodStart    string         `json:"period_start,omitempty"`
	PeriodEnd      string         `json:"period_end,omitempty"`
	Error          *string        `json:"error,omitempty"`
	InputResults   map[string]any `json:"input_results,omitempty"`
	TriggerResults map[string]any `json:"trigger_results,omitempty"`
}

AlertingExecuteMonitorResponse represents the response from executing a monitor on-demand.

type AlertingExecuteWorkflowResponse

type AlertingExecuteWorkflowResponse struct {
	ExecutionId    string           `json:"execution_id,omitempty"`
	Error          *string          `json:"error,omitempty"`
	MonitorResults []map[string]any `json:"monitor_results,omitempty"`
}

AlertingExecuteWorkflowResponse represents the response from executing a workflow.

type AlertingFinding

type AlertingFinding struct {
	Id            string           `json:"id"`
	RelatedDocIds []string         `json:"related_doc_ids,omitempty"`
	Index         string           `json:"index"`
	MonitorId     string           `json:"monitor_id"`
	MonitorName   string           `json:"monitor_name"`
	QueryIds      []string         `json:"query_ids,omitempty"`
	Timestamp     string           `json:"timestamp,omitempty"`
	DocumentList  []map[string]any `json:"document_list,omitempty"`
}

AlertingFinding represents a single alerting finding.

type AlertingGetAlertsResponse

type AlertingGetAlertsResponse struct {
	TotalAlerts int             `json:"totalAlerts"`
	Alerts      []AlertingAlert `json:"alerts"`
}

AlertingGetAlertsResponse represents the response from the get alerts API.

type AlertingGetDestinationsResponse

type AlertingGetDestinationsResponse struct {
	TotalDestinations int                   `json:"totalDestinations"`
	Destinations      []AlertingDestination `json:"destinations"`
}

AlertingGetDestinationsResponse represents destinations from the API.

type AlertingGetFindingsResponse

type AlertingGetFindingsResponse struct {
	TotalFindings int               `json:"total_findings"`
	Findings      []AlertingFinding `json:"findings"`
}

AlertingGetFindingsResponse represents the response from the get findings API.

type AlertingGetMonitor

type AlertingGetMonitor struct {
	AlertingMonitor `json:",inline"`
	EnabledTime     *int64 `json:"enabled_time,omitempty"`
	LastUpdatedTime *int64 `json:"last_updated_time,omitempty"`
}

AlertingGetMonitor represents a monitor as returned from the Alerting GET API, extending AlertingMonitor with enabled time and last updated timestamp.

type AlertingGetMonitorResponse

type AlertingGetMonitorResponse struct {
	Id             string             `json:"_id"`
	Version        int64              `json:"_version"`
	SequenceNumber int64              `json:"_seq_no"`
	PrimaryTerm    int64              `json:"_primary_term"`
	Monitor        AlertingGetMonitor `json:"monitor"`
}

AlertingGetMonitorResponse represents the full response from the Alerting GET monitor API, including the document ID, version, sequence number, primary term, and the monitor definition.

type AlertingGetWorkflowResponse

type AlertingGetWorkflowResponse struct {
	Id             string           `json:"_id"`
	Version        int64            `json:"_version"`
	SequenceNumber int64            `json:"_seq_no"`
	PrimaryTerm    int64            `json:"_primary_term"`
	Workflow       AlertingWorkflow `json:"workflow"`
}

AlertingGetWorkflowResponse represents the full response from the get workflow API.

type AlertingIndexWorkflowRequest

type AlertingIndexWorkflowRequest struct {
	WorkflowId string
	Body       any `validate:"required"`
	Version    *types.DocumentVersion
}

AlertingIndexWorkflowRequest holds the parameters for creating or updating a workflow.

func (*AlertingIndexWorkflowRequest) Validate

func (r *AlertingIndexWorkflowRequest) Validate() error

Validate validates the AlertingIndexWorkflowRequest.

type AlertingMonitor

type AlertingMonitor struct {
	Type        string           `json:"type"`
	Name        string           `json:"name"`
	MonitorType string           `json:"monitor_type"`
	Enabled     *bool            `json:"enabled,omitempty"`
	Schedule    map[string]any   `json:"schedule"`
	Inputs      []map[string]any `json:"inputs"`
	Triggers    []map[string]any `json:"triggers"`
}

AlertingMonitor represents the definition of an alert monitor in the OpenSearch Alerting plugin, including the monitor type, name, schedule, inputs, and trigger conditions.

type AlertingPutMonitorRequest

type AlertingPutMonitorRequest struct {
	MonitorId string `validate:"required"`
	Body      any    `validate:"required"`
	Version   *types.DocumentVersion
}

func (*AlertingPutMonitorRequest) Validate

func (r *AlertingPutMonitorRequest) Validate() error

type AlertingSearchMonitorHit

type AlertingSearchMonitorHit struct {
	Id     string             `json:"_id"`
	Source AlertingGetMonitor `json:"_source"`
}

AlertingSearchMonitorHit represents a single monitor document returned from the Alerting search monitors API, including the document ID and the monitor source.

type AlertingSearchMonitorHits

type AlertingSearchMonitorHits struct {
	Hits []AlertingSearchMonitorHit `json:"hits"`
}

AlertingSearchMonitorHits contains the list of monitor search results.

type AlertingSearchMonitorResponse

type AlertingSearchMonitorResponse struct {
	Hits AlertingSearchMonitorHits `json:"hits"`
}

AlertingSearchMonitorResponse wraps the hit results from the Alerting search monitors API.

type AlertingService

type AlertingService interface {
	GetMonitor(ctx context.Context, monitorId string) (*AlertingGetMonitorResponse, error)
	PutMonitor(ctx context.Context, req *AlertingPutMonitorRequest) (*AlertingGetMonitorResponse, error)
	PostMonitor(ctx context.Context, body any) (*AlertingGetMonitorResponse, error)
	DeleteMonitor(ctx context.Context, monitorId string) (*AlertingDeleteMonitorResponse, error)
	SearchMonitor(ctx context.Context, body any) ([]AlertingSearchMonitorHit, error)
	ExecuteMonitor(ctx context.Context, monitorId string, body any) (*AlertingExecuteMonitorResponse, error)
	AcknowledgeAlert(ctx context.Context, monitorId string, body any) (*AlertingAcknowledgeAlertResponse, error)
	GetAlerts(ctx context.Context, params map[string]string) (*AlertingGetAlertsResponse, error)
	GetFindings(ctx context.Context, params map[string]string) (*AlertingGetFindingsResponse, error)
	GetDestinations(ctx context.Context, destinationId string) (*AlertingGetDestinationsResponse, error)
	IndexWorkflow(ctx context.Context, req *AlertingIndexWorkflowRequest) (*AlertingGetWorkflowResponse, error)
	GetWorkflow(ctx context.Context, workflowId string) (*AlertingGetWorkflowResponse, error)
	DeleteWorkflow(ctx context.Context, workflowId string) (*AlertingDeleteWorkflowResponse, error)
	ExecuteWorkflow(ctx context.Context, workflowId string, body any) (*AlertingExecuteWorkflowResponse, error)
	GetWorkflowAlerts(ctx context.Context, params map[string]string) (*AlertingGetAlertsResponse, error)
	AcknowledgeChainedAlerts(ctx context.Context, workflowId string, body any) (*AlertingAcknowledgeAlertResponse, error)
}

AlertingService defines the interface for interacting with the OpenSearch Alerting plugin.

func NewAlertingService

func NewAlertingService(client *resty.Client, logger *logrus.Entry) AlertingService

NewAlertingService creates a new AlertingService with the given REST client and logger.

type AlertingWorkflow

type AlertingWorkflow struct {
	Name         string           `json:"name"`
	WorkflowType string           `json:"workflow_type,omitempty"`
	Enabled      *bool            `json:"enabled,omitempty"`
	Schedule     map[string]any   `json:"schedule,omitempty"`
	Inputs       []map[string]any `json:"inputs,omitempty"`
	Triggers     []map[string]any `json:"triggers,omitempty"`
	Monitors     []map[string]any `json:"monitors,omitempty"`
}

AlertingWorkflow represents a workflow definition.

type AsyncSearchGetResponse

type AsyncSearchGetResponse struct {
	AsyncSearchSubmitResponse
}

AsyncSearchGetResponse represents the response from retrieving an asynchronous search by its identifier. It embeds the submit response fields to provide full search status and results.

type AsyncSearchService

type AsyncSearchService interface {
	// Submit submits an asynchronous search. The body parameter contains the
	// search request body, and params holds optional query parameters such as
	// wait_for_completion_timeout, keep_on_completion, and keep_alive.
	Submit(ctx context.Context, body any, params map[string]string) (*AsyncSearchSubmitResponse, error)

	// AsyncGet retrieves the result of a previously submitted asynchronous
	// search by its identifier.
	AsyncGet(ctx context.Context, id string) (*AsyncSearchGetResponse, error)

	// AsyncDelete deletes a stored asynchronous search by its identifier.
	AsyncDelete(ctx context.Context, id string) (*types.AcknowledgedResponse, error)

	// AsyncStats retrieves cluster-level statistics about asynchronous
	// search execution.
	AsyncStats(ctx context.Context) (*AsyncSearchStatsResponse, error)
}

AsyncSearchService provides access to the asynchronous search plugin API. It supports submitting, retrieving, deleting, and monitoring asynchronous searches. See https://opensearch.org/docs/latest/search-plugins/async/.

func NewAsyncSearchService

func NewAsyncSearchService(client *resty.Client, logger *logrus.Entry) AsyncSearchService

NewAsyncSearchService creates a new AsyncSearchService instance.

type AsyncSearchStatsResponse

type AsyncSearchStatsResponse map[string]any

AsyncSearchStatsResponse represents the response from the asynchronous search stats endpoint. The map contains cluster-level statistics about asynchronous search execution.

type AsyncSearchSubmitResponse

type AsyncSearchSubmitResponse struct {
	Id             string         `json:"id,omitempty"`
	State          string         `json:"state,omitempty"`
	StartInMillis  int64          `json:"start_time_in_millis,omitempty"`
	ExpirationTime string         `json:"expiration_time,omitempty"`
	Response       map[string]any `json:"response,omitempty"`
}

AsyncSearchSubmitResponse represents the response from submitting an asynchronous search. It contains the search identifier, state, timing information, expiration time, and the search response if available.

type BulkIndexByScrollResponse

type BulkIndexByScrollResponse struct {
	// Header contains the HTTP response headers from OpenSearch.
	Header http.Header `json:"-"`
	// Took is the total time in milliseconds the operation took.
	Took int64 `json:"took"`
	// SliceId identifies the slice this response belongs to when using sliced scroll.
	SliceId *int64 `json:"slice_id,omitempty"`
	// TimedOut indicates whether the operation timed out.
	TimedOut bool `json:"timed_out"`
	// Total is the number of documents processed by the operation.
	Total int64 `json:"total"`
	// Updated is the number of documents successfully updated (update-by-query).
	Updated int64 `json:"updated,omitempty"`
	// Created is the number of documents created during reindex.
	Created int64 `json:"created,omitempty"`
	// Deleted is the number of documents successfully deleted (delete-by-query).
	Deleted int64 `json:"deleted"`
	// Batches is the number of scroll responses pulled back during the operation.
	Batches int64 `json:"batches"`
	// VersionConflicts is the number of version conflicts encountered.
	VersionConflicts int64 `json:"version_conflicts"`
	// Noops is the number of documents skipped because no changes were needed.
	Noops int64 `json:"noops"`
	// Retries tracks the number of retry attempts made for bulk and search sub-operations.
	Retries struct {
		Bulk   int64 `json:"bulk"`
		Search int64 `json:"search"`
	} `json:"retries,omitempty"`
	// Throttled is the duration string the request was throttled (e.g. "0s").
	Throttled string `json:"throttled"`
	// ThrottledMillis is the time in milliseconds the request was throttled.
	ThrottledMillis int64 `json:"throttled_millis"`
	// RequestsPerSecond is the effective rate limiting value in requests per second.
	RequestsPerSecond float64 `json:"requests_per_second"`
	// Canceled is a non-empty string describing why the operation was canceled, if applicable.
	Canceled string `json:"canceled,omitempty"`
	// ThrottledUntil is a timestamp string indicating when throttling ends.
	ThrottledUntil string `json:"throttled_until"`
	// ThrottledUntilMillis is the remaining throttle time in milliseconds.
	ThrottledUntilMillis int64 `json:"throttled_until_millis"`
	// Failures contains details of individual document-level failures.
	Failures []bulkIndexByScrollResponseFailure `json:"failures"`
}

BulkIndexByScrollResponse represents the result of delete-by-query, update-by-query, and reindex operations. It includes counts of affected documents and any failures encountered.

type BulkResponse

type BulkResponse struct {
	// Took is the total time in milliseconds for the bulk operation.
	Took int `json:"took,omitempty"`
	// Errors indicates whether any individual operation within the bulk request failed.
	Errors bool `json:"errors,omitempty"`
	// Items contains the per-operation results, each keyed by operation type.
	Items []map[string]*BulkResponseItem `json:"items,omitempty"`
}

BulkResponse represents the result of a bulk API request. Each item in Items is keyed by the operation type ("index", "create", "update", "delete").

type BulkResponseItem

type BulkResponseItem struct {
	// Index is the name of the index the operation targeted.
	Index string `json:"_index,omitempty"`
	// Type is the document type (deprecated).
	Type string `json:"_type,omitempty"`
	// Id is the document ID affected by this operation.
	Id string `json:"_id,omitempty"`
	// Version is the document version after the operation.
	Version int64 `json:"_version,omitempty"`
	// Result indicates the outcome (e.g. "created", "updated", "deleted", "not_found").
	Result string `json:"result,omitempty"`
	// Shards provides shard-level acknowledgment.
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
	// SeqNo is the sequence number assigned to this operation.
	SeqNo int64 `json:"_seq_no,omitempty"`
	// PrimaryTerm is the primary term of the shard that processed this operation.
	PrimaryTerm int64 `json:"_primary_term,omitempty"`
	// Status is the HTTP status code for this individual operation.
	Status int `json:"status,omitempty"`
	// ForcedRefresh indicates whether a refresh was forced for this operation.
	ForcedRefresh bool `json:"forced_refresh,omitempty"`
	// Error contains error details if this particular operation failed.
	Error *types.OpenSearchErrorDetails `json:"error,omitempty"`
	// GetResult contains the updated source when requested for an update operation.
	GetResult *GetResult `json:"get,omitempty"`
}

BulkResponseItem represents the result of a single operation within a bulk request.

type CatAliasesResponse

type CatAliasesResponse []CatAliasesResponseRow

CatAliasesResponse is the response type returned by the cat aliases API. Each row represents a single alias-to-index mapping with optional filter and routing configuration.

type CatAliasesResponseRow

type CatAliasesResponseRow struct {
	Alias         string `json:"alias"`
	Index         string `json:"index"`
	Filter        string `json:"filter"`
	RoutingIndex  string `json:"routing.index"`
	RoutingSearch string `json:"routing.search"`
	IsWriteIndex  string `json:"is_write_index"`
}

CatAliasesResponseRow represents a single row in the cat aliases output, containing the alias name, target index, filter expression, routing settings, and whether this alias points to the write index.

type CatAllocationResponse

type CatAllocationResponse []CatAllocationResponseRow

CatAllocationResponse is the response type returned by the cat allocation API. Each row represents a single node's shard allocation and disk usage information.

type CatAllocationResponseRow

type CatAllocationResponseRow struct {
	Shards      int    `json:"shards,string"`
	DiskIndices string `json:"disk.indices"`
	DiskUsed    string `json:"disk.used"`
	DiskAvail   string `json:"disk.avail"`
	DiskTotal   string `json:"disk.total"`
	DiskPercent int    `json:"disk.percent,string"`
	Host        string `json:"host"`
	IP          string `json:"ip"`
	Node        string `json:"node"`
}

CatAllocationResponseRow represents a single row in the cat allocation output, containing shard count, disk usage (indices, used, available, total), percentage, and node identification details.

type CatClusterManager

type CatClusterManager struct {
	IP   string `json:"ip"`
	ID   string `json:"id"`
	Host string `json:"host"`
	Node string `json:"node"`
}

CatClusterManager represents the cluster manager entry.

type CatClusterManagerResponse

type CatClusterManagerResponse []CatClusterManager

CatClusterManagerResponse is a slice with a single cluster manager entry.

type CatCountResponse

type CatCountResponse []CatCountResponseRow

CatCountResponse is the response type returned by the cat count API. Each row contains a document count snapshot for the cluster or specific indices.

type CatCountResponseRow

type CatCountResponseRow struct {
	Epoch     int64  `json:"epoch,string"`
	Timestamp string `json:"timestamp"`
	Count     int    `json:"count,string"`
}

CatCountResponseRow represents a single row in the cat count output, containing the epoch timestamp and total document count.

type CatFielddataResponse

type CatFielddataResponse []CatFielddataResponseRow

CatFielddataResponse is the response type returned by the cat fielddata API. Each row represents fielddata memory usage for a specific field on a specific node.

type CatFielddataResponseRow

type CatFielddataResponseRow struct {
	Id    string `json:"id"`
	Host  string `json:"host"`
	IP    string `json:"ip"`
	Node  string `json:"node"`
	Field string `json:"field"`
	Size  string `json:"size"`
}

CatFielddataResponseRow represents a single row in the cat fielddata output, containing node identification, field name, and memory size used.

type CatHealthResponse

type CatHealthResponse []CatHealthResponseRow

CatHealthResponse is the response type returned by the cat health API. It contains a compact cluster health overview.

type CatHealthResponseRow

type CatHealthResponseRow struct {
	Epoch                    int64  `json:"epoch,string"`
	Timestamp                string `json:"timestamp"`
	Cluster                  string `json:"cluster"`
	Status                   string `json:"status"`
	NodeTotal                int    `json:"node.total,string"`
	NodeData                 int    `json:"node.data,string"`
	Shards                   int    `json:"shards,string"`
	Pri                      int    `json:"pri,string"`
	Relo                     int    `json:"relo,string"`
	Init                     int    `json:"init,string"`
	Unassign                 int    `json:"unassign,string"`
	PendingTasks             int    `json:"pending_tasks,string"`
	MaxTaskWaitTime          string `json:"max_task_wait_time"`
	ActiveShardsPercent      string `json:"active_shards_percent"`
	DiscoveredClusterManager string `json:"discovered_cluster_manager"`
}

CatHealthResponseRow represents a single row in the cat health output, containing cluster name, status, node/shard counts, pending tasks, and the active shard percentage.

type CatIndicesResponse

type CatIndicesResponse []CatIndicesResponseRow

CatIndicesResponse is the response type returned by the cat indices API. Each row contains detailed information about a single index.

type CatIndicesResponseRow

type CatIndicesResponseRow struct {
	Health                            string `json:"health"`
	Status                            string `json:"status"`
	Index                             string `json:"index"`
	UUID                              string `json:"uuid"`
	Pri                               int    `json:"pri,string"`
	Rep                               int    `json:"rep,string"`
	DocsCount                         int    `json:"docs.count,string"`
	DocsDeleted                       int    `json:"docs.deleted,string"`
	CreationDate                      int64  `json:"creation.date,string"`
	CreationDateString                string `json:"creation.date.string"`
	StoreSize                         string `json:"store.size"`
	PriStoreSize                      string `json:"pri.store.size"`
	CompletionSize                    string `json:"completion.size"`
	PriCompletionSize                 string `json:"pri.completion.size"`
	FielddataMemorySize               string `json:"fielddata.memory_size"`
	PriFielddataMemorySize            string `json:"pri.fielddata.memory_size"`
	FielddataEvictions                int    `json:"fielddata.evictions,string"`
	PriFielddataEvictions             int    `json:"pri.fielddata.evictions,string"`
	QueryCacheMemorySize              string `json:"query_cache.memory_size"`
	PriQueryCacheMemorySize           string `json:"pri.query_cache.memory_size"`
	QueryCacheEvictions               int    `json:"query_cache.evictions,string"`
	PriQueryCacheEvictions            int    `json:"pri.query_cache.evictions,string"`
	RequestCacheMemorySize            string `json:"request_cache.memory_size"`
	PriRequestCacheMemorySize         string `json:"pri.request_cache.memory_size"`
	RequestCacheEvictions             int    `json:"request_cache.evictions,string"`
	PriRequestCacheEvictions          int    `json:"pri.request_cache.evictions,string"`
	RequestCacheHitCount              int    `json:"request_cache.hit_count,string"`
	PriRequestCacheHitCount           int    `json:"pri.request_cache.hit_count,string"`
	RequestCacheMissCount             int    `json:"request_cache.miss_count,string"`
	PriRequestCacheMissCount          int    `json:"pri.request_cache.miss_count,string"`
	FlushTotal                        int    `json:"flush.total,string"`
	PriFlushTotal                     int    `json:"pri.flush.total,string"`
	FlushTotalTime                    string `json:"flush.total_time"`
	PriFlushTotalTime                 string `json:"pri.flush.total_time"`
	GetCurrent                        int    `json:"get.current,string"`
	PriGetCurrent                     int    `json:"pri.get.current,string"`
	GetTime                           string `json:"get.time"`
	PriGetTime                        string `json:"pri.get.time"`
	GetTotal                          int    `json:"get.total,string"`
	PriGetTotal                       int    `json:"pri.get.total,string"`
	GetExistsTime                     string `json:"get.exists_time"`
	PriGetExistsTime                  string `json:"pri.get.exists_time"`
	GetExistsTotal                    int    `json:"get.exists_total,string"`
	PriGetExistsTotal                 int    `json:"pri.get.exists_total,string"`
	GetMissingTime                    string `json:"get.missing_time"`
	PriGetMissingTime                 string `json:"pri.get.missing_time"`
	GetMissingTotal                   int    `json:"get.missing_total,string"`
	PriGetMissingTotal                int    `json:"pri.get.missing_total,string"`
	IndexingDeleteCurrent             int    `json:"indexing.delete_current,string"`
	PriIndexingDeleteCurrent          int    `json:"pri.indexing.delete_current,string"`
	IndexingDeleteTime                string `json:"indexing.delete_time"`
	PriIndexingDeleteTime             string `json:"pri.indexing.delete_time"`
	IndexingDeleteTotal               int    `json:"indexing.delete_total,string"`
	PriIndexingDeleteTotal            int    `json:"pri.indexing.delete_total,string"`
	IndexingIndexCurrent              int    `json:"indexing.index_current,string"`
	PriIndexingIndexCurrent           int    `json:"pri.indexing.index_current,string"`
	IndexingIndexTime                 string `json:"indexing.index_time"`
	PriIndexingIndexTime              string `json:"pri.indexing.index_time"`
	IndexingIndexTotal                int    `json:"indexing.index_total,string"`
	PriIndexingIndexTotal             int    `json:"pri.indexing.index_total,string"`
	IndexingIndexFailed               int    `json:"indexing.index_failed,string"`
	PriIndexingIndexFailed            int    `json:"pri.indexing.index_failed,string"`
	MergesCurrent                     int    `json:"merges.current,string"`
	PriMergesCurrent                  int    `json:"pri.merges.current,string"`
	MergesCurrentDocs                 int    `json:"merges.current_docs,string"`
	PriMergesCurrentDocs              int    `json:"pri.merges.current_docs,string"`
	MergesCurrentSize                 string `json:"merges.current_size"`
	PriMergesCurrentSize              string `json:"pri.merges.current_size"`
	MergesTotal                       int    `json:"merges.total,string"`
	PriMergesTotal                    int    `json:"pri.merges.total,string"`
	MergesTotalDocs                   int    `json:"merges.total_docs,string"`
	PriMergesTotalDocs                int    `json:"pri.merges.total_docs,string"`
	MergesTotalSize                   string `json:"merges.total_size"`
	PriMergesTotalSize                string `json:"pri.merges.total_size"`
	MergesTotalTime                   string `json:"merges.total_time"`
	PriMergesTotalTime                string `json:"pri.merges.total_time"`
	MergesWarmerTotalInvocations      int    `json:"merges.warmer.total_invocations,string"`
	PriMergesWarmerTotalInvocations   int    `json:"pri.merges.warmer.total_invocations,string"`
	MergesWarmerTotalTime             string `json:"merges.warmer.total_time"`
	PriMergesWarmerTotalTime          string `json:"pri.merges.warmer.total_time"`
	MergesWarmerOngoingCount          int    `json:"merges.warmer.ongoing_count,string"`
	PriMergesWarmerOngoingCount       int    `json:"pri.merges.warmer.ongoing_count,string"`
	MergesWarmerTotalBytesReceived    string `json:"merges.warmer.total_bytes_received"`
	PriMergesWarmerTotalBytesReceived string `json:"pri.merges.warmer.total_bytes_received"`
	MergesWarmerTotalBytesSent        string `json:"merges.warmer.total_bytes_sent"`
	PriMergesWarmerTotalBytesSent     string `json:"pri.merges.warmer.total_bytes_sent"`
	MergesWarmerTotalReceiveTime      string `json:"merges.warmer.total_receive_time"`
	PriMergesWarmerTotalReceiveTime   string `json:"pri.merges.warmer.total_receive_time"`
	MergesWarmerTotalFailureCount     int    `json:"merges.warmer.total_failure_count,string"`
	PriMergesWarmerTotalFailureCount  int    `json:"pri.merges.warmer.total_failure_count,string"`
	MergesWarmerTotalSendTime         string `json:"merges.warmer.total_send_time"`
	PriMergesWarmerTotalSendTime      string `json:"pri.merges.warmer.total_send_time"`
	RefreshTotal                      int    `json:"refresh.total,string"`
	PriRefreshTotal                   int    `json:"pri.refresh.total,string"`
	RefreshExternalTotal              int    `json:"refresh.external_total,string"`
	PriRefreshExternalTotal           int    `json:"pri.refresh.external_total,string"`
	RefreshTime                       string `json:"refresh.time"`
	PriRefreshTime                    string `json:"pri.refresh.time"`
	RefreshExternalTime               string `json:"refresh.external_time"`
	PriRefreshExternalTime            string `json:"pri.refresh.external_time"`
	RefreshListeners                  int    `json:"refresh.listeners,string"`
	PriRefreshListeners               int    `json:"pri.refresh.listeners,string"`
	SearchFetchCurrent                int    `json:"search.fetch_current,string"`
	PriSearchFetchCurrent             int    `json:"pri.search.fetch_current,string"`
	SearchFetchTime                   string `json:"search.fetch_time"`
	PriSearchFetchTime                string `json:"pri.search.fetch_time"`
	SearchFetchTotal                  int    `json:"search.fetch_total,string"`
	PriSearchFetchTotal               int    `json:"pri.search.fetch_total,string"`
	SearchOpenContexts                int    `json:"search.open_contexts,string"`
	PriSearchOpenContexts             int    `json:"pri.search.open_contexts,string"`
	SearchQueryCurrent                int    `json:"search.query_current,string"`
	PriSearchQueryCurrent             int    `json:"pri.search.query_current,string"`
	SearchQueryTime                   string `json:"search.query_time"`
	PriSearchQueryTime                string `json:"pri.search.query_time"`
	SearchQueryTotal                  int    `json:"search.query_total,string"`
	PriSearchQueryTotal               int    `json:"pri.search.query_total,string"`
	SearchQueryFailed                 int    `json:"search.query_failed,string"`
	PriSearchQueryFailed              int    `json:"pri.search.query_failed,string"`
	SearchConcurrentQueryCurrent      string `json:"search.concurrent_query_current"`
	PriSearchConcurrentQueryCurrent   string `json:"pri.search.concurrent_query_current"`
	SearchConcurrentQueryTime         string `json:"search.concurrent_query_time"`
	PriSearchConcurrentQueryTime      string `json:"pri.search.concurrent_query_time"`
	SearchConcurrentQueryTotal        string `json:"search.concurrent_query_total"`
	PriSearchConcurrentQueryTotal     string `json:"pri.search.concurrent_query_total"`
	SearchConcurrentAvgSliceCount     string `json:"search.concurrent_avg_slice_count"`
	PriSearchConcurrentAvgSliceCount  string `json:"pri.search.concurrent_avg_slice_count"`
	SearchStartreeQueryCurrent        int    `json:"search.startree_query_current,string"`
	PriSearchStartreeQueryCurrent     int    `json:"pri.search.startree.query_current,string"`
	SearchStartreeQueryTime           string `json:"search.startree_query_time"`
	PriSearchStartreeQueryTime        string `json:"pri.search.startree.query_time"`
	SearchStartreeQueryFailed         int    `json:"search.startree_query_failed,string"`
	PriSearchStartreeQueryFailed      int    `json:"pri.search.startree_query_failed,string"`
	SearchStartreeQueryTotal          int    `json:"search.startree_query_total,string"`
	PriSearchStartreeQueryTotal       int    `json:"pri.search.startree.query_total,string"`
	SearchScrollCurrent               int    `json:"search.scroll_current,string"`
	PriSearchScrollCurrent            int    `json:"pri.search.scroll_current,string"`
	SearchScrollTime                  string `json:"search.scroll_time"`
	PriSearchScrollTime               string `json:"pri.search.scroll_time"`
	SearchScrollTotal                 int    `json:"search.scroll_total,string"`
	PriSearchScrollTotal              int    `json:"pri.search.scroll_total,string"`
	SearchPointInTimeCurrent          string `json:"search.point_in_time_current"`
	PriSearchPointInTimeCurrent       string `json:"pri.search.point_in_time_current"`
	SearchPointInTimeTime             string `json:"search.point_in_time_time"`
	PriSearchPointInTimeTime          string `json:"pri.search.point_in_time_time"`
	SearchPointInTimeTotal            string `json:"search.point_in_time_total"`
	PriSearchPointInTimeTotal         string `json:"pri.search.point_in_time_total"`
	SearchThrottled                   bool   `json:"search.throttled,string"`
	SegmentsCount                     int    `json:"segments.count,string"`
	PriSegmentsCount                  int    `json:"pri.segments.count,string"`
	SegmentsMemory                    string `json:"segments.memory"`
	PriSegmentsMemory                 string `json:"pri.segments.memory"`
	SegmentsIndexWriterMemory         string `json:"segments.index_writer_memory"`
	PriSegmentsIndexWriterMemory      string `json:"pri.segments.index_writer_memory"`
	SegmentsVersionMapMemory          string `json:"segments.version_map_memory"`
	PriSegmentsVersionMapMemory       string `json:"pri.segments.version_map_memory"`
	SegmentsFixedBitsetMemory         string `json:"segments.fixed_bitset_memory"`
	PriSegmentsFixedBitsetMemory      string `json:"pri.segments.fixed_bitset_memory"`
	WarmerCurrent                     int    `json:"warmer.current,string"`
	PriWarmerCurrent                  int    `json:"pri.warmer.current,string"`
	WarmerTotal                       int    `json:"warmer.total,string"`
	PriWarmerTotal                    int    `json:"pri.warmer.total,string"`
	WarmerTotalTime                   string `json:"warmer.total_time"`
	PriWarmerTotalTime                string `json:"pri.warmer.total_time"`
	SuggestCurrent                    int    `json:"suggest.current,string"`
	PriSuggestCurrent                 int    `json:"pri.suggest.current,string"`
	SuggestTime                       string `json:"suggest.time"`
	PriSuggestTime                    string `json:"pri.suggest.time"`
	SuggestTotal                      int    `json:"suggest.total,string"`
	PriSuggestTotal                   int    `json:"pri.suggest.total,string"`
	MemoryTotal                       string `json:"memory.total"`
	PriMemoryTotal                    string `json:"pri.memory.total"`
	LastIndexRequestTimestamp         int64  `json:"last_index_request_timestamp,string"`
	LastIndexRequestTimestampString   string `json:"last_index_request_timestamp_string"`
}

CatIndicesResponseRow represents a single row in the cat indices output, containing health, status, shard/replica counts, document counts, store sizes, fielddata, cache, search, indexing, merge, refresh, flush, and segment metrics.

type CatMasterResponse

type CatMasterResponse []CatMasterResponseRow

CatMasterResponse is the response type returned by the cat master API. Each row identifies the currently elected cluster manager node.

type CatMasterResponseRow

type CatMasterResponseRow struct {
	ID   string `json:"id"`
	Host string `json:"host"`
	IP   string `json:"ip"`
	Node string `json:"node"`
}

CatMasterResponseRow represents a single row in the cat master output, containing the master node's ID, host, IP address, and name.

type CatNodeAttribute

type CatNodeAttribute struct {
	Node  string `json:"node"`
	Host  string `json:"host"`
	IP    string `json:"ip"`
	Attr  string `json:"attr"`
	Value string `json:"value"`
}

CatNodeAttribute represents a single attribute entry for a node.

type CatNodeAttrsResponse

type CatNodeAttrsResponse []CatNodeAttribute

CatNodeAttrsResponse is a slice of node attribute entries.

type CatNodeInfo

type CatNodeInfo struct {
	IP              string `json:"ip"`
	HeapPercent     string `json:"heap.percent"`
	RamPercent      string `json:"ram.percent"`
	CPU             string `json:"cpu"`
	Load1m          string `json:"load_1m"`
	Load5m          string `json:"load_5m"`
	Load15m         string `json:"load_15m"`
	NodeRole        string `json:"node.role"`
	Master          string `json:"master"`
	Name            string `json:"name"`
	Jdk             string `json:"jdk"`
	Version         string `json:"version"`
	DiskUsedPercent string `json:"disk.used_percent"`
}

CatNodeInfo represents a single node entry from the cat nodes API.

type CatNodesResponse

type CatNodesResponse []CatNodeInfo

CatNodesResponse is a slice of node info entries.

type CatPendingTask

type CatPendingTask struct {
	InsertOrder string `json:"insertOrder"`
	TimeInQueue string `json:"timeInQueue"`
	Priority    string `json:"priority"`
	Source      string `json:"source"`
}

CatPendingTask represents a single pending task.

type CatPendingTasksResponse

type CatPendingTasksResponse []CatPendingTask

CatPendingTasksResponse is a slice of pending task entries.

type CatPluginInfo

type CatPluginInfo struct {
	Name        string `json:"name"`
	Component   string `json:"component"`
	Version     string `json:"version"`
	Description string `json:"description,omitempty"`
}

CatPluginInfo represents a single plugin entry from the cat plugins API.

type CatPluginsResponse

type CatPluginsResponse []CatPluginInfo

CatPluginsResponse is a slice of plugin entries.

type CatRecoveryInfo

type CatRecoveryInfo struct {
	Index                string `json:"index"`
	Shard                string `json:"shard"`
	StartTime            string `json:"start_time"`
	Time                 string `json:"time"`
	Type                 string `json:"type"`
	Stage                string `json:"stage"`
	SourceHost           string `json:"source_host"`
	SourceNode           string `json:"source_node"`
	TargetHost           string `json:"target_host"`
	TargetNode           string `json:"target_node"`
	Repository           string `json:"repository"`
	Snapshot             string `json:"snapshot"`
	Files                string `json:"files"`
	FilesRecovered       string `json:"files_recovered"`
	FilesPercent         string `json:"files_percent"`
	Bytes                string `json:"bytes"`
	BytesRecovered       string `json:"bytes_recovered"`
	BytesPercent         string `json:"bytes_percent"`
	TranslogOps          string `json:"translog_ops"`
	TranslogOpsRecovered string `json:"translog_ops_recovered"`
	TranslogOpsPercent   string `json:"translog_ops_percent"`
}

CatRecoveryInfo represents a single shard recovery.

type CatRecoveryResponse

type CatRecoveryResponse []CatRecoveryInfo

CatRecoveryResponse is a slice of recovery entries.

type CatRepositoriesResponse

type CatRepositoriesResponse []CatRepository

CatRepositoriesResponse is a slice of repository entries.

type CatRepository

type CatRepository struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

CatRepository represents a single snapshot repository.

type CatSegment

type CatSegment struct {
	Index      string `json:"index"`
	Shard      string `json:"shard"`
	Prirep     string `json:"prirep"`
	IP         string `json:"ip"`
	ID         string `json:"id"`
	Segment    string `json:"segment"`
	Version    string `json:"version"`
	Compound   string `json:"compound"`
	Size       string `json:"size"`
	DocsCount  string `json:"docs.count"`
	SizeMemory string `json:"size.memory"`
}

CatSegment represents a single index segment.

type CatSegmentReplication

type CatSegmentReplication struct {
	Shard                string `json:"shard"`
	Checkpoint           string `json:"checkpoint"`
	ReplicatingTimeTaken string `json:"replicating.time_taken"`
	GetChangesTimeTaken  string `json:"get_changes.time_taken"`
	TotalTimeTaken       string `json:"total.time_taken"`
	AcceptedTranslogOps  string `json:"accepted.translog_ops"`
}

CatSegmentReplication represents a segment replication checkpoint.

type CatSegmentReplicationResponse

type CatSegmentReplicationResponse []CatSegmentReplication

CatSegmentReplicationResponse is a slice of segment replication entries.

type CatSegmentsResponse

type CatSegmentsResponse []CatSegment

CatSegmentsResponse is a slice of segment entries.

type CatService

type CatService interface {
	// Indices returns cat-style information about indices including health,
	// status, shard counts, document counts, and storage sizes.
	// Pass nil for indices to list all indices.
	Indices(ctx context.Context, indices []string) (CatIndicesResponse, error)

	// Shards returns cat-style information about shard allocation across nodes,
	// including state, document count, and store size per shard.
	// Pass nil for indices to list shards from all indices.
	Shards(ctx context.Context, indices []string) (CatShardsResponse, error)

	// Aliases returns cat-style information about index aliases.
	// Pass nil for names to list all aliases.
	Aliases(ctx context.Context, names []string) (CatAliasesResponse, error)

	// Health returns a compact cluster health overview from the cat API.
	Health(ctx context.Context) (CatHealthResponse, error)

	// Count returns the total document count for the cluster or specific indices.
	// Pass nil for indices to count across all indices.
	Count(ctx context.Context, indices []string) (CatCountResponse, error)

	// Allocation returns shard allocation information per node, including
	// disk usage statistics. Pass nil for nodeIds to list all nodes.
	Allocation(ctx context.Context, nodeIds []string) (CatAllocationResponse, error)

	// Fielddata returns fielddata memory usage per node and per field.
	// Pass nil for fields to list all fields.
	Fielddata(ctx context.Context, fields []string) (CatFielddataResponse, error)

	// Snapshots returns cat-style information about snapshots in a repository.
	// An empty repository string lists snapshots from all repositories.
	Snapshots(ctx context.Context, repository string) (CatSnapshotsResponse, error)

	// Master returns information about the currently elected cluster manager node.
	Master(ctx context.Context) (CatMasterResponse, error)

	// Help returns the list of available cat API endpoints as plain text.
	Help(ctx context.Context) (string, error)

	// NodeAttrs returns cat-style information about custom node attributes
	// configured on each node in the cluster.
	NodeAttrs(ctx context.Context) (CatNodeAttrsResponse, error)

	// CatNodes returns cat-style information about all nodes in the cluster,
	// including heap, CPU, load, role, and version details.
	CatNodes(ctx context.Context) (CatNodesResponse, error)

	// CatPendingTasks returns the list of cluster-level pending tasks,
	// including priority, time in queue, and source.
	CatPendingTasks(ctx context.Context) (CatPendingTasksResponse, error)

	// Plugins returns information about plugins installed on each node.
	Plugins(ctx context.Context) (CatPluginsResponse, error)

	// CatRecovery returns shard recovery information for the cluster.
	// Pass nil for indices to list recoveries across all indices.
	CatRecovery(ctx context.Context, indices []string) (CatRecoveryResponse, error)

	// Repositories returns information about registered snapshot repositories.
	Repositories(ctx context.Context) (CatRepositoriesResponse, error)

	// Segments returns low-level Lucene segment information per shard.
	// Pass nil for indices to list segments across all indices.
	Segments(ctx context.Context, indices []string) (CatSegmentsResponse, error)

	// SegmentReplication returns segment replication checkpoint information.
	// Pass nil for indices to list across all indices.
	SegmentReplication(ctx context.Context, indices []string) (CatSegmentReplicationResponse, error)

	// CatTasks returns the list of currently running tasks on the cluster
	// from the cat tasks API.
	CatTasks(ctx context.Context) (CatTasksResponse, error)

	// Templates returns information about index templates.
	// Pass an empty string to list all templates.
	Templates(ctx context.Context, name string) (CatTemplatesResponse, error)

	// ThreadPool returns thread pool statistics per node.
	// Pass nil for patterns to list all thread pools.
	ThreadPool(ctx context.Context, patterns []string) (CatThreadPoolResponse, error)

	// ClusterManager returns information about the currently elected cluster
	// manager node via the /_cat/cluster_manager endpoint, which is the
	// non-deprecated alias for /_cat/master.
	ClusterManager(ctx context.Context) (CatClusterManagerResponse, error)
}

CatService provides access to the OpenSearch Cat API group, which returns human- and machine-readable data in plain text format (requested as JSON by this client). Cat APIs are commonly used for quick cluster inspection.

Example usage:

indices, err := svc.Indices(ctx, nil)
for _, idx := range indices {
    fmt.Println(idx.Index, idx.Health, idx.DocsCount)
}

func NewCatService

func NewCatService(client *resty.Client, logger *logrus.Entry) CatService

NewCatService creates a new CatService using the provided HTTP client and logger. The logger is scoped with a "service=cat" field.

type CatShardsResponse

type CatShardsResponse []CatShardsResponseRow

CatShardsResponse is the response type returned by the cat shards API. Each row represents a single shard with its allocation, state, and metrics.

type CatShardsResponseRow

type CatShardsResponseRow struct {
	Index                          string  `json:"index"`
	UUID                           string  `json:"uuid"`
	Shard                          int     `json:"shard,string"`
	Prirep                         string  `json:"prirep"`
	State                          string  `json:"state"`
	Docs                           int64   `json:"docs,string"`
	Store                          string  `json:"store"`
	IP                             string  `json:"ip"`
	ID                             string  `json:"id"`
	Node                           string  `json:"node"`
	SyncID                         string  `json:"sync_id"`
	UnassignedReason               string  `json:"unassigned.reason"`
	UnassignedAt                   string  `json:"unassigned.at"`
	UnassignedFor                  string  `json:"unassigned.for"`
	UnassignedDetails              string  `json:"unassigned.details"`
	RecoverysourceType             string  `json:"recoverysource.type"`
	CompletionSize                 string  `json:"completion.size"`
	FielddataMemorySize            string  `json:"fielddata.memory_size"`
	FielddataEvictions             int     `json:"fielddata.evictions,string"`
	QueryCacheMemorySize           string  `json:"query_cache.memory_size"`
	QueryCacheEvictions            int     `json:"query_cache.evictions,string"`
	FlushTotal                     int     `json:"flush.total,string"`
	FlushTotalTime                 string  `json:"flush.total_time"`
	GetCurrent                     int     `json:"get.current,string"`
	GetTime                        string  `json:"get.time"`
	GetTotal                       int     `json:"get.total,string"`
	GetExistsTime                  string  `json:"get.exists_time"`
	GetExistsTotal                 int     `json:"get.exists_total,string"`
	GetMissingTime                 string  `json:"get.missing_time"`
	GetMissingTotal                int     `json:"get.missing_total,string"`
	IndexingDeleteCurrent          int     `json:"indexing.delete_current,string"`
	IndexingDeleteTime             string  `json:"indexing.delete_time"`
	IndexingDeleteTotal            int     `json:"indexing.delete_total,string"`
	IndexingIndexCurrent           int     `json:"indexing.index_current,string"`
	IndexingIndexTime              string  `json:"indexing.index_time"`
	IndexingIndexTotal             int     `json:"indexing.index_total,string"`
	IndexingIndexFailed            int     `json:"indexing.index_failed,string"`
	MergesCurrent                  int     `json:"merges.current,string"`
	MergesCurrentDocs              int     `json:"merges.current_docs,string"`
	MergesCurrentSize              string  `json:"merges.current_size"`
	MergesTotal                    int     `json:"merges.total,string"`
	MergesTotalDocs                int     `json:"merges.total_docs,string"`
	MergesTotalSize                string  `json:"merges.total_size"`
	MergesTotalTime                string  `json:"merges.total_time"`
	MergesWarmerTotalInvocations   int     `json:"merges.warmer.total_invocations,string"`
	MergesWarmerTotalTime          string  `json:"merges.warmer.total_time"`
	MergesWarmerOngoingCount       int     `json:"merges.warmer.ongoing_count,string"`
	MergesWarmerTotalBytesReceived string  `json:"merges.warmer.total_bytes_received"`
	MergesWarmerTotalBytesSent     string  `json:"merges.warmer.total_bytes_sent"`
	MergesWarmerTotalReceiveTime   string  `json:"merges.warmer.total_receive_time"`
	MergesWarmerTotalFailureCount  int     `json:"merges.warmer.total_failure_count,string"`
	MergesWarmerTotalSendTime      string  `json:"merges.warmer.total_send_time"`
	RefreshTotal                   int     `json:"refresh.total,string"`
	RefreshExternalTotal           int     `json:"refresh.external_total,string"`
	RefreshTime                    string  `json:"refresh.time"`
	RefreshExternalTime            string  `json:"refresh.external_time"`
	RefreshListeners               int     `json:"refresh.listeners,string"`
	SearchFetchCurrent             int     `json:"search.fetch_current,string"`
	SearchFetchTime                string  `json:"search.fetch_time"`
	SearchFetchTotal               int     `json:"search.fetch_total,string"`
	SearchOpenContexts             int     `json:"search.open_contexts,string"`
	SearchQueryCurrent             int     `json:"search.query_current,string"`
	SearchQueryTime                string  `json:"search.query_time"`
	SearchQueryTotal               int     `json:"search.query_total,string"`
	SearchQueryFailed              int     `json:"search.query_failed,string"`
	SearchScrollCurrent            int     `json:"search.scroll_current,string"`
	SearchScrollTime               string  `json:"search.scroll_time"`
	SearchScrollTotal              int     `json:"search.scroll_total,string"`
	SearchThrottled                bool    `json:"search.throttled,string"`
	SegmentsCount                  int     `json:"segments.count,string"`
	SegmentsMemory                 string  `json:"segments.memory"`
	SegmentsIndexWriterMemory      string  `json:"segments.index_writer_memory"`
	SegmentsVersionMapMemory       string  `json:"segments.version_map_memory"`
	SegmentsFixedBitsetMemory      string  `json:"segments.fixed_bitset_memory"`
	SeqNoMax                       int     `json:"seq_no.max,string"`
	SeqNoLocalCheckpoint           int     `json:"seq_no.local_checkpoint,string"`
	SeqNoGlobalCheckpoint          int     `json:"seq_no.global_checkpoint,string"`
	WarmerCurrent                  int     `json:"warmer.current,string"`
	WarmerTotal                    int     `json:"warmer.total,string"`
	WarmerTotalTime                string  `json:"warmer.total_time"`
	PathData                       string  `json:"path.data"`
	PathState                      string  `json:"path.state"`
	SearchConcurrentQueryCurrent   int     `json:"search.concurrent_query_current,string"`
	SearchConcurrentQueryTime      string  `json:"search.concurrent_query_time"`
	SearchConcurrentQueryTotal     int     `json:"search.concurrent_query_total,string"`
	SearchConcurrentAvgSliceCount  float64 `json:"search.concurrent_avg_slice_count,string"`
	SearchStartreeQueryCurrent     int     `json:"search.startree_query_current,string"`
	SearchStartreeQueryTime        string  `json:"search.startree_query_time"`
	SearchStartreeQueryTotal       int     `json:"search.startree_query_total,string"`
	SearchStartreeQueryFailed      int     `json:"search.startree_query_failed,string"`
	SearchPointInTimeCurrent       int     `json:"search.point_in_time_current,string"`
	SearchPointInTimeTime          string  `json:"search.point_in_time_time"`
	SearchPointInTimeTotal         int     `json:"search.point_in_time_total,string"`
	SearchIdleReactivateCountTotal int     `json:"search.search_idle_reactivate_count_total,string"`
	DocsDeleted                    int     `json:"docs.deleted,string"`
}

CatShardsResponseRow represents a single row in the cat shards output, containing the owning index, shard number, primary/replica designation, state, document count, store size, assigned node, and various per-shard operational metrics (indexing, search, merges, refresh, flush, segments, etc.).

type CatSnapshotsResponse

type CatSnapshotsResponse []CatSnapshotsResponseRow

CatSnapshotsResponse is the response type returned by the cat snapshots API. Each row represents a single snapshot with its status, timing, and shard counts.

type CatSnapshotsResponseRow

type CatSnapshotsResponseRow struct {
	ID               string `json:"id"`
	Repository       string `json:"repository"`
	Status           string `json:"status"`
	StartEpoch       string `json:"start_epoch"`
	StartTime        string `json:"start_time"`
	EndEpoch         string `json:"end_epoch"`
	EndTime          string `json:"end_time"`
	Duration         string `json:"duration"`
	Indices          string `json:"indices"`
	SuccessfulShards string `json:"successful_shards"`
	FailedShards     string `json:"failed_shards"`
	TotalShards      string `json:"total_shards"`
	Reason           string `json:"reason"`
}

CatSnapshotsResponseRow represents a single row in the cat snapshots output, containing the snapshot ID, repository, status, start/end times, duration, index list, and successful/failed/total shard counts.

type CatTaskInfo

type CatTaskInfo struct {
	ID           string `json:"id"`
	Action       string `json:"action"`
	TaskID       string `json:"task_id"`
	ParentTaskID string `json:"parent_task_id"`
	NodeID       string `json:"node_id"`
	NodeIP       string `json:"node_ip"`
	RunningTime  string `json:"running_time"`
	Type         string `json:"type"`
	Version      string `json:"version,omitempty"`
	Description  string `json:"description,omitempty"`
	XOpaqueID    string `json:"x_opaque_id,omitempty"`
}

CatTaskInfo represents a single task from the cat tasks API.

type CatTasksResponse

type CatTasksResponse []CatTaskInfo

CatTasksResponse is a slice of cat task entries.

type CatTemplateInfo

type CatTemplateInfo struct {
	Name          string `json:"name"`
	IndexPatterns string `json:"index_patterns"`
	Order         string `json:"order"`
	Version       string `json:"version"`
}

CatTemplateInfo represents a single template from the cat templates API.

type CatTemplatesResponse

type CatTemplatesResponse []CatTemplateInfo

CatTemplatesResponse is a slice of cat template entries.

type CatThreadPoolInfo

type CatThreadPoolInfo struct {
	NodeName  string `json:"node_name"`
	Name      string `json:"name"`
	Active    string `json:"active"`
	PoolSize  string `json:"pool_size"`
	Queue     string `json:"queue"`
	QueueSize string `json:"queue_size"`
	Rejected  string `json:"rejected"`
	Largest   string `json:"largest"`
	Completed string `json:"completed"`
	Type      string `json:"type"`
}

CatThreadPoolInfo represents a single thread pool entry from the cat thread_pool API.

type CatThreadPoolResponse

type CatThreadPoolResponse []CatThreadPoolInfo

CatThreadPoolResponse is a slice of cat thread pool entries.

type CcrAutoFollowRule

type CcrAutoFollowRule struct {
	LeaderAlias string          `json:"leader_alias"`
	Name        string          `json:"name"`
	Pattern     string          `json:"pattern"`
	UseRoles    CcrRuleUseRoles `json:"use_roles"`
}

CcrAutoFollowRule represents an auto-follow rule for cross-cluster replication, defining the leader cluster alias, rule name, index pattern, and role mappings.

type CcrAutoFollowStatus

type CcrAutoFollowStatus struct {
	Name                        string              `json:"name"`
	Pattern                     string              `json:"pattern"`
	NumSuccessStartReplications int64               `json:"num_success_start_replications"`
	NumFailedStartReplications  int64               `json:"num_failed_start_replications"`
	NumFailedLeaderCalls        int64               `json:"num_failed_leader_calls"`
	FailedIndices               []string            `json:"failed_indices"`
	LastExecutionTime           types.UnixMilliTime `json:"last_execution_time"`
}

CcrAutoFollowStatus represents the status of a single auto-follow rule, including success/failure counts, failed indices, and last execution time.

type CcrAutoFollowStatusResponse

type CcrAutoFollowStatusResponse struct {
	NumSuccessStartReplications int64                 `json:"num_success_start_replications"`
	NumFailedStartReplications  int64                 `json:"num_failed_start_replications"`
	NumFailedLeaderCalls        int64                 `json:"num_failed_leader_calls"`
	FailedIndices               []string              `json:"failed_indices"`
	AutofollowStats             []CcrAutoFollowStatus `json:"autofollow_stats"`
}

CcrAutoFollowStatusResponse represents the aggregate response from the CCR auto-follow status API, containing counts of successful/failed replication starts and per-rule statistics.

type CcrDeleteAutoFollowOptions

type CcrDeleteAutoFollowOptions struct {
	LeaderAlias string `validate:"required"`
	Name        string `validate:"required"`
}

func (*CcrDeleteAutoFollowOptions) Validate

func (r *CcrDeleteAutoFollowOptions) Validate() error

type CcrDeleteAutoFollowRequest

type CcrDeleteAutoFollowRequest struct {
	LeaderAlias string `json:"leader_alias"`
	Name        string `json:"name"`
}

CcrDeleteAutoFollowRequest represents the request body for deleting an auto-follow rule.

type CcrDeleteAutoFollowResponse

type CcrDeleteAutoFollowResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrDeleteAutoFollowResponse represents the response from the CCR auto-follow deletion API, indicating whether the deletion was acknowledged.

type CcrFollowerStatsResponse

type CcrFollowerStatsResponse struct {
	CcrStatusFollowerState
	NumSyncingIndices       int64                             `json:"num_syncing_indices"`
	NumBootstrappingIndices int64                             `json:"num_bootstrapping_indices"`
	NumPausedIndices        int64                             `json:"num_paused_indices"`
	NumFailedIndices        int64                             `json:"num_failed_indices"`
	NumShardTasks           int64                             `json:"num_shard_tasks"`
	NumIndexTasks           int64                             `json:"num_index_tasks"`
	IndexStats              map[string]CcrStatusFollowerState `json:"index_stats"`
}

CcrFollowerStatsResponse represents the aggregate follower statistics from the CCR plugin, including counts of syncing, bootstrapping, paused, and failed indices, as well as per-index stats.

type CcrLeaderStatsResponse

type CcrLeaderStatsResponse struct {
	CcrStatusLeaderState
	NumReplicatedIndices int64                           `json:"num_replicated_indices"`
	IndexStats           map[string]CcrStatusLeaderState `json:"index_stats"`
}

CcrLeaderStatsResponse represents the aggregate leader statistics from the CCR plugin, including the count of replicated indices and per-index leader stats.

type CcrPauseRuleResponse

type CcrPauseRuleResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrPauseRuleResponse represents the response from the CCR pause replication rule API, indicating whether the pause request was acknowledged.

type CcrPostAutoFollowResponse

type CcrPostAutoFollowResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrPostAutoFollowResponse represents the response from the CCR auto-follow creation API, indicating whether the auto-follow rule was acknowledged.

type CcrResumeRuleResponse

type CcrResumeRuleResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrResumeRuleResponse represents the response from the CCR resume replication rule API, indicating whether the resume request was acknowledged.

type CcrRule

type CcrRule struct {
	LeaderAlias string          `json:"leader_alias"`
	LeaderIndex string          `json:"leader_index"`
	UseRoles    CcrRuleUseRoles `json:"use_roles"`
}

CcrRule represents a single cross-cluster replication rule, specifying the leader cluster alias, leader index, and role mappings.

type CcrRuleSyncingDetails

type CcrRuleSyncingDetails struct {
	LeaderCheckpoint   int64 `json:"leader_checkpoint"`
	FollowerCheckpoint int64 `json:"follower_checkpoint"`
	SeqNumber          int64 `json:"seq_no"`
}

CcrRuleSyncingDetails contains the sequence number checkpoint information for a cross-cluster replication rule, tracking sync progress between leader and follower.

type CcrRuleUseRoles

type CcrRuleUseRoles struct {
	LeaderClusterRole   string `json:"leader_cluster_role"`
	FollowerClusterRole string `json:"follower_cluster_role"`
}

CcrRuleUseRoles defines the role mappings used for cross-cluster replication between the leader and follower clusters.

type CcrService

type CcrService interface {
	AutoFollowStatus(ctx context.Context) (*CcrAutoFollowStatusResponse, error)
	PostAutoFollow(ctx context.Context, body *CcrAutoFollowRule) (*CcrPostAutoFollowResponse, error)
	DeleteAutoFollow(ctx context.Context, req *CcrDeleteAutoFollowOptions) (*CcrDeleteAutoFollowResponse, error)
	StartRule(ctx context.Context, req *CcrStartRuleRequest) (*CcrStartRuleResponse, error)
	StopRule(ctx context.Context, name string) (*CcrStopRuleResponse, error)
	PauseRule(ctx context.Context, name string) (*CcrPauseRuleResponse, error)
	ResumeRule(ctx context.Context, name string) (*CcrResumeRuleResponse, error)
	StatusRule(ctx context.Context, name string) (*CcrStatusRuleResponse, error)
	FollowerStats(ctx context.Context) (*CcrFollowerStatsResponse, error)
	LeaderStats(ctx context.Context) (*CcrLeaderStatsResponse, error)
	UpdateRule(ctx context.Context, name string, body any) (*CcrUpdateRuleResponse, error)
}

CcrService interacts with the OpenSearch Cross-Cluster Replication (CCR) plugin.

func NewCcrService

func NewCcrService(client *resty.Client, logger *logrus.Entry) CcrService

type CcrStartRuleRequest

type CcrStartRuleRequest struct {
	Name string `validate:"required"`
	Body *CcrRule
}

func (*CcrStartRuleRequest) Validate

func (r *CcrStartRuleRequest) Validate() error

type CcrStartRuleResponse

type CcrStartRuleResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrStartRuleResponse represents the response from the CCR start replication rule API, indicating whether the start request was acknowledged.

type CcrStatusFollowerState

type CcrStatusFollowerState struct {
	OperationsWritten      int64 `json:"operations_written"`
	OperationsRead         int64 `json:"operations_read"`
	FailedReadRequests     int64 `json:"failed_read_requests"`
	ThrottledReadRequests  int64 `json:"throttled_read_requests"`
	FailedWriteRequests    int64 `json:"failed_write_requests"`
	ThrottledWriteRequests int64 `json:"throttled_write_requests"`
	FollowerCheckpoint     int64 `json:"follower_checkpoint"`
	LeaderCheckpoint       int64 `json:"leader_checkpoint"`
	TotalWriteTimeMillis   int64 `json:"total_write_time_millis"`
}

CcrStatusFollowerState contains the replication statistics for a follower index, including operations read/written, failed/throttled requests, and checkpoint positions.

type CcrStatusLeaderState

type CcrStatusLeaderState struct {
	OperationsRead              int64 `json:"operations_read"`
	TranslogSizeBytes           int64 `json:"translog_size_bytes"`
	OperationsReadLucene        int64 `json:"operations_read_lucene"`
	OperationsReadTranslog      int64 `json:"operations_read_translog"`
	TotalReadTimeLuceneMillis   int64 `json:"total_read_time_lucene_millis"`
	TotalReadTimeTranslogMillis int64 `json:"total_read_time_translog_millis"`
	BytesRead                   int64 `json:"bytes_read"`
}

CcrStatusLeaderState contains the replication statistics for a leader index, including operations read, translog/lucene read sizes, and read time metrics.

type CcrStatusRuleResponse

type CcrStatusRuleResponse struct {
	Status         string                `json:"status"`
	Reason         string                `json:"reason"`
	LeaderAlias    string                `json:"leader_alias"`
	LeaderIndex    string                `json:"leader_index"`
	FollowerIndex  string                `json:"follower_index"`
	SyncingDetails CcrRuleSyncingDetails `json:"syncing_details"`
}

CcrStatusRuleResponse represents the response from the CCR replication rule status API, containing the current replication status, leader/follower index info, and syncing details.

type CcrStopRuleResponse

type CcrStopRuleResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

CcrStopRuleResponse represents the response from the CCR stop replication rule API, indicating whether the stop request was acknowledged.

type CcrUpdateRuleResponse

type CcrUpdateRuleResponse struct {
	Acknowledged bool   `json:"acknowledged,omitempty"`
	Status       string `json:"status,omitempty"`
}

CcrUpdateRuleResponse represents the response from updating a CCR replication rule.

type CloneRequest

type CloneRequest struct {
	Source string `validate:"required"`
	Target string `validate:"required"`
	Body   any
}

func (*CloneRequest) Validate

func (r *CloneRequest) Validate() error

type ClusterAllocationExplainResponse

type ClusterAllocationExplainResponse struct {
	Index          string         `json:"index"`
	Shard          int            `json:"shard"`
	Primary        bool           `json:"primary"`
	CurrentState   string         `json:"current_state"`
	UnassignedInfo map[string]any `json:"unassigned_info,omitempty"`
	Explanation    string         `json:"explanation,omitempty"`
}

ClusterAllocationExplainResponse represents shard allocation explanation from the cluster allocation explain API.

type ClusterDecommissionAwarenessResponse

type ClusterDecommissionAwarenessResponse struct {
	Status             string `json:"status,omitempty"`
	DecommissionStatus string `json:"decommission_status,omitempty"`
}

ClusterDecommissionAwarenessResponse represents decommission awareness state.

type ClusterHealthResponse

type ClusterHealthResponse struct {
	ClusterName                    string                         `json:"cluster_name"`
	Status                         string                         `json:"status"`
	TimedOut                       bool                           `json:"timed_out"`
	NumberOfNodes                  int                            `json:"number_of_nodes"`
	NumberOfDataNodes              int                            `json:"number_of_data_nodes"`
	ActivePrimaryShards            int                            `json:"active_primary_shards"`
	ActiveShards                   int                            `json:"active_shards"`
	RelocatingShards               int                            `json:"relocating_shards"`
	InitializingShards             int                            `json:"initializing_shards"`
	UnassignedShards               int                            `json:"unassigned_shards"`
	DelayedUnassignedShards        int                            `json:"delayed_unassigned_shards"`
	NumberOfPendingTasks           int                            `json:"number_of_pending_tasks"`
	NumberOfInFlightFetch          int                            `json:"number_of_in_flight_fetch"`
	TaskMaxWaitTimeInQueue         string                         `json:"task_max_waiting_in_queue"`
	TaskMaxWaitTimeInQueueInMillis int                            `json:"task_max_waiting_in_queue_millis"`
	ActiveShardsPercent            string                         `json:"active_shards_percent"`
	ActiveShardsPercentAsNumber    float64                        `json:"active_shards_percent_as_number"`
	Indices                        map[string]*ClusterIndexHealth `json:"indices"`
}

ClusterHealthResponse represents the result of a cluster health request. It contains the overall cluster status (green, yellow, red), node counts, shard statistics, and optionally per-index health breakdowns. Key fields include Status, NumberOfNodes, ActiveShards, and UnassignedShards.

type ClusterIndexHealth

type ClusterIndexHealth struct {
	Status              string                         `json:"status"`
	NumberOfShards      int                            `json:"number_of_shards"`
	NumberOfReplicas    int                            `json:"number_of_replicas"`
	ActivePrimaryShards int                            `json:"active_primary_shards"`
	ActiveShards        int                            `json:"active_shards"`
	RelocatingShards    int                            `json:"relocating_shards"`
	InitializingShards  int                            `json:"initializing_shards"`
	UnassignedShards    int                            `json:"unassigned_shards"`
	Shards              map[string]*ClusterShardHealth `json:"shards"`
}

ClusterIndexHealth represents the health status of a single index within the cluster health response. It includes shard-level statistics such as active, relocating, initializing, and unassigned shard counts.

type ClusterPendingTasksResponse

type ClusterPendingTasksResponse struct {
	Tasks []map[string]any `json:"tasks"`
}

ClusterPendingTasksResponse represents pending cluster tasks.

type ClusterRerouteResponse

type ClusterRerouteResponse struct {
	State        *ClusterStateResponse `json:"state"`
	Explanations []RerouteExplanation  `json:"explanations,omitempty"`
}

ClusterRerouteResponse represents the result of a cluster reroute request. It contains the updated cluster state and, when explain is enabled, a list of explanations for each reroute decision.

type ClusterService

type ClusterService interface {
	Health(ctx context.Context, indices []string) (*ClusterHealthResponse, error)
	State(ctx context.Context, req *ClusterStateRequest) (*ClusterStateResponse, error)
	Stats(ctx context.Context, nodeIds []string) (*ClusterStatsResponse, error)
	Reroute(ctx context.Context, body any) (*ClusterRerouteResponse, error)
	GetSettings(ctx context.Context) (map[string]any, error)
	PutSettings(ctx context.Context, body any) (map[string]any, error)
	AllocationExplain(ctx context.Context, body any) (*ClusterAllocationExplainResponse, error)
	PendingTasks(ctx context.Context) (*ClusterPendingTasksResponse, error)
	RemoteInfo(ctx context.Context) (map[string]any, error)
	ExistsComponentTemplate(ctx context.Context, name string) (bool, error)
	PutDecommissionAwareness(ctx context.Context, attributeName string, attributeValue string) (*types.AcknowledgedResponse, error)
	GetDecommissionAwareness(ctx context.Context, attributeName string) (*ClusterDecommissionAwarenessResponse, error)
	DeleteDecommissionAwareness(ctx context.Context) (*types.AcknowledgedResponse, error)
	PutWeightedRouting(ctx context.Context, attribute string, body any) (*ClusterWeightedRoutingResponse, error)
	GetWeightedRouting(ctx context.Context, attribute string) (*ClusterWeightedRoutingResponse, error)
	DeleteWeightedRouting(ctx context.Context) (*types.AcknowledgedResponse, error)
	PostVotingConfigExclusions(ctx context.Context, params map[string]string) (*types.AcknowledgedResponse, error)
	DeleteVotingConfigExclusions(ctx context.Context, waitForRemoval bool) (*types.AcknowledgedResponse, error)
}

func NewClusterService

func NewClusterService(client *resty.Client, logger *logrus.Entry) ClusterService

type ClusterShardHealth

type ClusterShardHealth struct {
	Status             string `json:"status"`
	PrimaryActive      bool   `json:"primary_active"`
	ActiveShards       int    `json:"active_shards"`
	RelocatingShards   int    `json:"relocating_shards"`
	InitializingShards int    `json:"initializing_shards"`
	UnassignedShards   int    `json:"unassigned_shards"`
}

ClusterShardHealth represents the health of a single shard group within an index, including whether the primary is active and replica shard counts.

type ClusterStateRequest

type ClusterStateRequest struct {
	Metrics []string
	Indices []string
}

type ClusterStateResponse

type ClusterStateResponse struct {
	ClusterName       string                    `json:"cluster_name"`
	ClusterUUID       string                    `json:"cluster_uuid"`
	Version           int64                     `json:"version"`
	StateUUID         string                    `json:"state_uuid"`
	MasterNode        string                    `json:"master_node"`
	Blocks            map[string]*clusterBlocks `json:"blocks"`
	Nodes             map[string]*discoveryNode `json:"nodes"`
	Metadata          *clusterStateMetadata     `json:"metadata"`
	RoutingTable      *clusterStateRoutingTable `json:"routing_table"`
	RoutingNodes      *clusterStateRoutingNode  `json:"routing_nodes"`
	Snapshots         map[string]any            `json:"snapshots"`
	SnapshotDeletions map[string]any            `json:"snapshot_deletions"`
	Customs           map[string]any            `json:"customs"`
}

ClusterStateResponse represents the full or filtered state of an OpenSearch cluster. Key fields include the cluster name/UUID, master node identifier, block information, discovery nodes, metadata (templates, indices), and the shard routing table.

type ClusterStatsAnalysisStats

type ClusterStatsAnalysisStats struct {
	CharFilterTypes    []IndexFeatureStats `json:"char_filter_types,omitempty"`
	TokenizerTypes     []IndexFeatureStats `json:"tokenizer_types,omitempty"`
	FilterTypes        []IndexFeatureStats `json:"filter_types,omitempty"`
	AnalyzerTypes      []IndexFeatureStats `json:"analyzer_types,omitempty"`
	BuiltInCharFilters []IndexFeatureStats `json:"built_in_char_filters,omitempty"`
	BuiltInTokenizers  []IndexFeatureStats `json:"built_in_tokenizers,omitempty"`
	BuiltInFilters     []IndexFeatureStats `json:"built_in_filters,omitempty"`
	BuiltInAnalyzers   []IndexFeatureStats `json:"built_in_analyzers,omitempty"`
}

ClusterStatsAnalysisStats summarizes the types of character filters, tokenizers, filters, and analyzers used across all indices in the cluster.

type ClusterStatsIndices

type ClusterStatsIndices struct {
	Count      int                            `json:"count"`
	Shards     *ClusterStatsIndicesShards     `json:"shards"`
	Docs       *ClusterStatsIndicesDocs       `json:"docs"`
	Store      *ClusterStatsIndicesStore      `json:"store"`
	FieldData  *ClusterStatsIndicesFieldData  `json:"fielddata"`
	QueryCache *ClusterStatsIndicesQueryCache `json:"query_cache"`
	Completion *ClusterStatsIndicesCompletion `json:"completion"`
	Segments   *IndexStatsSegments            `json:"segments"`
	Analysis   *ClusterStatsAnalysisStats     `json:"analysis"`
	Mappings   *ClusterStatsMappingStats      `json:"mappings"`
	Versions   []*ClusterStatsVersionStats    `json:"versions"`
}

ClusterStatsIndices aggregates index-level statistics across all indices in the cluster, including document counts, store size, fielddata usage, query cache stats, segment information, and analysis/mapping stats.

type ClusterStatsIndicesCompletion

type ClusterStatsIndicesCompletion struct {
	Size        string `json:"size"`
	SizeInBytes int64  `json:"size_in_bytes"`
	Fields      map[string]struct {
		Size        string `json:"size"`
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"fields,omitempty"`
}

ClusterStatsIndicesCompletion reports completion suggester size in both human-readable and byte representations, optionally per field.

type ClusterStatsIndicesDocs

type ClusterStatsIndicesDocs struct {
	Count   int `json:"count"`
	Deleted int `json:"deleted"`
}

ClusterStatsIndicesDocs holds aggregate document counts across all indices in the cluster, including deleted documents.

type ClusterStatsIndicesFieldData

type ClusterStatsIndicesFieldData struct {
	MemorySize        string `json:"memory_size"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	Evictions         int64  `json:"evictions"`
	Fields            map[string]struct {
		MemorySize        string `json:"memory_size"`
		MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	} `json:"fields,omitempty"`
}

ClusterStatsIndicesFieldData reports fielddata cache memory usage and eviction counts, optionally broken down by individual field name.

type ClusterStatsIndicesQueryCache

type ClusterStatsIndicesQueryCache struct {
	MemorySize        string `json:"memory_size"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	TotalCount        int64  `json:"total_count"`
	HitCount          int64  `json:"hit_count"`
	MissCount         int64  `json:"miss_count"`
	CacheSize         int64  `json:"cache_size"`
	CacheCount        int64  `json:"cache_count"`
	Evictions         int64  `json:"evictions"`
}

ClusterStatsIndicesQueryCache reports query cache memory usage, hit/miss counts, cache size, and eviction statistics across the cluster.

type ClusterStatsIndicesSegmentsFile

type ClusterStatsIndicesSegmentsFile struct {
	Size        string `json:"size"`
	SizeInBytes int64  `json:"size_in_bytes"`
	Description string `json:"description,omitempty"`
}

ClusterStatsIndicesSegmentsFile represents an individual segment file's size and optional description within the segments statistics.

type ClusterStatsIndicesShards

type ClusterStatsIndicesShards struct {
	Total       int                             `json:"total"`
	Primaries   int                             `json:"primaries"`
	Replication float64                         `json:"replication"`
	Index       *ClusterStatsIndicesShardsIndex `json:"index"`
}

ClusterStatsIndicesShards contains aggregate shard statistics for all indices in the cluster, including total shard count, primary count, replication factor, and per-index min/max/avg breakdowns.

type ClusterStatsIndicesShardsIndex

type ClusterStatsIndicesShardsIndex struct {
	Shards      *ClusterStatsIndicesShardsIndexIntMinMax     `json:"shards"`
	Primaries   *ClusterStatsIndicesShardsIndexIntMinMax     `json:"primaries"`
	Replication *ClusterStatsIndicesShardsIndexFloat64MinMax `json:"replication"`
}

ClusterStatsIndicesShardsIndex provides per-index min/max/avg statistics for shard counts, primary counts, and replication factors.

type ClusterStatsIndicesShardsIndexFloat64MinMax

type ClusterStatsIndicesShardsIndexFloat64MinMax struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
	Avg float64 `json:"avg"`
}

ClusterStatsIndicesShardsIndexFloat64MinMax holds minimum, maximum, and average float64 statistics for a per-index replication metric.

type ClusterStatsIndicesShardsIndexIntMinMax

type ClusterStatsIndicesShardsIndexIntMinMax struct {
	Min int     `json:"min"`
	Max int     `json:"max"`
	Avg float64 `json:"avg"`
}

ClusterStatsIndicesShardsIndexIntMinMax holds minimum, maximum, and average integer statistics for a per-index shard metric.

type ClusterStatsIndicesStore

type ClusterStatsIndicesStore struct {
	Size                    string `json:"size"`
	SizeInBytes             int64  `json:"size_in_bytes"`
	TotalDataSetSize        string `json:"total_data_set_size,omitempty"`
	TotalDataSetSizeInBytes int64  `json:"total_data_set_size_in_bytes,omitempty"`
	Reserved                string `json:"reserved,omitempty"`
	ReservedInBytes         int64  `json:"reserved_in_bytes,omitempty"`
}

ClusterStatsIndicesStore reports the total storage size used by all indices in the cluster in both human-readable and byte representations.

type ClusterStatsMappingStats

type ClusterStatsMappingStats struct {
	FieldTypes        []IndexFeatureStats `json:"field_types"`
	RuntimeFieldTypes []RuntimeFieldStats `json:"runtime_field_types"`
}

ClusterStatsMappingStats contains statistics about field types and runtime field types used across all index mappings in the cluster.

type ClusterStatsNodes

type ClusterStatsNodes struct {
	Count    *ClusterStatsNodesCount        `json:"count"`
	Versions []string                       `json:"versions"`
	OS       *ClusterStatsNodesOsStats      `json:"os"`
	Process  *ClusterStatsNodesProcessStats `json:"process"`
	JVM      *ClusterStatsNodesJvmStats     `json:"jvm"`
	FS       *ClusterStatsNodesFsStats      `json:"fs"`
	Plugins  []*ClusterStatsNodesPlugin     `json:"plugins"`

	NetworkTypes   *ClusterStatsNodesNetworkTypes   `json:"network_types"`
	DiscoveryTypes *ClusterStatsNodesDiscoveryTypes `json:"discovery_types"`
	PackagingTypes *ClusterStatsNodesPackagingTypes `json:"packaging_types"`

	Ingest *ClusterStatsNodesIngest `json:"ingest"`
}

ClusterStatsNodes aggregates node-level statistics across the cluster, including node role counts, OS, JVM, filesystem, plugin, network, discovery, ingest, and packaging information.

type ClusterStatsNodesCount

type ClusterStatsNodesCount struct {
	Total               int `json:"total"`
	Data                int `json:"data"`
	DataCold            int `json:"data_cold"`
	DataContent         int `json:"data_content"`
	DataFrozen          int `json:"data_frozen"`
	DataHot             int `json:"data_hot"`
	DataWarm            int `json:"data_warm"`
	CoordinatingOnly    int `json:"coordinating_only"`
	Master              int `json:"master"`
	Ingest              int `json:"ingest"`
	ML                  int `json:"ml"`
	RemoteClusterClient int `json:"remote_cluster_client"`
	Transform           int `json:"transform"`
	VotingOnly          int `json:"voting_only"`
}

ClusterStatsNodesCount breaks down the total node count by assigned roles such as data, master, ingest, ML, and coordinating-only nodes.

type ClusterStatsNodesDiscoveryTypes

type ClusterStatsNodesDiscoveryTypes any

ClusterStatsNodesDiscoveryTypes represents the discovery mechanism types in use across the cluster. It is an alias for any JSON-serializable value.

type ClusterStatsNodesFsStats

type ClusterStatsNodesFsStats struct {
	Path                 string `json:"path"`
	Mount                string `json:"mount"`
	Dev                  string `json:"dev"`
	Total                string `json:"total"`
	TotalInBytes         int64  `json:"total_in_bytes"`
	Free                 string `json:"free"`
	FreeInBytes          int64  `json:"free_in_bytes"`
	Available            string `json:"available"`
	AvailableInBytes     int64  `json:"available_in_bytes"`
	DiskReads            int64  `json:"disk_reads"`
	DiskWrites           int64  `json:"disk_writes"`
	DiskIOOp             int64  `json:"disk_io_op"`
	DiskReadSize         string `json:"disk_read_size"`
	DiskReadSizeInBytes  int64  `json:"disk_read_size_in_bytes"`
	DiskWriteSize        string `json:"disk_write_size"`
	DiskWriteSizeInBytes int64  `json:"disk_write_size_in_bytes"`
	DiskIOSize           string `json:"disk_io_size"`
	DiskIOSizeInBytes    int64  `json:"disk_io_size_in_bytes"`
	DiskQueue            string `json:"disk_queue"`
	DiskServiceTime      string `json:"disk_service_time"`
}

ClusterStatsNodesFsStats reports aggregate filesystem statistics across cluster nodes, including total, free, and available disk space, as well as I/O read/write metrics.

type ClusterStatsNodesIngest

type ClusterStatsNodesIngest struct {
	NumberOfPipelines int            `json:"number_of_pipelines"`
	ProcessorStats    map[string]any `json:"processor_stats"`
}

ClusterStatsNodesIngest reports ingest pipeline statistics at the cluster level, including the number of pipelines and per-processor stats.

type ClusterStatsNodesJvmStats

type ClusterStatsNodesJvmStats struct {
	MaxUptime         string                              `json:"max_uptime"`
	MaxUptimeInMillis int64                               `json:"max_uptime_in_millis"`
	Versions          []*ClusterStatsNodesJvmStatsVersion `json:"versions"`
	Mem               *ClusterStatsNodesJvmStatsMem       `json:"mem"`
	Threads           int64                               `json:"threads"`
}

ClusterStatsNodesJvmStats reports aggregate JVM statistics across the cluster, including uptime, JVM versions, heap memory usage, and thread counts.

type ClusterStatsNodesJvmStatsMem

type ClusterStatsNodesJvmStatsMem struct {
	HeapUsed        string `json:"heap_used"`
	HeapUsedInBytes int64  `json:"heap_used_in_bytes"`
	HeapMax         string `json:"heap_max"`
	HeapMaxInBytes  int64  `json:"heap_max_in_bytes"`
}

ClusterStatsNodesJvmStatsMem reports aggregate JVM heap memory statistics in both human-readable and byte representations.

type ClusterStatsNodesJvmStatsVersion

type ClusterStatsNodesJvmStatsVersion struct {
	Version         string `json:"version"`
	VMName          string `json:"vm_name"`
	VMVersion       string `json:"vm_version"`
	VMVendor        string `json:"vm_vendor"`
	BundledJDK      bool   `json:"bundled_jdk"`
	UsingBundledJDK bool   `json:"using_bundled_jdk"`
	Count           int    `json:"count"`
}

ClusterStatsNodesJvmStatsVersion describes a specific JVM version running on one or more nodes, including vendor, VM details, and node count.

type ClusterStatsNodesNetworkTypes

type ClusterStatsNodesNetworkTypes struct {
	TransportTypes map[string]any `json:"transport_types"`
	HTTPTypes      map[string]any `json:"http_types"`
}

ClusterStatsNodesNetworkTypes reports the network transport and HTTP types used across cluster nodes.

type ClusterStatsNodesOsStats

type ClusterStatsNodesOsStats struct {
	AvailableProcessors int `json:"available_processors"`
	AllocatedProcessors int `json:"allocated_processors"`
	Names               []struct {
		Name  string `json:"name"`
		Value int    `json:"count"`
	} `json:"names"`
	PrettyNames []struct {
		PrettyName string `json:"pretty_name"`
		Value      int    `json:"count"`
	} `json:"pretty_names"`
	Mem           *ClusterStatsNodesOsStatsMem `json:"mem"`
	Architectures []struct {
		Arch  string `json:"arch"`
		Count int    `json:"count"`
	} `json:"architectures"`
}

ClusterStatsNodesOsStats reports aggregate operating system statistics across cluster nodes, including processor counts, OS distribution, architecture, and memory utilization.

type ClusterStatsNodesOsStatsCPU

type ClusterStatsNodesOsStatsCPU struct {
	Vendor           string `json:"vendor"`
	Model            string `json:"model"`
	MHz              int    `json:"mhz"`
	TotalCores       int    `json:"total_cores"`
	TotalSockets     int    `json:"total_sockets"`
	CoresPerSocket   int    `json:"cores_per_socket"`
	CacheSize        string `json:"cache_size"`
	CacheSizeInBytes int64  `json:"cache_size_in_bytes"`
	Count            int    `json:"count"`
}

ClusterStatsNodesOsStatsCPU describes the CPU specifications of cluster nodes in aggregate, including vendor, model, core count, and cache size.

type ClusterStatsNodesOsStatsMem

type ClusterStatsNodesOsStatsMem struct {
	Total        string `json:"total"`
	TotalInBytes int64  `json:"total_in_bytes"`
	Free         string `json:"free"`
	FreeInBytes  int64  `json:"free_in_bytes"`
	Used         string `json:"used"`
	UsedInBytes  int64  `json:"used_in_bytes"`
	FreePercent  int    `json:"free_percent"`
	UsedPercent  int    `json:"used_percent"`
}

ClusterStatsNodesOsStatsMem represents aggregate memory statistics across cluster nodes in both human-readable and byte representations, including total, free, used, and percentage values.

type ClusterStatsNodesPackagingType

type ClusterStatsNodesPackagingType struct {
	Flavor string `json:"flavor"`
	Type   string `json:"type"`
	Count  int    `json:"count"`
}

ClusterStatsNodesPackagingType describes a single packaging distribution (flavor and type) and how many nodes use it.

type ClusterStatsNodesPackagingTypes

type ClusterStatsNodesPackagingTypes []*ClusterStatsNodesPackagingType

ClusterStatsNodesPackagingTypes is a list of packaging type entries describing how OpenSearch is distributed across cluster nodes.

type ClusterStatsNodesPlugin

type ClusterStatsNodesPlugin struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	URL         string `json:"url"`
	JVM         bool   `json:"jvm"`
	Site        bool   `json:"site"`
}

ClusterStatsNodesPlugin describes a plugin installed on cluster nodes, including its name, version, and whether it is a JVM or site plugin.

type ClusterStatsNodesProcessStats

type ClusterStatsNodesProcessStats struct {
	CPU                 *ClusterStatsNodesProcessStatsCPU                 `json:"cpu"`
	OpenFileDescriptors *ClusterStatsNodesProcessStatsOpenFileDescriptors `json:"open_file_descriptors"`
}

ClusterStatsNodesProcessStats reports aggregate process-level statistics across cluster nodes, including CPU usage and open file descriptor counts.

type ClusterStatsNodesProcessStatsCPU

type ClusterStatsNodesProcessStatsCPU struct {
	Percent float64 `json:"percent"`
}

ClusterStatsNodesProcessStatsCPU reports the average CPU percentage used by OpenSearch processes across the cluster.

type ClusterStatsNodesProcessStatsOpenFileDescriptors

type ClusterStatsNodesProcessStatsOpenFileDescriptors struct {
	Min int64 `json:"min"`
	Max int64 `json:"max"`
	Avg int64 `json:"avg"`
}

ClusterStatsNodesProcessStatsOpenFileDescriptors reports the min, max, and average open file descriptor counts across cluster nodes.

type ClusterStatsNodesResponse

type ClusterStatsNodesResponse struct {
	Total      int                          `json:"total"`
	Successful int                          `json:"successful"`
	Failed     int                          `json:"failed"`
	Failures   []*types.FailedNodeException `json:"failures,omitempty"`
}

ClusterStatsNodesResponse contains counts of total, successful, and failed nodes when collecting cluster-wide statistics.

type ClusterStatsResponse

type ClusterStatsResponse struct {
	NodesStats  *ClusterStatsNodesResponse `json:"_nodes,omitempty"`
	Timestamp   int64                      `json:"timestamp"`
	ClusterName string                     `json:"cluster_name"`
	ClusterUUID string                     `json:"cluster_uuid"`
	Status      string                     `json:"status,omitempty"`
	Indices     *ClusterStatsIndices       `json:"indices"`
	Nodes       *ClusterStatsNodes         `json:"nodes"`
}

ClusterStatsResponse represents the result of a cluster stats request. It aggregates index-level and node-level statistics across the entire cluster, including shard counts, document counts, storage, JVM, and OS stats.

type ClusterStatsVersionStats

type ClusterStatsVersionStats struct {
	Version           string `json:"version"`
	IndexCount        int    `json:"index_count"`
	PrimaryShardCount int    `json:"primary_shard_count"`
	TotalPrimarySize  string `json:"total_primary_size,omitempty"`
	TotalPrimaryBytes int64  `json:"total_primary_bytes,omitempty"`
}

ClusterStatsVersionStats tracks how many indices and primary shards are running a specific OpenSearch version along with total primary size.

type ClusterWeightedRoutingResponse

type ClusterWeightedRoutingResponse struct {
	Weights map[string]int `json:"weights,omitempty"`
}

ClusterWeightedRoutingResponse represents weighted routing awareness state.

type CreatePITParams

type CreatePITParams struct {
	Routing                 string
	Preference              string
	IgnoreUnavailable       bool
	AllowNoIndices          bool
	ExpandWildcards         string
	AllowPartialPitCreation bool
}

func (*CreatePITParams) ToMap

func (p *CreatePITParams) ToMap() map[string]string

type CreatePITRequest

type CreatePITRequest struct {
	Indices   []string `validate:"required,min=1"`
	KeepAlive string   `validate:"required"`
	Params    *CreatePITParams
}

func (*CreatePITRequest) Validate

func (r *CreatePITRequest) Validate() error

type CreateRequest

type CreateRequest struct {
	Index  string `validate:"required"`
	Id     string `validate:"required"`
	Body   any    `validate:"required"`
	Params *IndexParams
}

func (*CreateRequest) Validate

func (r *CreateRequest) Validate() error

type DataStream

type DataStream struct {
	// Name is the data stream name.
	Name string `json:"name"`
	// TimestampField specifies which field is used as the timestamp.
	TimestampField TimestampField `json:"timestamp_field"`
	// Indices lists the backing indices that hold the data stream's documents.
	Indices []DataStreamIndex `json:"indices"`
	// Generation is the current generation number of the data stream.
	Generation int64 `json:"generation"`
	// Status is the health status of the data stream (e.g. "GREEN", "YELLOW", "RED").
	Status string `json:"status"`
	// Template is the name of the composable index template associated with this data stream.
	Template string `json:"template"`
}

DataStream represents an OpenSearch data stream, which is a time-series collection of backing indices optimized for append-only data.

type DataStreamGetResponse

type DataStreamGetResponse struct {
	// DataStreams contains the data stream definitions returned.
	DataStreams []DataStream `json:"data_streams"`
}

DataStreamGetResponse represents the response from getting a data stream. It wraps a list of data stream definitions.

type DataStreamIndex

type DataStreamIndex struct {
	// IndexName is the name of the backing index.
	IndexName string `json:"index_name"`
	// IndexUUID is the unique identifier of the backing index.
	IndexUUID string `json:"index_uuid"`
}

DataStreamIndex identifies a backing index that belongs to a data stream.

type DataStreamStats

type DataStreamStats struct {
	DataStream       string `json:"data_stream"`
	BackingIndices   int    `json:"backing_indices"`
	StoreSize        string `json:"store_size,omitempty"`
	MaximumTimestamp int64  `json:"maximum_timestamp,omitempty"`
}

DataStreamStats contains statistics for a single data stream.

type DataStreamTemplate

type DataStreamTemplate struct {
	// Hidden indicates whether the data stream's backing indices are hidden from wildcard queries.
	Hidden *bool `json:"hidden,omitempty"`
	// AllowCustomRouting indicates whether custom routing is allowed for the data stream.
	AllowCustomRouting *bool `json:"allow_custom_routing,omitempty"`
}

DataStreamTemplate configures data stream behavior within a composable index template.

type DefaultAdService

type DefaultAdService struct {
	// contains filtered or unexported fields
}

DefaultAdService implements the AdService interface using a REST client.

func (*DefaultAdService) AdStats

func (s *DefaultAdService) AdStats(ctx context.Context, stat string) (*AdStatsResponse, error)

AdStats retrieves anomaly detection statistics, optionally for a specific stat name.

func (*DefaultAdService) DeleteDetector

func (s *DefaultAdService) DeleteDetector(ctx context.Context, detectorId string) (*AdDeleteDetectorResponse, error)

DeleteDetector deletes an anomaly detector by its ID.

func (*DefaultAdService) ExecuteDetector

func (s *DefaultAdService) ExecuteDetector(ctx context.Context, detectorId string, body any) (*AdExecuteDetectorResponse, error)

ExecuteDetector executes an anomaly detector on-demand, optionally with overrides.

func (*DefaultAdService) GetDetector

func (s *DefaultAdService) GetDetector(ctx context.Context, detectorId string) (*AdIndexDetectorResponse, error)

GetDetector retrieves an anomaly detector by its ID.

func (*DefaultAdService) IndexDetector

IndexDetector creates or updates an anomaly detector. When DetectorId is empty, a new detector is created via POST; when provided, the existing detector is updated via PUT.

func (*DefaultAdService) PreviewDetector

func (s *DefaultAdService) PreviewDetector(ctx context.Context, detectorId string, body any) (*AdPreviewDetectorResponse, error)

PreviewDetector previews an anomaly detector. When detectorId is empty, a new detector definition is previewed via POST to /_preview; when provided, the existing detector is previewed via POST to /{detectorId}/_preview. The body is required.

func (*DefaultAdService) SearchDetectors

func (s *DefaultAdService) SearchDetectors(ctx context.Context, body any) (*AdSearchDetectorsResponse, error)

SearchDetectors searches for anomaly detectors using the given query body.

func (*DefaultAdService) SearchResults

func (s *DefaultAdService) SearchResults(ctx context.Context, body any) (*AdSearchResultsResponse, error)

SearchResults searches for anomaly detection results using the given query body.

func (*DefaultAdService) SearchTopResults

func (s *DefaultAdService) SearchTopResults(ctx context.Context, detectorId string, body any) (*AdSearchResultsResponse, error)

SearchTopResults retrieves the top anomaly results for a detector.

func (*DefaultAdService) ValidateDetector

func (s *DefaultAdService) ValidateDetector(ctx context.Context, body any) (*AdValidateResponse, error)

ValidateDetector validates an anomaly detector configuration without persisting it.

type DefaultAlertingService

type DefaultAlertingService struct {
	// contains filtered or unexported fields
}

DefaultAlertingService implements the AlertingService interface using a REST client.

func (*DefaultAlertingService) AcknowledgeAlert

func (s *DefaultAlertingService) AcknowledgeAlert(ctx context.Context, monitorId string, body any) (*AlertingAcknowledgeAlertResponse, error)

AcknowledgeAlert acknowledges one or more alerts for a monitor.

func (*DefaultAlertingService) AcknowledgeChainedAlerts

func (s *DefaultAlertingService) AcknowledgeChainedAlerts(ctx context.Context, workflowId string, body any) (*AlertingAcknowledgeAlertResponse, error)

AcknowledgeChainedAlerts acknowledges chained alerts for a workflow.

func (*DefaultAlertingService) DeleteMonitor

func (s *DefaultAlertingService) DeleteMonitor(ctx context.Context, monitorId string) (*AlertingDeleteMonitorResponse, error)

DeleteMonitor deletes a monitor by its ID.

func (*DefaultAlertingService) DeleteWorkflow

func (s *DefaultAlertingService) DeleteWorkflow(ctx context.Context, workflowId string) (*AlertingDeleteWorkflowResponse, error)

DeleteWorkflow deletes a workflow by its ID.

func (*DefaultAlertingService) ExecuteMonitor

func (s *DefaultAlertingService) ExecuteMonitor(ctx context.Context, monitorId string, body any) (*AlertingExecuteMonitorResponse, error)

ExecuteMonitor executes a monitor on-demand, optionally with trigger overrides.

func (*DefaultAlertingService) ExecuteWorkflow

func (s *DefaultAlertingService) ExecuteWorkflow(ctx context.Context, workflowId string, body any) (*AlertingExecuteWorkflowResponse, error)

ExecuteWorkflow executes a workflow on-demand, optionally with overrides.

func (*DefaultAlertingService) GetAlerts

GetAlerts retrieves alerts with optional query parameters.

func (*DefaultAlertingService) GetDestinations

func (s *DefaultAlertingService) GetDestinations(ctx context.Context, destinationId string) (*AlertingGetDestinationsResponse, error)

GetDestinations retrieves destinations, optionally filtered by destination ID.

func (*DefaultAlertingService) GetFindings

GetFindings retrieves alerting findings with optional query parameters.

func (*DefaultAlertingService) GetMonitor

GetMonitor retrieves a monitor by its ID.

func (*DefaultAlertingService) GetWorkflow

func (s *DefaultAlertingService) GetWorkflow(ctx context.Context, workflowId string) (*AlertingGetWorkflowResponse, error)

GetWorkflow retrieves a workflow by its ID.

func (*DefaultAlertingService) GetWorkflowAlerts

func (s *DefaultAlertingService) GetWorkflowAlerts(ctx context.Context, params map[string]string) (*AlertingGetAlertsResponse, error)

GetWorkflowAlerts retrieves workflow alerts with optional query parameters.

func (*DefaultAlertingService) IndexWorkflow

IndexWorkflow creates or updates a workflow.

func (*DefaultAlertingService) PostMonitor

PostMonitor creates a new monitor.

func (*DefaultAlertingService) PutMonitor

PutMonitor updates an existing monitor.

func (*DefaultAlertingService) SearchMonitor

func (s *DefaultAlertingService) SearchMonitor(ctx context.Context, body any) ([]AlertingSearchMonitorHit, error)

SearchMonitor searches for monitors using the given query body.

type DefaultAsyncSearchService

type DefaultAsyncSearchService struct {
	// contains filtered or unexported fields
}

DefaultAsyncSearchService is the default implementation of AsyncSearchService.

func (*DefaultAsyncSearchService) AsyncDelete

func (*DefaultAsyncSearchService) AsyncGet

func (*DefaultAsyncSearchService) AsyncStats

func (*DefaultAsyncSearchService) Submit

type DefaultCatService

type DefaultCatService struct {
	// contains filtered or unexported fields
}

DefaultCatService is the default implementation of CatService, backed by an HTTP client and a structured logger.

func (*DefaultCatService) Aliases

func (s *DefaultCatService) Aliases(ctx context.Context, names []string) (CatAliasesResponse, error)

Aliases retrieves alias information from the /_cat/aliases endpoint. If names is non-empty, only the specified alias names are returned. Returns a CatAliasesResponse containing rows with alias, index, filter, and routing information.

func (*DefaultCatService) Allocation

func (s *DefaultCatService) Allocation(ctx context.Context, nodeIds []string) (CatAllocationResponse, error)

Allocation retrieves shard allocation and disk usage information per node from the /_cat/allocation endpoint. If nodeIds is non-empty, only the specified nodes are returned. Returns a CatAllocationResponse containing rows with shard count, disk usage, and node details.

func (*DefaultCatService) CatNodes

CatNodes retrieves node information from the /_cat/nodes endpoint. Returns a CatNodesResponse containing rows with IP, heap, CPU, load, role, and version data.

func (*DefaultCatService) CatPendingTasks

func (s *DefaultCatService) CatPendingTasks(ctx context.Context) (CatPendingTasksResponse, error)

CatPendingTasks retrieves cluster-level pending tasks from the /_cat/pending_tasks endpoint. Returns a CatPendingTasksResponse containing rows with insert order, time in queue, priority, and source.

func (*DefaultCatService) CatRecovery

func (s *DefaultCatService) CatRecovery(ctx context.Context, indices []string) (CatRecoveryResponse, error)

CatRecovery retrieves shard recovery information from the /_cat/recovery endpoint. If indices is non-empty, only recoveries for the specified indices are returned. Returns a CatRecoveryResponse containing rows with recovery stage, timing, and progress.

func (*DefaultCatService) CatTasks

CatTasks retrieves currently running task information from the /_cat/tasks endpoint. Returns a CatTasksResponse containing rows with task ID, action, node, running time, and type.

func (*DefaultCatService) ClusterManager

ClusterManager retrieves information about the currently elected cluster manager from the /_cat/cluster_manager endpoint, which is the non-deprecated alias for /_cat/master. Returns a CatClusterManagerResponse containing a row with the manager node's IP, ID, host, and name.

func (*DefaultCatService) Count

func (s *DefaultCatService) Count(ctx context.Context, indices []string) (CatCountResponse, error)

Count retrieves document counts from the /_cat/count endpoint. If indices is non-empty, only the specified indices are counted. Returns a CatCountResponse containing a row with epoch, timestamp, and count.

func (*DefaultCatService) Fielddata

func (s *DefaultCatService) Fielddata(ctx context.Context, fields []string) (CatFielddataResponse, error)

Fielddata retrieves fielddata memory usage per node and per field from the /_cat/fielddata endpoint. If fields is non-empty, only the specified fields are returned. Returns a CatFielddataResponse containing rows with node and field memory info.

func (*DefaultCatService) Health

Health retrieves a compact cluster health overview from the /_cat/health endpoint. Returns a CatHealthResponse containing a row with cluster name, status, node and shard counts, and active shard percentage.

func (*DefaultCatService) Help

func (s *DefaultCatService) Help(ctx context.Context) (string, error)

Help retrieves the list of available cat API endpoints from the /_cat endpoint. The response is plain text, not JSON.

func (*DefaultCatService) Indices

func (s *DefaultCatService) Indices(ctx context.Context, indices []string) (CatIndicesResponse, error)

Indices retrieves compact index information from the /_cat/indices endpoint. If indices is non-empty, only the specified indices are returned. Returns a CatIndicesResponse containing rows with health, status, doc counts, store sizes, and other per-index metrics.

func (*DefaultCatService) Master

Master retrieves information about the currently elected cluster manager from the /_cat/master endpoint. Returns a CatMasterResponse containing a row with the master node's ID, host, IP, and name.

func (*DefaultCatService) NodeAttrs

NodeAttrs retrieves custom node attribute information from the /_cat/nodeattrs endpoint. Returns a CatNodeAttrsResponse containing rows with node, host, IP, attribute name, and value.

func (*DefaultCatService) Plugins

Plugins retrieves plugin information from the /_cat/plugins endpoint. Returns a CatPluginsResponse containing rows with plugin name, component, and version.

func (*DefaultCatService) Repositories

Repositories retrieves registered snapshot repository information from the /_cat/repositories endpoint. Returns a CatRepositoriesResponse containing rows with repository ID and type.

func (*DefaultCatService) SegmentReplication

func (s *DefaultCatService) SegmentReplication(ctx context.Context, indices []string) (CatSegmentReplicationResponse, error)

SegmentReplication retrieves segment replication checkpoint information from the /_cat/segment_replication endpoint. If indices is non-empty, only segment replication data for the specified indices is returned. Returns a CatSegmentReplicationResponse containing rows with shard, checkpoint, and timing data.

func (*DefaultCatService) Segments

func (s *DefaultCatService) Segments(ctx context.Context, indices []string) (CatSegmentsResponse, error)

Segments retrieves low-level Lucene segment information from the /_cat/segments endpoint. If indices is non-empty, only segments for the specified indices are returned. Returns a CatSegmentsResponse containing rows with index, shard, segment ID, version, and size.

func (*DefaultCatService) Shards

func (s *DefaultCatService) Shards(ctx context.Context, indices []string) (CatShardsResponse, error)

Shards retrieves compact shard information from the /_cat/shards endpoint. If indices is non-empty, only shards of the specified indices are returned. Returns a CatShardsResponse containing rows with index, shard number, state, node, and per-shard metrics.

func (*DefaultCatService) Snapshots

func (s *DefaultCatService) Snapshots(ctx context.Context, repository string) (CatSnapshotsResponse, error)

Snapshots retrieves snapshot information from the /_cat/snapshots endpoint. If repository is non-empty, only snapshots from that repository are returned. Returns a CatSnapshotsResponse containing rows with snapshot ID, status, timing, and shard counts.

func (*DefaultCatService) Templates

Templates retrieves index template information from the /_cat/templates endpoint. If name is non-empty, only the specified template is returned. Returns a CatTemplatesResponse containing rows with name, index patterns, order, and version.

func (*DefaultCatService) ThreadPool

func (s *DefaultCatService) ThreadPool(ctx context.Context, patterns []string) (CatThreadPoolResponse, error)

ThreadPool retrieves thread pool statistics from the /_cat/thread_pool endpoint. If patterns is non-empty, only thread pools matching the given patterns are returned. Returns a CatThreadPoolResponse containing rows with node name, pool name, active count, queue, rejected, and completed counters.

type DefaultCcrService

type DefaultCcrService struct {
	// contains filtered or unexported fields
}

func (*DefaultCcrService) AutoFollowStatus

func (s *DefaultCcrService) AutoFollowStatus(ctx context.Context) (*CcrAutoFollowStatusResponse, error)

func (*DefaultCcrService) DeleteAutoFollow

func (*DefaultCcrService) FollowerStats

func (*DefaultCcrService) LeaderStats

func (*DefaultCcrService) PauseRule

func (s *DefaultCcrService) PauseRule(ctx context.Context, name string) (*CcrPauseRuleResponse, error)

func (*DefaultCcrService) PostAutoFollow

func (*DefaultCcrService) ResumeRule

func (s *DefaultCcrService) ResumeRule(ctx context.Context, name string) (*CcrResumeRuleResponse, error)

func (*DefaultCcrService) StartRule

func (*DefaultCcrService) StatusRule

func (s *DefaultCcrService) StatusRule(ctx context.Context, name string) (*CcrStatusRuleResponse, error)

func (*DefaultCcrService) StopRule

func (s *DefaultCcrService) StopRule(ctx context.Context, name string) (*CcrStopRuleResponse, error)

func (*DefaultCcrService) UpdateRule

func (s *DefaultCcrService) UpdateRule(ctx context.Context, name string, body any) (*CcrUpdateRuleResponse, error)

UpdateRule updates the configuration of a cross-cluster replication rule.

type DefaultClusterService

type DefaultClusterService struct {
	// contains filtered or unexported fields
}

func (*DefaultClusterService) AllocationExplain

func (s *DefaultClusterService) AllocationExplain(ctx context.Context, body any) (*ClusterAllocationExplainResponse, error)

func (*DefaultClusterService) DeleteDecommissionAwareness

func (s *DefaultClusterService) DeleteDecommissionAwareness(ctx context.Context) (*types.AcknowledgedResponse, error)

func (*DefaultClusterService) DeleteVotingConfigExclusions

func (s *DefaultClusterService) DeleteVotingConfigExclusions(ctx context.Context, waitForRemoval bool) (*types.AcknowledgedResponse, error)

func (*DefaultClusterService) DeleteWeightedRouting

func (s *DefaultClusterService) DeleteWeightedRouting(ctx context.Context) (*types.AcknowledgedResponse, error)

func (*DefaultClusterService) ExistsComponentTemplate

func (s *DefaultClusterService) ExistsComponentTemplate(ctx context.Context, name string) (bool, error)

func (*DefaultClusterService) GetDecommissionAwareness

func (s *DefaultClusterService) GetDecommissionAwareness(ctx context.Context, attributeName string) (*ClusterDecommissionAwarenessResponse, error)

func (*DefaultClusterService) GetSettings

func (s *DefaultClusterService) GetSettings(ctx context.Context) (map[string]any, error)

func (*DefaultClusterService) GetWeightedRouting

func (s *DefaultClusterService) GetWeightedRouting(ctx context.Context, attribute string) (*ClusterWeightedRoutingResponse, error)

func (*DefaultClusterService) Health

func (*DefaultClusterService) PendingTasks

func (*DefaultClusterService) PostVotingConfigExclusions

func (s *DefaultClusterService) PostVotingConfigExclusions(ctx context.Context, params map[string]string) (*types.AcknowledgedResponse, error)

func (*DefaultClusterService) PutDecommissionAwareness

func (s *DefaultClusterService) PutDecommissionAwareness(ctx context.Context, attributeName string, attributeValue string) (*types.AcknowledgedResponse, error)

func (*DefaultClusterService) PutSettings

func (s *DefaultClusterService) PutSettings(ctx context.Context, body any) (map[string]any, error)

func (*DefaultClusterService) PutWeightedRouting

func (s *DefaultClusterService) PutWeightedRouting(ctx context.Context, attribute string, body any) (*ClusterWeightedRoutingResponse, error)

func (*DefaultClusterService) RemoteInfo

func (s *DefaultClusterService) RemoteInfo(ctx context.Context) (map[string]any, error)

func (*DefaultClusterService) Reroute

func (*DefaultClusterService) State

func (*DefaultClusterService) Stats

type DefaultDocumentService

type DefaultDocumentService struct {
	// contains filtered or unexported fields
}

func (*DefaultDocumentService) Bulk

func (s *DefaultDocumentService) Bulk(ctx context.Context, index string, body string) (*BulkResponse, error)

func (*DefaultDocumentService) Create

func (*DefaultDocumentService) Delete

func (*DefaultDocumentService) DeleteByQuery

func (s *DefaultDocumentService) DeleteByQuery(ctx context.Context, indices []string, body any) (*BulkIndexByScrollResponse, error)

func (*DefaultDocumentService) DeleteByQueryRethrottle

func (s *DefaultDocumentService) DeleteByQueryRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)

func (*DefaultDocumentService) Exists

func (s *DefaultDocumentService) Exists(ctx context.Context, index string, id string) (bool, error)

func (*DefaultDocumentService) ExistsSource

func (s *DefaultDocumentService) ExistsSource(ctx context.Context, index string, id string) (bool, error)

func (*DefaultDocumentService) Explain

func (s *DefaultDocumentService) Explain(ctx context.Context, index string, id string, body any) (*ExplainResponse, error)

func (*DefaultDocumentService) Get

func (*DefaultDocumentService) GetSource

func (s *DefaultDocumentService) GetSource(ctx context.Context, index string, id string) (json.RawMessage, error)

func (*DefaultDocumentService) Index

func (*DefaultDocumentService) MultiGet

func (s *DefaultDocumentService) MultiGet(ctx context.Context, items []*MultiGetItem) (*MgetResponse, error)

func (*DefaultDocumentService) MultiTermVectors

func (s *DefaultDocumentService) MultiTermVectors(ctx context.Context, index string, body any) (*MultiTermvectorResponse, error)

func (*DefaultDocumentService) Reindex

func (*DefaultDocumentService) ReindexRethrottle

func (s *DefaultDocumentService) ReindexRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)

func (*DefaultDocumentService) TermVectors

func (s *DefaultDocumentService) TermVectors(ctx context.Context, index string, id string, body any) (*TermvectorsResponse, error)

func (*DefaultDocumentService) Update

func (*DefaultDocumentService) UpdateByQuery

func (s *DefaultDocumentService) UpdateByQuery(ctx context.Context, indices []string, body any) (*BulkIndexByScrollResponse, error)

func (*DefaultDocumentService) UpdateByQueryRethrottle

func (s *DefaultDocumentService) UpdateByQueryRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)

type DefaultIndicesService

type DefaultIndicesService struct {
	// contains filtered or unexported fields
}

func (*DefaultIndicesService) AddBlock

func (*DefaultIndicesService) Analyze

func (s *DefaultIndicesService) Analyze(ctx context.Context, index string, body any) (*IndicesAnalyzeResponse, error)

func (*DefaultIndicesService) ClearCache

func (s *DefaultIndicesService) ClearCache(ctx context.Context, indices []string) (*IndicesClearCacheResponse, error)

func (*DefaultIndicesService) Clone

func (*DefaultIndicesService) Close

func (*DefaultIndicesService) Create

func (*DefaultIndicesService) CreateDataStream

func (s *DefaultIndicesService) CreateDataStream(ctx context.Context, name string) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) DataStreamsStats

func (s *DefaultIndicesService) DataStreamsStats(ctx context.Context, names []string) (*IndicesDataStreamsStatsResponse, error)

func (*DefaultIndicesService) Delete

func (*DefaultIndicesService) DeleteAlias

func (*DefaultIndicesService) DeleteComponentTemplate

func (s *DefaultIndicesService) DeleteComponentTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) DeleteDataStream

func (s *DefaultIndicesService) DeleteDataStream(ctx context.Context, names []string) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) DeleteIndexTemplate

func (s *DefaultIndicesService) DeleteIndexTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) DeleteTemplate

func (s *DefaultIndicesService) DeleteTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) Exists

func (s *DefaultIndicesService) Exists(ctx context.Context, indices []string) (bool, error)

func (*DefaultIndicesService) ExistsAlias

func (s *DefaultIndicesService) ExistsAlias(ctx context.Context, indices []string, name string) (bool, error)

func (*DefaultIndicesService) ExistsIndexTemplate

func (s *DefaultIndicesService) ExistsIndexTemplate(ctx context.Context, name string) (bool, error)

func (*DefaultIndicesService) ExistsTemplate

func (s *DefaultIndicesService) ExistsTemplate(ctx context.Context, name string) (bool, error)

func (*DefaultIndicesService) Flush

func (*DefaultIndicesService) Forcemerge

func (s *DefaultIndicesService) Forcemerge(ctx context.Context, indices []string) (*IndicesForcemergeResponse, error)

func (*DefaultIndicesService) Freeze deprecated

Deprecated: Freeze is not supported in OpenSearch (Elasticsearch-only).

func (*DefaultIndicesService) Get

func (*DefaultIndicesService) GetAliases

func (s *DefaultIndicesService) GetAliases(ctx context.Context, indices []string) (map[string]*IndicesGetResponse, error)

func (*DefaultIndicesService) GetComponentTemplate

func (s *DefaultIndicesService) GetComponentTemplate(ctx context.Context, names []string) (*IndicesGetComponentTemplateResponse, error)

func (*DefaultIndicesService) GetDataStream

func (*DefaultIndicesService) GetFieldMapping

func (s *DefaultIndicesService) GetFieldMapping(ctx context.Context, req *GetFieldMappingRequest) (map[string]any, error)

func (*DefaultIndicesService) GetIndexTemplate

func (s *DefaultIndicesService) GetIndexTemplate(ctx context.Context, names []string) (*IndicesGetIndexTemplateResponse, error)

func (*DefaultIndicesService) GetMapping

func (s *DefaultIndicesService) GetMapping(ctx context.Context, indices []string) (map[string]any, error)

func (*DefaultIndicesService) GetSettings

func (s *DefaultIndicesService) GetSettings(ctx context.Context, indices []string) (map[string]*IndicesGetSettingsResponse, error)

func (*DefaultIndicesService) GetTemplate

func (s *DefaultIndicesService) GetTemplate(ctx context.Context, names []string) (map[string]*IndicesGetTemplateResponse, error)

func (*DefaultIndicesService) Open

Open opens a closed index.

See https://opensearch.org/docs/latest/api-reference/index-apis/open-index/

func (*DefaultIndicesService) PutAlias

func (*DefaultIndicesService) PutComponentTemplate

func (*DefaultIndicesService) PutIndexTemplate

func (*DefaultIndicesService) PutMapping

func (*DefaultIndicesService) PutSettings

func (s *DefaultIndicesService) PutSettings(ctx context.Context, indices []string, body any) (*types.AcknowledgedResponse, error)

func (*DefaultIndicesService) PutTemplate

func (*DefaultIndicesService) Recovery

func (s *DefaultIndicesService) Recovery(ctx context.Context, indices []string) (*IndicesRecoveryResponse, error)

func (*DefaultIndicesService) Refresh

func (s *DefaultIndicesService) Refresh(ctx context.Context, indices []string) (*RefreshResult, error)

func (*DefaultIndicesService) ResolveIndex

func (*DefaultIndicesService) Rollover

func (s *DefaultIndicesService) Rollover(ctx context.Context, alias string, body any) (*IndicesRolloverResponse, error)

func (*DefaultIndicesService) Segments

func (s *DefaultIndicesService) Segments(ctx context.Context, indices []string) (*IndicesSegmentsResponse, error)

func (*DefaultIndicesService) ShardStores

func (s *DefaultIndicesService) ShardStores(ctx context.Context, indices []string) (*IndicesShardStoresResponse, error)

func (*DefaultIndicesService) Shrink

func (*DefaultIndicesService) SimulateIndexTemplate

func (*DefaultIndicesService) SimulateTemplate

func (*DefaultIndicesService) Split

func (*DefaultIndicesService) Stats

func (*DefaultIndicesService) Unfreeze deprecated

Deprecated: Unfreeze is not supported in OpenSearch (Elasticsearch-only).

func (*DefaultIndicesService) UpdateAliases

func (s *DefaultIndicesService) UpdateAliases(ctx context.Context, body any) (*types.AcknowledgedResponse, error)

type DefaultInfoService

type DefaultInfoService struct {
	// contains filtered or unexported fields
}

DefaultInfoService is the default InfoService implementation.

func (*DefaultInfoService) Info

func (*DefaultInfoService) Ping

func (s *DefaultInfoService) Ping(ctx context.Context) (bool, error)

type DefaultIngestService

type DefaultIngestService struct {
	// contains filtered or unexported fields
}

func (*DefaultIngestService) DeletePipeline

func (*DefaultIngestService) GetPipeline

func (*DefaultIngestService) ProcessorGrok

func (s *DefaultIngestService) ProcessorGrok(ctx context.Context) (map[string][]string, error)

func (*DefaultIngestService) PutPipeline

func (*DefaultIngestService) SimulatePipeline

type DefaultIsmService

type DefaultIsmService struct {
	// contains filtered or unexported fields
}

func (*DefaultIsmService) AddPolicy

func (s *DefaultIsmService) AddPolicy(ctx context.Context, index string, body any) (*IsmActionResponse, error)

AddPolicy attaches an ISM policy to one or more indices.

func (*DefaultIsmService) ChangePolicy

func (s *DefaultIsmService) ChangePolicy(ctx context.Context, index string, body any) (*IsmActionResponse, error)

ChangePolicy updates the ISM policy attached to one or more indices, optionally transitioning them to a new state.

func (*DefaultIsmService) DeletePolicy

func (s *DefaultIsmService) DeletePolicy(ctx context.Context, policyName string) (*IsmDeletePolicyResponse, error)

func (*DefaultIsmService) ExplainPolicy

func (s *DefaultIsmService) ExplainPolicy(ctx context.Context, indexName string) (*IsmExplainPolicyResponse, error)

func (*DefaultIsmService) GetPolicy

func (s *DefaultIsmService) GetPolicy(ctx context.Context, policyName string) (*IsmGetPolicyResponse, error)

func (*DefaultIsmService) ListPolicies

ListPolicies returns all ISM policies defined in the cluster.

func (*DefaultIsmService) PutPolicy

func (*DefaultIsmService) RemovePolicy

func (s *DefaultIsmService) RemovePolicy(ctx context.Context, index string) (*IsmActionResponse, error)

RemovePolicy detaches any ISM policy from one or more indices.

func (*DefaultIsmService) RetryFailedIndex

func (s *DefaultIsmService) RetryFailedIndex(ctx context.Context, index string, body any) (*IsmActionResponse, error)

RetryFailedIndex retries a failed ISM policy action on one or more indices, optionally specifying a target state.

type DefaultKnnService

type DefaultKnnService struct {
	// contains filtered or unexported fields
}

DefaultKnnService is the default implementation of KnnService.

func (*DefaultKnnService) ClearCache

func (s *DefaultKnnService) ClearCache(ctx context.Context, index string) (*types.AcknowledgedResponse, error)

func (*DefaultKnnService) DeleteModel

func (s *DefaultKnnService) DeleteModel(ctx context.Context, modelId string) (*types.AcknowledgedResponse, error)

func (*DefaultKnnService) GetModel

func (s *DefaultKnnService) GetModel(ctx context.Context, modelId string) (*KnnGetModelResponse, error)

func (*DefaultKnnService) KnnStats

func (s *DefaultKnnService) KnnStats(ctx context.Context, stat string) (*KnnStatsResponse, error)

func (*DefaultKnnService) KnnWarmup

func (s *DefaultKnnService) KnnWarmup(ctx context.Context, index string) (*KnnWarmupResponse, error)

func (*DefaultKnnService) SearchModels

func (s *DefaultKnnService) SearchModels(ctx context.Context, body any) (*KnnSearchModelsResponse, error)

func (*DefaultKnnService) TrainModel

func (s *DefaultKnnService) TrainModel(ctx context.Context, body any) (*KnnTrainModelResponse, error)

type DefaultMlService

type DefaultMlService struct {
	// contains filtered or unexported fields
}

DefaultMlService implements the MlService interface using a REST client.

func (*DefaultMlService) CreateConnector

func (s *DefaultMlService) CreateConnector(ctx context.Context, body any) (*MlCreateConnectorResponse, error)

CreateConnector creates a new connector for external model integration.

func (*DefaultMlService) DeleteAgent

func (s *DefaultMlService) DeleteAgent(ctx context.Context, agentId string) (*types.AcknowledgedResponse, error)

DeleteAgent deletes an agent by its ID.

func (*DefaultMlService) DeleteConnector

func (s *DefaultMlService) DeleteConnector(ctx context.Context, connectorId string) (*types.AcknowledgedResponse, error)

DeleteConnector deletes a connector by its ID.

func (*DefaultMlService) DeleteModel

func (s *DefaultMlService) DeleteModel(ctx context.Context, modelId string) (*types.AcknowledgedResponse, error)

DeleteModel deletes a model by its ID.

func (*DefaultMlService) DeleteModelGroup

func (s *DefaultMlService) DeleteModelGroup(ctx context.Context, modelGroupId string) (*types.AcknowledgedResponse, error)

DeleteModelGroup deletes a model group by its ID.

func (*DefaultMlService) DeleteTask

func (s *DefaultMlService) DeleteTask(ctx context.Context, taskId string) (*types.AcknowledgedResponse, error)

DeleteTask deletes an ML task by its ID.

func (*DefaultMlService) DeployModel

func (s *DefaultMlService) DeployModel(ctx context.Context, modelId string) (*MlDeployModelResponse, error)

DeployModel deploys a registered model to memory for inference.

func (*DefaultMlService) Execute

func (s *DefaultMlService) Execute(ctx context.Context, algorithm string, body any) (MlExecuteResponse, error)

Execute runs an ML algorithm with the given input body.

func (*DefaultMlService) ExecuteTool

func (s *DefaultMlService) ExecuteTool(ctx context.Context, toolName string, body any) (MlExecuteToolResponse, error)

ExecuteTool executes a specific tool by name with the given input body.

func (*DefaultMlService) GetAgent

func (s *DefaultMlService) GetAgent(ctx context.Context, agentId string) (MlGetAgentResponse, error)

GetAgent retrieves the details of an agent by its ID.

func (*DefaultMlService) GetConnector

func (s *DefaultMlService) GetConnector(ctx context.Context, connectorId string) (MlGetConnectorResponse, error)

GetConnector retrieves the details of a connector by its ID.

func (*DefaultMlService) GetModel

func (s *DefaultMlService) GetModel(ctx context.Context, modelId string) (MlGetModelResponse, error)

GetModel retrieves the details of a model by its ID.

func (*DefaultMlService) GetTask

func (s *DefaultMlService) GetTask(ctx context.Context, taskId string) (MlGetTaskResponse, error)

GetTask retrieves the details of an ML task by its ID.

func (*DefaultMlService) ListTools

ListTools lists all available tools in the ML Commons plugin.

func (*DefaultMlService) MlStats

func (s *DefaultMlService) MlStats(ctx context.Context, stat string) (MlStatsResponse, error)

MlStats retrieves ML plugin statistics, optionally filtered by stat name.

func (*DefaultMlService) Predict

func (s *DefaultMlService) Predict(ctx context.Context, modelId string, body any) (*MlPredictResponse, error)

Predict runs inference on a deployed model using the given input body.

func (*DefaultMlService) Profile

func (s *DefaultMlService) Profile(ctx context.Context, path string) (MlProfileResponse, error)

Profile retrieves ML profile information, optionally for a specific model or task. Pass an empty string for the base profile endpoint, or a path such as "models/{modelId}" or "tasks/{taskId}" for targeted profile information.

func (*DefaultMlService) RegisterAgent

func (s *DefaultMlService) RegisterAgent(ctx context.Context, body any) (*MlRegisterAgentResponse, error)

RegisterAgent registers a new agent in the ML Commons plugin.

func (*DefaultMlService) RegisterModel

func (s *DefaultMlService) RegisterModel(ctx context.Context, body any) (*MlRegisterModelResponse, error)

RegisterModel registers a new model in the ML Commons plugin.

func (*DefaultMlService) RegisterModelGroup

func (s *DefaultMlService) RegisterModelGroup(ctx context.Context, body any) (*MlRegisterModelGroupResponse, error)

RegisterModelGroup registers a new model group in the ML Commons plugin.

func (*DefaultMlService) SearchAgents

func (s *DefaultMlService) SearchAgents(ctx context.Context, body any) (MlSearchAgentsResponse, error)

SearchAgents searches for agents using the given query body.

func (*DefaultMlService) SearchConnectors

func (s *DefaultMlService) SearchConnectors(ctx context.Context, body any) (MlSearchConnectorsResponse, error)

SearchConnectors searches for connectors using the given query body.

func (*DefaultMlService) SearchModels

func (s *DefaultMlService) SearchModels(ctx context.Context, body any) (MlSearchModelsResponse, error)

SearchModels searches for models using the given query body.

func (*DefaultMlService) Train

func (s *DefaultMlService) Train(ctx context.Context, algorithm string, body any) (*MlTrainResponse, error)

Train trains a model using the specified algorithm and training data.

func (*DefaultMlService) TrainAndPredict

func (s *DefaultMlService) TrainAndPredict(ctx context.Context, algorithm string, body any) (*MlPredictResponse, error)

TrainAndPredict trains a model and runs prediction in a single step using the specified algorithm.

func (*DefaultMlService) UndeployModel

func (s *DefaultMlService) UndeployModel(ctx context.Context, modelId string) (MlUndeployModelResponse, error)

UndeployModel undeploys a deployed model from memory.

func (*DefaultMlService) UpdateModel

func (s *DefaultMlService) UpdateModel(ctx context.Context, modelId string, body any) (MlUpdateModelResponse, error)

UpdateModel updates a model by its ID with the given body.

type DefaultNeuralService

type DefaultNeuralService struct {
	// contains filtered or unexported fields
}

DefaultNeuralService is the default implementation of NeuralService.

func (*DefaultNeuralService) NeuralClearCache

func (s *DefaultNeuralService) NeuralClearCache(ctx context.Context, index string) (*types.AcknowledgedResponse, error)

func (*DefaultNeuralService) NeuralStats

func (s *DefaultNeuralService) NeuralStats(ctx context.Context, stat string) (*NeuralStatsResponse, error)

func (*DefaultNeuralService) NeuralWarmup

func (s *DefaultNeuralService) NeuralWarmup(ctx context.Context, index string) (*NeuralWarmupResponse, error)

type DefaultNodesService

type DefaultNodesService struct {
	// contains filtered or unexported fields
}

func (*DefaultNodesService) HotThreads

func (s *DefaultNodesService) HotThreads(ctx context.Context, nodeIds []string) (string, error)

func (*DefaultNodesService) Info

func (*DefaultNodesService) ReloadSecureSettings

func (s *DefaultNodesService) ReloadSecureSettings(ctx context.Context, body any) (*NodesReloadSecureSettingsResponse, error)

func (*DefaultNodesService) Stats

func (*DefaultNodesService) Usage

type DefaultRollupService

type DefaultRollupService struct {
	// contains filtered or unexported fields
}

DefaultRollupService is the default RollupService implementation.

func (*DefaultRollupService) DeleteRollup

func (s *DefaultRollupService) DeleteRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)

DeleteRollup deletes a rollup job.

func (*DefaultRollupService) ExplainRollup

func (s *DefaultRollupService) ExplainRollup(ctx context.Context, rollupId string) (map[string]*RollupExplainResponse, error)

ExplainRollup retrieves runtime explain information for a rollup job.

func (*DefaultRollupService) GetRollup

func (s *DefaultRollupService) GetRollup(ctx context.Context, rollupId string) (*RollupGetResponse, error)

GetRollup retrieves a rollup job by its ID.

func (*DefaultRollupService) PutRollup

func (s *DefaultRollupService) PutRollup(ctx context.Context, rollupId string, body any) (*RollupGetResponse, error)

PutRollup creates or updates a rollup job.

func (*DefaultRollupService) StartRollup

func (s *DefaultRollupService) StartRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)

StartRollup starts a rollup job.

func (*DefaultRollupService) StopRollup

func (s *DefaultRollupService) StopRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)

StopRollup stops a rollup job.

type DefaultScriptService

type DefaultScriptService struct {
	// contains filtered or unexported fields
}

func (*DefaultScriptService) Delete

func (*DefaultScriptService) Get

func (*DefaultScriptService) GetContext

func (*DefaultScriptService) GetLanguages

func (*DefaultScriptService) PainlessExecute

func (s *DefaultScriptService) PainlessExecute(ctx context.Context, body any) (*PainlessExecuteResponse, error)

func (*DefaultScriptService) Put

type DefaultSearchService

type DefaultSearchService struct {
	// contains filtered or unexported fields
}

func (*DefaultSearchService) ClearScroll

func (s *DefaultSearchService) ClearScroll(ctx context.Context, scrollIds []string) (*querydsl.ClearScrollResponse, error)

func (*DefaultSearchService) Count

func (s *DefaultSearchService) Count(ctx context.Context, indices []string, body any) (int64, error)

func (*DefaultSearchService) CreatePIT

func (*DefaultSearchService) DeleteAllPITs

func (*DefaultSearchService) DeletePIT

func (*DefaultSearchService) FieldCaps

func (*DefaultSearchService) GetAllPITs

func (*DefaultSearchService) MultiSearch

func (s *DefaultSearchService) MultiSearch(ctx context.Context, body any) (*querydsl.MultiSearchResult, error)

func (*DefaultSearchService) MultiSearchTemplate

func (*DefaultSearchService) RankEval

func (*DefaultSearchService) RenderSearchTemplate

func (*DefaultSearchService) Scroll

func (*DefaultSearchService) Search

func (*DefaultSearchService) SearchShards

func (s *DefaultSearchService) SearchShards(ctx context.Context, indices []string) (*querydsl.SearchShardsResponse, error)

func (*DefaultSearchService) SearchTemplate

func (*DefaultSearchService) Validate

func (s *DefaultSearchService) Validate(ctx context.Context, indices []string, body any) (*querydsl.ValidateResponse, error)

type DefaultSecurityService

type DefaultSecurityService struct {
	// contains filtered or unexported fields
}

DefaultSecurityService is the default implementation of the SecurityService interface. It communicates with the OpenSearch Security plugin REST API.

func (*DefaultSecurityService) AuthInfo

AuthInfo retrieves the authentication information for the currently authenticated user.

func (*DefaultSecurityService) AuthToken

AuthToken requests an authentication token from the Security plugin.

func (*DefaultSecurityService) ConfigUpdate

func (s *DefaultSecurityService) ConfigUpdate(ctx context.Context, configTypes []string) (*SecurityConfigUpdateResponse, error)

ConfigUpdate triggers a security configuration update across cluster nodes.

func (*DefaultSecurityService) DashboardsInfo

func (s *DefaultSecurityService) DashboardsInfo(ctx context.Context) (map[string]any, error)

DashboardsInfo retrieves the Dashboards integration information from the Security plugin.

func (*DefaultSecurityService) DeleteActionGroup

func (s *DefaultSecurityService) DeleteActionGroup(ctx context.Context, name string) (*SecurityResponse, error)

DeleteActionGroup deletes a security action group by name.

func (*DefaultSecurityService) DeleteDistinguishedName

func (s *DefaultSecurityService) DeleteDistinguishedName(ctx context.Context, name string) (*SecurityResponse, error)

DeleteDistinguishedName deletes a node distinguished name entry by name.

func (*DefaultSecurityService) DeleteRateLimiter

func (s *DefaultSecurityService) DeleteRateLimiter(ctx context.Context, name string) (*SecurityResponse, error)

DeleteRateLimiter deletes an authentication failure rate limiter by name.

func (*DefaultSecurityService) DeleteRole

func (s *DefaultSecurityService) DeleteRole(ctx context.Context, roleName string) (*SecurityResponse, error)

DeleteRole deletes a security role from the Security plugin.

func (*DefaultSecurityService) DeleteRoleMapping

func (s *DefaultSecurityService) DeleteRoleMapping(ctx context.Context, roleName string) (*SecurityResponse, error)

DeleteRoleMapping deletes the role mapping for a given security role.

func (*DefaultSecurityService) DeleteTenant

func (s *DefaultSecurityService) DeleteTenant(ctx context.Context, name string) (*SecurityResponse, error)

DeleteTenant deletes a security tenant by name.

func (*DefaultSecurityService) DeleteUser

func (s *DefaultSecurityService) DeleteUser(ctx context.Context, username string) (*SecurityResponse, error)

DeleteUser deletes an internal user from the Security plugin.

func (*DefaultSecurityService) FlushCache

FlushCache flushes the Security plugin's internal caches.

func (*DefaultSecurityService) GetAccount

GetAccount retrieves the current user's account information from the Security plugin.

func (*DefaultSecurityService) GetActionGroup

func (s *DefaultSecurityService) GetActionGroup(ctx context.Context, name string) (map[string]SecurityActionGroup, error)

GetActionGroup retrieves a security action group by name.

func (*DefaultSecurityService) GetAllowlist

GetAllowlist retrieves the Security plugin REST API allowlist configuration.

func (*DefaultSecurityService) GetAudit

GetAudit retrieves the current Security plugin audit logging configuration.

func (*DefaultSecurityService) GetCertificates

GetCertificates retrieves the SSL certificates known to the Security plugin.

func (*DefaultSecurityService) GetConfig

GetConfig retrieves the current Security plugin dynamic configuration.

func (*DefaultSecurityService) GetDistinguishedName

func (s *DefaultSecurityService) GetDistinguishedName(ctx context.Context, name string) (map[string]SecurityDistinguishedName, error)

GetDistinguishedName retrieves a node distinguished name entry by name.

func (*DefaultSecurityService) GetMultiTenancyConfig

GetMultiTenancyConfig retrieves the multi-tenancy configuration from the Security plugin.

func (*DefaultSecurityService) GetRateLimiters

func (s *DefaultSecurityService) GetRateLimiters(ctx context.Context) (map[string]SecurityRateLimiter, error)

GetRateLimiters retrieves the authentication failure rate limiter configurations.

func (*DefaultSecurityService) GetRole

func (s *DefaultSecurityService) GetRole(ctx context.Context, roleName string) (map[string]SecurityRole, error)

GetRole retrieves a security role by name from the Security plugin.

func (*DefaultSecurityService) GetRoleMapping

func (s *DefaultSecurityService) GetRoleMapping(ctx context.Context, roleName string) (map[string]SecurityRoleMapping, error)

GetRoleMapping retrieves the role mapping for a given role from the Security plugin.

func (*DefaultSecurityService) GetTenant

func (s *DefaultSecurityService) GetTenant(ctx context.Context, name string) (map[string]SecurityTenant, error)

GetTenant retrieves a security tenant by name.

func (*DefaultSecurityService) GetUser

func (s *DefaultSecurityService) GetUser(ctx context.Context, username string) (map[string]SecurityUser, error)

GetUser retrieves an internal user from the Security plugin by username.

func (*DefaultSecurityService) Health

Health retrieves the health status of the Security plugin.

func (*DefaultSecurityService) ListActionGroups

func (s *DefaultSecurityService) ListActionGroups(ctx context.Context) (map[string]SecurityActionGroup, error)

ListActionGroups retrieves all security action groups from the Security plugin.

func (*DefaultSecurityService) ListNodesDN

ListNodesDN retrieves all node distinguished name entries from the Security plugin.

func (*DefaultSecurityService) ListRoleMappings

func (s *DefaultSecurityService) ListRoleMappings(ctx context.Context) (map[string]SecurityRoleMapping, error)

ListRoleMappings retrieves all role mappings from the Security plugin.

func (*DefaultSecurityService) ListRoles

ListRoles retrieves all security roles from the Security plugin.

func (*DefaultSecurityService) ListTenants

func (s *DefaultSecurityService) ListTenants(ctx context.Context) (map[string]SecurityTenant, error)

ListTenants retrieves all security tenants from the Security plugin.

func (*DefaultSecurityService) ListUsers

ListUsers retrieves all internal users from the Security plugin.

func (*DefaultSecurityService) PermissionsInfo

PermissionsInfo retrieves the current user's permission information from the Security plugin.

func (*DefaultSecurityService) PutAccount

func (s *DefaultSecurityService) PutAccount(ctx context.Context, body any) (*SecurityResponse, error)

PutAccount updates the current user's account in the Security plugin.

func (*DefaultSecurityService) PutActionGroup

PutActionGroup creates or updates a security action group.

func (*DefaultSecurityService) PutAllowlist

func (s *DefaultSecurityService) PutAllowlist(ctx context.Context, body any) (*SecurityResponse, error)

PutAllowlist updates the Security plugin REST API allowlist configuration.

func (*DefaultSecurityService) PutAudit

func (s *DefaultSecurityService) PutAudit(ctx context.Context, body any) (*SecurityResponse, error)

PutAudit updates the Security plugin's audit logging configuration.

func (*DefaultSecurityService) PutConfig

func (s *DefaultSecurityService) PutConfig(ctx context.Context, body any) (*SecurityResponse, error)

PutConfig updates the Security plugin's dynamic configuration.

func (*DefaultSecurityService) PutDistinguishedName

func (s *DefaultSecurityService) PutDistinguishedName(ctx context.Context, name string, body *SecurityDistinguishedName) (*SecurityResponse, error)

PutDistinguishedName creates or updates a node distinguished name entry.

func (*DefaultSecurityService) PutMultiTenancyConfig

func (s *DefaultSecurityService) PutMultiTenancyConfig(ctx context.Context, body any) (*SecurityResponse, error)

PutMultiTenancyConfig updates the multi-tenancy configuration in the Security plugin.

func (*DefaultSecurityService) PutRateLimiter

func (s *DefaultSecurityService) PutRateLimiter(ctx context.Context, name string, body any) (*SecurityResponse, error)

PutRateLimiter creates or updates an authentication failure rate limiter.

func (*DefaultSecurityService) PutRole

func (s *DefaultSecurityService) PutRole(ctx context.Context, roleName string, body *SecurityPutRole) (*SecurityResponse, error)

PutRole creates or updates a security role in the Security plugin.

func (*DefaultSecurityService) PutRoleMapping

func (s *DefaultSecurityService) PutRoleMapping(ctx context.Context, roleName string, body *SecurityPutRoleMapping) (*SecurityResponse, error)

PutRoleMapping creates or updates a role mapping in the Security plugin.

func (*DefaultSecurityService) PutTenant

PutTenant creates or updates a security tenant.

func (*DefaultSecurityService) PutUser

func (s *DefaultSecurityService) PutUser(ctx context.Context, username string, body *SecurityPutUser) (*SecurityResponse, error)

PutUser creates or updates an internal user in the Security plugin.

func (*DefaultSecurityService) SSLInfo

SSLInfo retrieves SSL certificate information from the Security plugin.

func (*DefaultSecurityService) TenantInfo

func (s *DefaultSecurityService) TenantInfo(ctx context.Context) (map[string]any, error)

TenantInfo retrieves the available tenant information from the Security plugin.

func (*DefaultSecurityService) WhoAmI

WhoAmI retrieves the identity information of the currently authenticated user.

type DefaultSmService

type DefaultSmService struct {
	// contains filtered or unexported fields
}

func (*DefaultSmService) DeletePolicy

func (s *DefaultSmService) DeletePolicy(ctx context.Context, policyName string) (*SmDeletePolicyResponse, error)

func (*DefaultSmService) ExplainPolicy

func (s *DefaultSmService) ExplainPolicy(ctx context.Context, policyNames []string) (*SmExplainPolicyResponse, error)

func (*DefaultSmService) GetPolicy

func (s *DefaultSmService) GetPolicy(ctx context.Context, policyName string) (*SmGetPolicyResponse, error)

func (*DefaultSmService) ListPolicies

func (s *DefaultSmService) ListPolicies(ctx context.Context) (*SmListPoliciesResponse, error)

ListPolicies returns all SM policies defined in the cluster.

func (*DefaultSmService) PostPolicy

func (s *DefaultSmService) PostPolicy(ctx context.Context, policyName string, body *SmPutPolicy) (*SmGetPolicyResponse, error)

func (*DefaultSmService) PutPolicy

func (*DefaultSmService) StartPolicy

func (s *DefaultSmService) StartPolicy(ctx context.Context, policyName string) (*SmStartStopResponse, error)

StartPolicy starts an SM policy, enabling its scheduled snapshot creation.

func (*DefaultSmService) StopPolicy

func (s *DefaultSmService) StopPolicy(ctx context.Context, policyName string) (*SmStartStopResponse, error)

StopPolicy stops an SM policy, pausing its scheduled snapshot creation.

type DefaultSnapshotService

type DefaultSnapshotService struct {
	// contains filtered or unexported fields
}

func (*DefaultSnapshotService) CleanupRepository

func (s *DefaultSnapshotService) CleanupRepository(ctx context.Context, repository string) (*SnapshotCleanupRepositoryResponse, error)

func (*DefaultSnapshotService) Clone

func (*DefaultSnapshotService) Create

func (*DefaultSnapshotService) CreateRepository

func (s *DefaultSnapshotService) CreateRepository(ctx context.Context, repository string, body any) (*SnapshotCreateRepositoryResponse, error)

func (*DefaultSnapshotService) Delete

func (*DefaultSnapshotService) DeleteRepository

func (s *DefaultSnapshotService) DeleteRepository(ctx context.Context, repository string) (*SnapshotDeleteRepositoryResponse, error)

func (*DefaultSnapshotService) Get

func (*DefaultSnapshotService) GetRepository

func (s *DefaultSnapshotService) GetRepository(ctx context.Context, repositories []string) (map[string]*SnapshotGetRepositoryResponse, error)

func (*DefaultSnapshotService) Restore

func (*DefaultSnapshotService) Status

func (*DefaultSnapshotService) VerifyRepository

func (s *DefaultSnapshotService) VerifyRepository(ctx context.Context, repository string) (*SnapshotVerifyRepositoryResponse, error)

type DefaultSqlService

type DefaultSqlService struct {
	// contains filtered or unexported fields
}

DefaultSqlService implements the SqlService interface using a REST client.

func (*DefaultSqlService) PPLExplain

func (s *DefaultSqlService) PPLExplain(ctx context.Context, body any) (*SQLExplainResponse, error)

PPLExplain returns the execution plan for a PPL query.

func (*DefaultSqlService) PPLQuery

func (s *DefaultSqlService) PPLQuery(ctx context.Context, body any) (*SQLResponse, error)

PPLQuery executes a PPL query against the OpenSearch PPL plugin.

func (*DefaultSqlService) SQLCloseCursor

func (s *DefaultSqlService) SQLCloseCursor(ctx context.Context, body any) (*SQLCloseResponse, error)

SQLCloseCursor closes an open SQL cursor to free server-side resources.

func (*DefaultSqlService) SQLExplain

func (s *DefaultSqlService) SQLExplain(ctx context.Context, body any) (*SQLExplainResponse, error)

SQLExplain returns the execution plan for an SQL query.

func (*DefaultSqlService) SQLQuery

func (s *DefaultSqlService) SQLQuery(ctx context.Context, body any, format string) (*SQLResponse, error)

SQLQuery executes an SQL query against the OpenSearch SQL plugin with an optional format.

type DefaultTasksService

type DefaultTasksService struct {
	// contains filtered or unexported fields
}

DefaultTasksService is the default implementation of TasksService, backed by an HTTP client and a structured logger.

func (*DefaultTasksService) Cancel

Cancel cancels a running task via POST /_tasks/{taskId}/_cancel. The taskId must be in the "nodeId:taskId" format. Returns a TasksCancelResponse with the nodes that held the task and any failures encountered during cancellation.

func (*DefaultTasksService) Get

Get retrieves a specific task by its ID from GET /_tasks/{taskId}. The taskId must be in the "nodeId:taskId" format. Returns a TasksGetTaskResponse indicating whether the task has completed and, if so, the task details or any error that occurred.

func (*DefaultTasksService) List

List retrieves all currently running tasks from GET /_tasks. Returns a TasksListResponse containing per-node task listings and any node or task-level failures encountered during collection.

type DefaultTransformService

type DefaultTransformService struct {
	// contains filtered or unexported fields
}

func (*DefaultTransformService) DeleteJob

func (*DefaultTransformService) ExplainJob

func (s *DefaultTransformService) ExplainJob(ctx context.Context, jobName string) (map[string]TransformExplainJob, error)

func (*DefaultTransformService) GetJob

func (*DefaultTransformService) PreviewJobResults

func (s *DefaultTransformService) PreviewJobResults(ctx context.Context, body any) (*TransformPreviewJobResponse, error)

func (*DefaultTransformService) PutJob

func (*DefaultTransformService) SearchJob

func (*DefaultTransformService) StartJob

func (*DefaultTransformService) StopJob

type DeleteAliasRequest

type DeleteAliasRequest struct {
	Indices []string `validate:"required,min=1"`
	Names   []string `validate:"required,min=1"`
}

func (*DeleteAliasRequest) Validate

func (r *DeleteAliasRequest) Validate() error

type DeletePITRequest

type DeletePITRequest struct {
	PitIds []string `validate:"required,min=1"`
}

func (*DeletePITRequest) Validate

func (r *DeletePITRequest) Validate() error

type DeleteParams

type DeleteParams struct {
	Refresh       Refresh
	Routing       string
	Timeout       string
	Version       *int64
	VersionType   VersionType
	IfSeqNo       *int64
	IfPrimaryTerm *int64
}

func (*DeleteParams) ToMap

func (p *DeleteParams) ToMap() map[string]string

type DeleteRequest

type DeleteRequest struct {
	Index  string `validate:"required"`
	Id     string `validate:"required"`
	Params *DeleteParams
}

func (*DeleteRequest) Validate

func (r *DeleteRequest) Validate() error

type DeleteResponse

type DeleteResponse struct {
	// Index is the name of the index the document was deleted from.
	Index string `json:"_index,omitempty"`
	// Id is the deleted document's ID.
	Id string `json:"_id,omitempty"`
	// Version is the document version after deletion.
	Version int64 `json:"_version,omitempty"`
	// Result indicates the outcome of the operation (e.g. "deleted", "not_found").
	Result string `json:"result,omitempty"`
	// Shards provides shard-level acknowledgment of the delete.
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
	// SeqNo is the sequence number assigned to this delete operation.
	SeqNo int64 `json:"_seq_no,omitempty"`
	// PrimaryTerm is the primary term of the shard that processed this operation.
	PrimaryTerm int64 `json:"_primary_term,omitempty"`
	// Status is the HTTP status code returned by the server.
	Status int `json:"status,omitempty"`
	// ForcedRefresh indicates whether the index was force-refreshed as part of this operation.
	ForcedRefresh bool `json:"forced_refresh,omitempty"`
}

DeleteResponse represents the result of a delete document operation.

type DiscoveryNode

type DiscoveryNode struct {
	Name             string               `json:"name"`
	TransportAddress string               `json:"transport_address"`
	Host             string               `json:"host"`
	IP               string               `json:"ip"`
	Roles            []string             `json:"roles"`
	Attributes       map[string]any       `json:"attributes"`
	Tasks            map[string]*TaskInfo `json:"tasks"`
}

DiscoveryNode represents a cluster node as reported by the Tasks API, including its identification details, assigned roles, custom attributes, and the currently running tasks on that node.

type DocumentService

type DocumentService interface {
	Index(ctx context.Context, req *IndexRequest) (*IndexResponse, error)
	Create(ctx context.Context, req *CreateRequest) (*IndexResponse, error)
	Get(ctx context.Context, req *GetRequest) (*GetResult, error)
	GetSource(ctx context.Context, index string, id string) (json.RawMessage, error)
	MultiGet(ctx context.Context, items []*MultiGetItem) (*MgetResponse, error)
	Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error)
	DeleteByQuery(ctx context.Context, indices []string, body any) (*BulkIndexByScrollResponse, error)
	DeleteByQueryRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)
	Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error)
	UpdateByQuery(ctx context.Context, indices []string, body any) (*BulkIndexByScrollResponse, error)
	UpdateByQueryRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)
	Bulk(ctx context.Context, index string, body string) (*BulkResponse, error)
	Exists(ctx context.Context, index string, id string) (bool, error)
	ExistsSource(ctx context.Context, index string, id string) (bool, error)
	Explain(ctx context.Context, index string, id string, body any) (*ExplainResponse, error)
	TermVectors(ctx context.Context, index string, id string, body any) (*TermvectorsResponse, error)
	MultiTermVectors(ctx context.Context, index string, body any) (*MultiTermvectorResponse, error)
	Reindex(ctx context.Context, body any) (*BulkIndexByScrollResponse, error)
	ReindexRethrottle(ctx context.Context, req *RethrottleRequest) (*TasksListResponse, error)
}

func NewDocumentService

func NewDocumentService(client *resty.Client, logger *logrus.Entry) DocumentService

type ExplainResponse

type ExplainResponse struct {
	// Index is the index containing the explained document.
	Index string `json:"_index"`
	// Type is the document type (deprecated).
	Type string `json:"_type"`
	// Id is the explained document's ID.
	Id string `json:"_id"`
	// Matched indicates whether the document matched the provided query.
	Matched bool `json:"matched"`
	// Explanation is a nested structure describing the scoring breakdown for the match.
	Explanation map[string]any `json:"explanation"`
}

ExplainResponse represents the result of an explain API request. It describes whether a document matched a query and provides the scoring explanation.

type FieldCapsRequest

type FieldCapsRequest struct {
	Indices []string
	Fields  []string
}

type FieldScriptStats

type FieldScriptStats struct {
	LinesMax    int64 `json:"lines_max"`
	LinesTotal  int64 `json:"lines_total"`
	CharsMax    int64 `json:"chars_max"`
	CharsTotal  int64 `json:"chars_total"`
	SourceMax   int64 `json:"source_max"`
	SourceTotal int64 `json:"source_total"`
	DocMax      int64 `json:"doc_max"`
	DocTotal    int64 `json:"doc_total"`
}

FieldScriptStats holds size metrics (lines, characters, source, doc) for script-heavy fields in the cluster.

type FieldStatistics

type FieldStatistics struct {
	// DocCount is the number of documents that have at least one term in this field.
	DocCount int64 `json:"doc_count"`
	// SumDocFreq is the sum of document frequencies for all terms in this field.
	SumDocFreq int64 `json:"sum_doc_freq"`
	// SumTtf is the sum of total term frequencies for all terms in this field.
	SumTtf int64 `json:"sum_ttf"`
}

FieldStatistics contains aggregate statistics for all terms in a field.

type GetFieldMappingRequest

type GetFieldMappingRequest struct {
	Indices []string
	Fields  []string `validate:"required,min=1"`
}

func (*GetFieldMappingRequest) Validate

func (r *GetFieldMappingRequest) Validate() error

type GetParams

type GetParams struct {
	Routing        string
	Preference     string
	Realtime       bool
	Refresh        bool
	Source         string
	SourceExcludes string
	SourceIncludes string
	StoredFields   string
	Version        *int64
	VersionType    VersionType
	IfSeqNo        *int64
	IfPrimaryTerm  *int64
}

func (*GetParams) ToMap

func (p *GetParams) ToMap() map[string]string

type GetRequest

type GetRequest struct {
	Index  string `validate:"required"`
	Id     string `validate:"required"`
	Params *GetParams
}

func (*GetRequest) Validate

func (r *GetRequest) Validate() error

type GetResult

type GetResult struct {
	// Index is the index the document belongs to.
	Index string `json:"_index"`
	// Id is the document ID.
	Id string `json:"_id"`
	// Uid is the legacy unique identifier for the document.
	Uid string `json:"_uid"`
	// Routing is the custom routing value for this document, if any.
	Routing string `json:"_routing"`
	// Parent is the parent document ID, if applicable (deprecated).
	Parent string `json:"_parent"`
	// Version is the current version of the document; nil if not found.
	Version *int64 `json:"_version"`
	// SeqNo is the sequence number of the document; nil if not found.
	SeqNo *int64 `json:"_seq_no"`
	// PrimaryTerm is the primary term of the shard; nil if not found.
	PrimaryTerm *int64 `json:"_primary_term"`
	// Source is the raw JSON source of the document.
	Source json.RawMessage `json:"_source,omitempty"`
	// Found indicates whether the document was found.
	Found bool `json:"found,omitempty"`
	// Fields contains stored fields returned when requested via the stored_fields parameter.
	Fields map[string]any `json:"fields,omitempty"`
	// Error contains error details if the document retrieval failed.
	Error *types.OpenSearchErrorDetails `json:"error,omitempty"`
}

GetResult represents the result of a get document operation. It contains the document source, metadata, and a flag indicating whether the document was found.

type IndexFeatureStats

type IndexFeatureStats struct {
	Name        string `json:"name"`
	Count       int    `json:"count"`
	IndexCount  int    `json:"index_count"`
	ScriptCount int    `json:"script_count"`
}

IndexFeatureStats tracks usage counts for a named index feature, including how many indices use it and associated script counts.

type IndexParams

type IndexParams struct {
	Refresh       Refresh
	Routing       string
	Timeout       string
	Version       int64
	VersionType   VersionType
	IfSeqNo       *int64
	IfPrimaryTerm *int64
	Pipeline      string
	RequireAlias  bool
}

func (*IndexParams) ToMap

func (p *IndexParams) ToMap() map[string]string

type IndexRecovery

type IndexRecovery struct {
	Shards []*ShardRecovery `json:"shards,omitempty"`
}

IndexRecovery contains shard recoveries for a single index.

type IndexRequest

type IndexRequest struct {
	Index  string `validate:"required"`
	Id     string
	Body   any
	Params *IndexParams
}

func (*IndexRequest) Validate

func (r *IndexRequest) Validate() error

type IndexResponse

type IndexResponse struct {
	// Index is the name of the index the document was written to.
	Index string `json:"_index,omitempty"`
	// Type is the document type (deprecated; always "_doc" in modern OpenSearch).
	Type string `json:"_type,omitempty"`
	// Id is the document ID, either provided or server-generated.
	Id string `json:"_id,omitempty"`
	// Version is the document version after the operation.
	Version int64 `json:"_version,omitempty"`
	// Result indicates the outcome of the operation (e.g. "created", "updated").
	Result string `json:"result,omitempty"`
	// Shards provides shard-level acknowledgment of the write.
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
	// SeqNo is the sequence number assigned to this operation.
	SeqNo int64 `json:"_seq_no,omitempty"`
	// PrimaryTerm is the primary term of the shard that processed this operation.
	PrimaryTerm int64 `json:"_primary_term,omitempty"`
	// Status is the HTTP status code returned by the server.
	Status int `json:"status,omitempty"`
	// ForcedRefresh indicates whether the index was force-refreshed as part of this operation.
	ForcedRefresh bool `json:"forced_refresh,omitempty"`
}

IndexResponse represents the result of an index (add/update) document operation. It contains the document metadata assigned by OpenSearch, including the index name, document ID, version, sequence number, and shard acknowledgment details.

type IndexSegments

type IndexSegments struct {
	// Shards maps shard identifiers to their segment arrays.
	Shards map[string][]*IndexSegmentsShards `json:"shards,omitempty"`
}

IndexSegments contains per-shard segment information for a single index.

type IndexSegmentsDetails

type IndexSegmentsDetails struct {
	// Generation is the segment generation number.
	Generation int64 `json:"generation,omitempty"`
	// NumDocs is the number of live documents in this segment.
	NumDocs int64 `json:"num_docs,omitempty"`
	// DeletedDocs is the number of deleted (but not yet merged) documents.
	DeletedDocs int64 `json:"deleted_docs,omitempty"`
	// Size is the human-readable segment size on disk.
	Size string `json:"size,omitempty"`
	// SizeInBytes is the segment size on disk in bytes.
	SizeInBytes int64 `json:"size_in_bytes,omitempty"`
	// Memory is the human-readable memory used by this segment.
	Memory string `json:"memory,omitempty"`
	// MemoryInBytes is the memory used by this segment in bytes.
	MemoryInBytes int64 `json:"memory_in_bytes,omitempty"`
	// Committed indicates whether the segment has been committed to disk.
	Committed bool `json:"committed,omitempty"`
	// Search indicates whether the segment is visible to searches.
	Search bool `json:"search,omitempty"`
	// Version is the Lucene version that created this segment.
	Version string `json:"version,omitempty"`
	// Compound indicates whether this segment is stored in compound file format.
	Compound bool `json:"compound,omitempty"`
	// MergeId is the identifier of the merge that produced this segment, if any.
	MergeId string `json:"merge_id,omitempty"`
	// Sort describes the index sort configuration for this segment.
	Sort []*IndexSegmentsSort `json:"sort,omitempty"`
	// RAMTree provides a hierarchical breakdown of memory usage within the segment.
	RAMTree []*IndexSegmentsRamTree `json:"ram_tree,omitempty"`
	// Attributes contains custom codec-level attributes stored with the segment.
	Attributes map[string]string `json:"attributes,omitempty"`
}

IndexSegmentsDetails provides detailed information for a single Lucene segment, including document counts, size, memory usage, and sort configuration.

type IndexSegmentsRamTree

type IndexSegmentsRamTree struct {
	// Description describes what this node accounts for.
	Description string `json:"description,omitempty"`
	// Size is the human-readable memory size for this node.
	Size string `json:"size,omitempty"`
	// SizeInBytes is the memory size in bytes.
	SizeInBytes int64 `json:"size_in_bytes,omitempty"`
	// Children contains sub-nodes in the memory usage hierarchy.
	Children []*IndexSegmentsRamTree `json:"children,omitempty"`
}

IndexSegmentsRamTree represents a node in the hierarchical breakdown of memory usage within a Lucene segment.

type IndexSegmentsRouting

type IndexSegmentsRouting struct {
	// State is the shard state (e.g. "STARTED", "RELOCATING").
	State string `json:"state,omitempty"`
	// Primary indicates whether this is a primary shard.
	Primary bool `json:"primary,omitempty"`
	// Node is the node name this shard is allocated to.
	Node string `json:"node,omitempty"`
	// RelocatingNode is the target node name during shard relocation.
	RelocatingNode string `json:"relocating_node,omitempty"`
}

IndexSegmentsRouting describes shard routing state for a specific shard copy.

type IndexSegmentsShards

type IndexSegmentsShards struct {
	// Routing describes shard routing information for this shard copy.
	Routing *IndexSegmentsRouting `json:"routing,omitempty"`
	// NumCommittedSegments is the number of segments that have been fsync'd to disk.
	NumCommittedSegments int64 `json:"num_committed_segments,omitempty"`
	// NumSearchSegments is the number of segments that are visible to searches.
	NumSearchSegments int64 `json:"num_search_segments"`
	// Segments maps segment names to their detailed information.
	Segments map[string]*IndexSegmentsDetails `json:"segments,omitempty"`
}

IndexSegmentsShards represents segment information for a single shard copy.

type IndexSegmentsSort

type IndexSegmentsSort struct {
	// Field is the field name used for sorting.
	Field string `json:"field,omitempty"`
	// Mode is the sort mode (e.g. "min", "max").
	Mode string `json:"mode,omitempty"`
	// Missing specifies how missing values are treated.
	Missing any `json:"missing,omitempty"`
	// Reverse indicates whether the sort order is reversed.
	Reverse bool `json:"reverse,omitempty"`
}

IndexSegmentsSort describes the sort specification applied to an index-sorted segment.

type IndexShardStores

type IndexShardStores struct {
	Shards map[string]*ShardStoreWrapper `json:"shards,omitempty"`
}

IndexShardStores contains shard stores info for an index.

type IndexStats

type IndexStats struct {
	// UUID is the unique identifier of the index.
	UUID string `json:"uuid,omitempty"`
	// Primaries holds statistics for primary shards only.
	Primaries *IndexStatsDetails `json:"primaries,omitempty"`
	// Total holds statistics for all shards (primary and replica).
	Total *IndexStatsDetails `json:"total,omitempty"`
	// Shards maps shard identifiers to per-shard statistics.
	Shards map[string][]*IndexStatsDetails `json:"shards,omitempty"`
}

IndexStats represents statistics for a single index or an aggregated group of indices. Primaries contains stats for primary shards only, while Total includes both primary and replicas.

type IndexStatsCommit

type IndexStatsCommit struct {
	// ID is the opaque commit identifier.
	ID string `json:"id,omitempty"`
	// Generation is the commit generation number.
	Generation int64 `json:"generation,omitempty"`
	// UserData contains arbitrary user-provided key-value pairs stored with the commit.
	UserData map[string]string `json:"user_data,omitempty"`
	// NumDocs is the number of documents in the commit.
	NumDocs int64 `json:"num_docs,omitempty"`
}

IndexStatsCommit describes the state of the most recent commit for a shard.

type IndexStatsCompletion

type IndexStatsCompletion struct {
	Size        string `json:"size,omitempty"`
	SizeInBytes int64  `json:"size_in_bytes,omitempty"`
}

IndexStatsCompletion provides statistics about the completion suggester data structure size.

type IndexStatsDetails

type IndexStatsDetails struct {
	Routing         *IndexStatsRouting         `json:"routing,omitempty"`
	Docs            *IndexStatsDocs            `json:"docs,omitempty"`
	Store           *IndexStatsStore           `json:"store,omitempty"`
	Indexing        *IndexStatsIndexing        `json:"indexing,omitempty"`
	Get             *IndexStatsGet             `json:"get,omitempty"`
	Search          *IndexStatsSearch          `json:"search,omitempty"`
	Merges          *IndexStatsMerges          `json:"merges,omitempty"`
	Refresh         *IndexStatsRefresh         `json:"refresh,omitempty"`
	Recovery        *IndexStatsRecovery        `json:"recovery,omitempty"`
	Flush           *IndexStatsFlush           `json:"flush,omitempty"`
	Warmer          *IndexStatsWarmer          `json:"warmer,omitempty"`
	FilterCache     *IndexStatsFilterCache     `json:"filter_cache,omitempty"`
	IdCache         *IndexStatsIdCache         `json:"id_cache,omitempty"`
	Fielddata       *IndexStatsFielddata       `json:"fielddata,omitempty"`
	Percolate       *IndexStatsPercolate       `json:"percolate,omitempty"`
	Completion      *IndexStatsCompletion      `json:"completion,omitempty"`
	Segments        *IndexStatsSegments        `json:"segments,omitempty"`
	Translog        *IndexStatsTranslog        `json:"translog,omitempty"`
	Suggest         *IndexStatsSuggest         `json:"suggest,omitempty"`
	QueryCache      *IndexStatsQueryCache      `json:"query_cache,omitempty"`
	RequestCache    *IndexStatsRequestCache    `json:"request_cache,omitempty"`
	Commit          *IndexStatsCommit          `json:"commit,omitempty"`
	SeqNo           *IndexStatsSeqNo           `json:"seq_no,omitempty"`
	RetentionLeases *IndexStatsRetentionLeases `json:"retention_leases,omitempty"`
	ShardPath       *IndexStatsShardPath       `json:"shard_path,omitempty"`
	ShardStats      *IndexStatsShardStats      `json:"shard_stats,omitempty"`
}

IndexStatsDetails provides detailed statistics for an index or shard group, covering documents, storage, indexing, search, merges, refresh, recovery, and more.

type IndexStatsDocs

type IndexStatsDocs struct {
	// Count is the number of documents in the index (excluding nested documents).
	Count int64 `json:"count,omitempty"`
	// Deleted is the number of deleted documents not yet reclaimed by merges.
	Deleted int64 `json:"deleted,omitempty"`
}

IndexStatsDocs provides document count statistics for an index.

type IndexStatsFielddata

type IndexStatsFielddata struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

IndexStatsFielddata provides statistics about the fielddata cache, which stores field values in memory for sorting and aggregations.

type IndexStatsFilterCache

type IndexStatsFilterCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

IndexStatsFilterCache provides statistics about the deprecated Lucene filter cache.

type IndexStatsFlush

type IndexStatsFlush struct {
	Total             int64  `json:"total,omitempty"`
	TotalTime         string `json:"total_time,omitempty"`
	TotalTimeInMillis int64  `json:"total_time_in_millis,omitempty"`
	Periodic          int64  `json:"periodic,omitempty"`
}

IndexStatsFlush provides statistics about flush operations for an index.

type IndexStatsGet

type IndexStatsGet struct {
	Total               int64  `json:"total,omitempty"`
	GetTime             string `json:"getTime,omitempty"`
	TimeInMillis        int64  `json:"time_in_millis,omitempty"`
	ExistsTotal         int64  `json:"exists_total,omitempty"`
	ExistsTime          string `json:"exists_time,omitempty"`
	ExistsTimeInMillis  int64  `json:"exists_time_in_millis,omitempty"`
	MissingTotal        int64  `json:"missing_total,omitempty"`
	MissingTime         string `json:"missing_time,omitempty"`
	MissingTimeInMillis int64  `json:"missing_time_in_millis,omitempty"`
	Current             int64  `json:"current,omitempty"`
}

IndexStatsGet provides statistics about get operations for an index.

type IndexStatsIdCache

type IndexStatsIdCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
}

IndexStatsIdCache provides statistics about the deprecated ID cache.

type IndexStatsIndexing

type IndexStatsIndexing struct {
	IndexTotal           int64  `json:"index_total,omitempty"`
	IndexTime            string `json:"index_time,omitempty"`
	IndexTimeInMillis    int64  `json:"index_time_in_millis,omitempty"`
	IndexCurrent         int64  `json:"index_current,omitempty"`
	IndexFailed          int64  `json:"index_failed,omitempty"`
	DeleteTotal          int64  `json:"delete_total,omitempty"`
	DeleteTime           string `json:"delete_time,omitempty"`
	DeleteTimeInMillis   int64  `json:"delete_time_in_millis,omitempty"`
	DeleteCurrent        int64  `json:"delete_current,omitempty"`
	NoopUpdateTotal      int64  `json:"noop_update_total,omitempty"`
	IsThrottled          bool   `json:"is_throttled,omitempty"`
	ThrottleTime         string `json:"throttle_time,omitempty"`
	ThrottleTimeInMillis int64  `json:"throttle_time_in_millis,omitempty"`
}

IndexStatsIndexing provides statistics about indexing operations for an index.

type IndexStatsMerges

type IndexStatsMerges struct {
	Current                    int64  `json:"current,omitempty"`
	CurrentDocs                int64  `json:"current_docs,omitempty"`
	CurrentSize                string `json:"current_size,omitempty"`
	CurrentSizeInBytes         int64  `json:"current_size_in_bytes,omitempty"`
	Total                      int64  `json:"total,omitempty"`
	TotalTime                  string `json:"total_time,omitempty"`
	TotalTimeInMillis          int64  `json:"total_time_in_millis,omitempty"`
	TotalDocs                  int64  `json:"total_docs,omitempty"`
	TotalSize                  string `json:"total_size,omitempty"`
	TotalSizeInBytes           int64  `json:"total_size_in_bytes,omitempty"`
	TotalStoppedTime           string `json:"total_stopped_time,omitempty"`
	TotalStoppedTimeInMillis   int64  `json:"total_stopped_time_in_millis,omitempty"`
	TotalThrottledTime         string `json:"total_throttled_time,omitempty"`
	TotalThrottledTimeInMillis int64  `json:"total_throttled_time_in_millis,omitempty"`
	TotalAutoThrottle          string `json:"total_auto_throttle,omitempty"`
	TotalAutoThrottleInBytes   int64  `json:"total_auto_throttle_in_bytes,omitempty"`
}

IndexStatsMerges provides statistics about segment merge operations for an index.

type IndexStatsPercolate

type IndexStatsPercolate struct {
	Total             int64  `json:"total,omitempty"`
	GetTime           string `json:"get_time,omitempty"`
	TimeInMillis      int64  `json:"time_in_millis,omitempty"`
	Current           int64  `json:"current,omitempty"`
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	Queries           int64  `json:"queries,omitempty"`
}

IndexStatsPercolate provides statistics about percolate operations (deprecated).

type IndexStatsQueryCache

type IndexStatsQueryCache struct {
	MemorySize        string `json:"memory_size,omitempty"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes,omitempty"`
	TotalCount        int64  `json:"total_count,omitempty"`
	HitCount          int64  `json:"hit_count,omitempty"`
	MissCount         int64  `json:"miss_count,omitempty"`
	CacheSize         int64  `json:"cache_size,omitempty"`
	CacheCount        int64  `json:"cache_count,omitempty"`
	Evictions         int64  `json:"evictions,omitempty"`
}

IndexStatsQueryCache provides statistics about the node-level query cache.

type IndexStatsRecovery

type IndexStatsRecovery struct {
	CurrentAsSource      int64  `json:"current_as_source,omitempty"`
	CurrentAsTarget      int64  `json:"current_as_target,omitempty"`
	ThrottleTime         string `json:"throttle_time,omitempty"`
	ThrottleTimeInMillis int64  `json:"throttle_time_in_millis,omitempty"`
}

IndexStatsRecovery provides statistics about shard recovery operations for an index.

type IndexStatsRefresh

type IndexStatsRefresh struct {
	Total                     int64  `json:"total,omitempty"`
	TotalTime                 string `json:"total_time,omitempty"`
	TotalTimeInMillis         int64  `json:"total_time_in_millis,omitempty"`
	ExternalTotal             int64  `json:"external_total,omitempty"`
	ExternalTotalTime         string `json:"external_total_time,omitempty"`
	ExternalTotalTimeInMillis int64  `json:"external_total_time_in_millis,omitempty"`
	Listeners                 int64  `json:"listeners,omitempty"`
}

IndexStatsRefresh provides statistics about refresh operations for an index.

type IndexStatsRequestCache

type IndexStatsRequestCache struct {
	// MemorySize is the human-readable cache size.
	MemorySize string `json:"memory_size,omitempty"`
	// MemorySizeInBytes is the cache size in bytes.
	MemorySizeInBytes int64 `json:"memory_size_in_bytes,omitempty"`
	// Evictions is the number of entries evicted from the cache.
	Evictions int64 `json:"evictions,omitempty"`
	// HitCount is the number of cache hits.
	HitCount int64 `json:"hit_count,omitempty"`
	// MissCount is the number of cache misses.
	MissCount int64 `json:"miss_count,omitempty"`
}

IndexStatsRequestCache provides statistics about the shard-level request cache.

type IndexStatsRetentionLease

type IndexStatsRetentionLease struct {
	// Id is the unique identifier for this lease.
	Id string `json:"id,omitempty"`
	// RetainingSeqNo is the minimum sequence number this lease retains.
	RetainingSeqNo int64 `json:"retaining_seq_no,omitempty"`
	// Timestamp is the creation time of the lease in milliseconds since epoch.
	Timestamp int64 `json:"timestamp,omitempty"`
	// Source describes what created the lease (e.g. a snapshot or CCR process).
	Source string `json:"source,omitempty"`
}

IndexStatsRetentionLease describes a single retention lease that prevents operations at or below a sequence number from being merged away.

type IndexStatsRetentionLeases

type IndexStatsRetentionLeases struct {
	// PrimaryTerm is the primary term during which the leases were created.
	PrimaryTerm int64 `json:"primary_term,omitempty"`
	// Version is the monotonically increasing version of the lease set.
	Version int64 `json:"version,omitempty"`
	// Leases lists the active retention leases.
	Leases []*IndexStatsRetentionLease `json:"leases,omitempty"`
}

IndexStatsRetentionLeases provides retention lease information for an index shard.

type IndexStatsRouting

type IndexStatsRouting struct {
	// State is the routing state of the shard (e.g. "STARTED", "INITIALIZING").
	State string `json:"state"`
	// Primary indicates whether this is a primary shard.
	Primary bool `json:"primary"`
	// Node is the name of the node this shard is allocated to.
	Node string `json:"node"`
	// RelocatingNode is the name of the node the shard is being relocated to, if any.
	RelocatingNode *string `json:"relocating_node"`
}

IndexStatsRouting describes shard routing information for a specific shard.

type IndexStatsSearch

type IndexStatsSearch struct {
	OpenContexts        int64  `json:"open_contexts,omitempty"`
	QueryTotal          int64  `json:"query_total,omitempty"`
	QueryTime           string `json:"query_time,omitempty"`
	QueryTimeInMillis   int64  `json:"query_time_in_millis,omitempty"`
	QueryCurrent        int64  `json:"query_current,omitempty"`
	FetchTotal          int64  `json:"fetch_total,omitempty"`
	FetchTime           string `json:"fetch_time,omitempty"`
	FetchTimeInMillis   int64  `json:"fetch_time_in_millis,omitempty"`
	FetchCurrent        int64  `json:"fetch_current,omitempty"`
	ScrollTotal         int64  `json:"scroll_total,omitempty"`
	ScrollTime          string `json:"scroll_time,omitempty"`
	ScrollTimeInMillis  int64  `json:"scroll_time_in_millis,omitempty"`
	ScrollCurrent       int64  `json:"scroll_current,omitempty"`
	SuggestTotal        int64  `json:"suggest_total,omitempty"`
	SuggestTime         string `json:"suggest_time,omitempty"`
	SuggestTimeInMillis int64  `json:"suggest_time_in_millis,omitempty"`
	SuggestCurrent      int64  `json:"suggest_current,omitempty"`
}

IndexStatsSearch provides statistics about search operations for an index, including queries, fetches, scrolls, and suggestions.

type IndexStatsSegments

type IndexStatsSegments struct {
	// Count is the total number of segments.
	Count int64 `json:"count"`
	// Memory is the human-readable total memory used by all segments.
	Memory string `json:"memory"`
	// MemoryInBytes is the total memory used by all segments in bytes.
	MemoryInBytes int64 `json:"memory_in_bytes"`
	// TermsMemory is the human-readable memory used by term dictionaries.
	TermsMemory string `json:"terms_memory"`
	// TermsMemoryInBytes is the memory used by term dictionaries in bytes.
	TermsMemoryInBytes int64 `json:"terms_memory_in_bytes"`
	// StoredFieldsMemory is the human-readable memory used by stored fields.
	StoredFieldsMemory string `json:"stored_fields_memory"`
	// StoredFieldsMemoryInBytes is the memory used by stored fields in bytes.
	StoredFieldsMemoryInBytes int64 `json:"stored_fields_memory_in_bytes"`
	// TermVectorsMemory is the human-readable memory used by term vectors.
	TermVectorsMemory string `json:"term_vectors_memory"`
	// TermVectorsMemoryInBytes is the memory used by term vectors in bytes.
	TermVectorsMemoryInBytes int64 `json:"term_vectors_memory_in_bytes"`
	// NormsMemory is the human-readable memory used by field norms.
	NormsMemory string `json:"norms_memory"`
	// NormsMemoryInBytes is the memory used by field norms in bytes.
	NormsMemoryInBytes int64 `json:"norms_memory_in_bytes"`
	// PointsMemory is the human-readable memory used by point values (BKD trees).
	PointsMemory string `json:"points_memory"`
	// PointsMemoryInBytes is the memory used by point values in bytes.
	PointsMemoryInBytes int64 `json:"points_memory_in_bytes"`
	// DocValuesMemory is the human-readable memory used by doc values.
	DocValuesMemory string `json:"doc_values_memory"`
	// DocValuesMemoryInBytes is the memory used by doc values in bytes.
	DocValuesMemoryInBytes int64 `json:"doc_values_memory_in_bytes"`
	// IndexWriterMemory is the human-readable memory used by the index writer.
	IndexWriterMemory string `json:"index_writer_memory"`
	// IndexWriterMemoryInBytes is the memory used by the index writer in bytes.
	IndexWriterMemoryInBytes int64 `json:"index_writer_memory_in_bytes"`
	// VersionMapMemory is the human-readable memory used by the version map.
	VersionMapMemory string `json:"version_map_memory"`
	// VersionMapMemoryInBytes is the memory used by the version map in bytes.
	VersionMapMemoryInBytes int64 `json:"version_map_memory_in_bytes"`
	// FixedBitSet is the human-readable memory used by fixed bit sets (nested docs).
	FixedBitSet string `json:"fixed_bit_set"`
	// FixedBitSetInBytes is the memory used by fixed bit sets in bytes.
	FixedBitSetInBytes int64 `json:"fixed_bit_set_memory_in_bytes"`
	// MaxUnsafeAutoIDTimestamp is the timestamp of the most recent unsafe auto-generated ID.
	MaxUnsafeAutoIDTimestamp int64 `json:"max_unsafe_auto_id_timestamp"`
	// FileSizes maps file types to their size information.
	FileSizes map[string]*ClusterStatsIndicesSegmentsFile `json:"file_sizes"`
}

IndexStatsSegments provides statistics about the Lucene segments within an index, including memory usage breakdown by data structure type.

type IndexStatsSeqNo

type IndexStatsSeqNo struct {
	// MaxSeqNo is the highest sequence number assigned to any operation.
	MaxSeqNo int64 `json:"max_seq_no,omitempty"`
	// LocalCheckpoint is the sequence number below which all operations have been processed locally.
	LocalCheckpoint int64 `json:"local_checkpoint,omitempty"`
	// GlobalCheckpoint is the sequence number below which all operations have been processed on all shard copies.
	GlobalCheckpoint int64 `json:"global_checkpoint,omitempty"`
}

IndexStatsSeqNo provides sequence number statistics for an index shard, which are relevant for optimistic concurrency control and replication.

type IndexStatsShardPath

type IndexStatsShardPath struct {
	// StatePath is the path to the shard state directory.
	StatePath string `json:"state_path"`
	// DataPath is the path to the shard data directory.
	DataPath string `json:"data_path"`
	// IsCustomDataPath indicates whether a custom data path was configured.
	IsCustomDataPath bool `json:"is_custom_data_path"`
}

IndexStatsShardPath describes the filesystem paths used by a shard.

type IndexStatsShardStats

type IndexStatsShardStats struct {
	// TotalCount is the total number of shards.
	TotalCount int64 `json:"total_count,omitempty"`
}

IndexStatsShardStats provides aggregate shard-level counts.

type IndexStatsStore

type IndexStatsStore struct {
	// Size is the human-readable size of the index on disk.
	Size string `json:"size,omitempty"`
	// SizeInBytes is the size of the index on disk in bytes.
	SizeInBytes int64 `json:"size_in_bytes,omitempty"`
	// TotalDataSetSize is the human-readable total dataset size including footers and metadata.
	TotalDataSetSize string `json:"total_data_set_size,omitempty"`
	// TotalDataSetSizeInBytes is the total dataset size in bytes.
	TotalDataSetSizeInBytes int64 `json:"total_data_set_size_in_bytes,omitempty"`
	// Reserved is the human-readable reserved storage size.
	Reserved string `json:"reserved,omitempty"`
	// ReservedInBytes is the reserved storage size in bytes.
	ReservedInBytes int64 `json:"reserved_in_bytes,omitempty"`
}

IndexStatsStore provides storage size statistics for an index.

type IndexStatsSuggest

type IndexStatsSuggest struct {
	Total        int64  `json:"total,omitempty"`
	Time         string `json:"time,omitempty"`
	TimeInMillis int64  `json:"time_in_millis,omitempty"`
	Current      int64  `json:"current,omitempty"`
}

IndexStatsSuggest provides statistics about suggest operations for an index.

type IndexStatsTranslog

type IndexStatsTranslog struct {
	Operations              int64  `json:"operations,omitempty"`
	Size                    string `json:"size,omitempty"`
	SizeInBytes             int64  `json:"size_in_bytes,omitempty"`
	UncommittedOperations   int64  `json:"uncommitted_operations,omitempty"`
	UncommittedSize         string `json:"uncommitted_size,omitempty"`
	UncommittedSizeInBytes  int64  `json:"uncommitted_size_in_bytes,omitempty"`
	EarliestLastModifiedAge int64  `json:"earliest_last_modified_age,omitempty"`
}

IndexStatsTranslog provides statistics about the transaction log (translog) for an index.

type IndexStatsWarmer

type IndexStatsWarmer struct {
	Current           int64  `json:"current,omitempty"`
	Total             int64  `json:"total,omitempty"`
	TotalTime         string `json:"total_time,omitempty"`
	TotalTimeInMillis int64  `json:"total_time_in_millis,omitempty"`
}

IndexStatsWarmer provides statistics about index warmer operations.

type IndexTemplateMetaData

type IndexTemplateMetaData struct {
	// IndexPatterns lists the glob patterns that determine which indices this template applies to.
	IndexPatterns []string `json:"index_patterns"`
	// Order controls precedence when multiple templates match; higher values take priority.
	Order int `json:"order"`
	// Settings holds the index settings defined by this template.
	Settings map[string]any `json:"settings"`
	// Mappings holds the index mapping defined by this template.
	Mappings map[string]any `json:"mappings"`
	// Aliases holds the aliases this template creates on new matching indices.
	Aliases map[string]any `json:"aliases"`
}

IndexTemplateMetaData represents the metadata of a legacy index template.

type IndicesAnalyzeCharFilter

type IndicesAnalyzeCharFilter struct {
	// Name is the character filter name (e.g. "html_strip", "pattern_replace").
	Name string `json:"name"`
	// FilteredText contains the text output after this character filter was applied.
	FilteredText []string `json:"filtered_text"`
}

IndicesAnalyzeCharFilter describes a character filter applied during analysis.

type IndicesAnalyzeDetail

type IndicesAnalyzeDetail struct {
	// CustomAnalyzer indicates whether a custom analyzer was used.
	CustomAnalyzer bool `json:"custom_analyzer"`
	// Analyzer is the name of the analyzer used.
	Analyzer string `json:"analyzer,omitempty"`
	// Tokenizer describes the tokenizer component and its output.
	Tokenizer *IndicesAnalyzeTokenizer `json:"tokenizer,omitempty"`
	// TokenFilters lists the token filters applied and their outputs.
	TokenFilters []IndicesAnalyzeTokenFilter `json:"tokenfilters,omitempty"`
	// CharFilters lists the character filters applied and their outputs.
	CharFilters []IndicesAnalyzeCharFilter `json:"charfilters,omitempty"`
}

IndicesAnalyzeDetail describes the analysis chain applied during an analyze request, including the tokenizer, character filters, and token filters used.

type IndicesAnalyzeResponse

type IndicesAnalyzeResponse struct {
	// Tokens contains the individual tokens produced during analysis.
	Tokens []IndicesAnalyzeToken `json:"tokens"`
	// Detail provides information about the analyzers, tokenizers, and filters that were applied.
	Detail IndicesAnalyzeDetail `json:"detail"`
}

IndicesAnalyzeResponse represents the result of an analyze API call, containing the tokens produced by the analysis chain.

type IndicesAnalyzeToken

type IndicesAnalyzeToken struct {
	// Token is the token text.
	Token string `json:"token"`
	// StartOffset is the character offset where the token starts in the original text.
	StartOffset int64 `json:"start_offset"`
	// EndOffset is the character offset where the token ends (exclusive).
	EndOffset int64 `json:"end_offset"`
	// Type is the token type (e.g. "word", "NUM", "<ALPHANUM>").
	Type string `json:"type"`
	// Position is the ordinal position of the token in the token stream.
	Position int64 `json:"position"`
}

IndicesAnalyzeToken represents a single token produced by the analyze API.

type IndicesAnalyzeTokenFilter

type IndicesAnalyzeTokenFilter struct {
	// Name is the token filter name (e.g. "lowercase", "stop").
	Name string `json:"name"`
	// Tokens are the tokens produced after this filter was applied.
	Tokens []IndicesAnalyzeToken `json:"tokens"`
}

IndicesAnalyzeTokenFilter describes a token filter applied during analysis and the tokens it produced.

type IndicesAnalyzeTokenizer

type IndicesAnalyzeTokenizer struct {
	// Name is the tokenizer type name (e.g. "standard").
	Name string `json:"name"`
	// Tokens are the tokens produced by this tokenizer.
	Tokens []IndicesAnalyzeToken `json:"tokens"`
}

IndicesAnalyzeTokenizer describes the tokenizer used during analysis and the tokens it produced.

type IndicesBlockResponse

type IndicesBlockResponse struct {
	Acknowledged       bool `json:"acknowledged"`
	ShardsAcknowledged bool `json:"shards_acknowledged,omitempty"`
}

IndicesBlockResponse is returned by the add block API.

type IndicesClearCacheResponse

type IndicesClearCacheResponse struct {
	// Shards provides shard-level statistics for the clear cache operation.
	Shards *types.ShardsInfo `json:"_shards"`
}

IndicesClearCacheResponse represents the result of a clear cache operation, containing shard-level status.

type IndicesComponentTemplateBody

type IndicesComponentTemplateBody struct {
	// Template defines the settings, mappings, and aliases provided by this component.
	Template IndicesTemplateContent `json:"template"`
	// Version is an optional version number for the component template.
	Version *int64 `json:"version,omitempty"`
	// Meta holds optional user-defined metadata for the component template.
	Meta map[string]any `json:"_meta,omitempty"`
}

IndicesComponentTemplateBody holds the definition of a component template, which serves as a reusable building block for composable index templates.

type IndicesComponentTemplateItem

type IndicesComponentTemplateItem struct {
	// Name is the component template name.
	Name string `json:"name"`
	// ComponentTemplate contains the component template definition.
	ComponentTemplate IndicesComponentTemplateBody `json:"component_template"`
}

IndicesComponentTemplateItem represents a single component template within a get component template response.

type IndicesDataStreamGetResponse

type IndicesDataStreamGetResponse struct {
	// DataStreams lists the data stream definitions returned.
	DataStreams []DataStream `json:"data_streams"`
}

IndicesDataStreamGetResponse represents the response from the get data stream API.

type IndicesDataStreamsStatsResponse

type IndicesDataStreamsStatsResponse struct {
	Shards          *types.ShardsInfo  `json:"_shards,omitempty"`
	DataStreamCount int                `json:"data_stream_count"`
	BackingIndices  int                `json:"backing_indices"`
	TotalStoreSize  int64              `json:"total_store_size_bytes"`
	DataStreams     []*DataStreamStats `json:"data_streams,omitempty"`
}

IndicesDataStreamsStatsResponse represents data stream statistics.

type IndicesFlushResponse

type IndicesFlushResponse struct {
	// Shards provides shard-level statistics for the flush operation.
	Shards *types.ShardsInfo `json:"_shards"`
}

IndicesFlushResponse represents the result of a flush operation, containing shard-level status.

type IndicesForcemergeResponse

type IndicesForcemergeResponse struct {
	// Shards provides shard-level statistics for the forcemerge operation.
	Shards *types.ShardsInfo `json:"_shards"`
}

IndicesForcemergeResponse represents the result of a forcemerge operation, containing shard-level status.

type IndicesGetComponentTemplateResponse

type IndicesGetComponentTemplateResponse struct {
	// ComponentTemplates lists the component templates returned.
	ComponentTemplates []IndicesComponentTemplateItem `json:"component_templates"`
}

IndicesGetComponentTemplateResponse represents the response from the get component template API.

type IndicesGetIndexTemplateResponse

type IndicesGetIndexTemplateResponse struct {
	// IndexTemplates lists the composable index templates returned.
	IndexTemplates []IndicesIndexTemplateItem `json:"index_templates"`
}

IndicesGetIndexTemplateResponse represents the response from the get index template API, containing composable index templates.

type IndicesGetResponse

type IndicesGetResponse struct {
	// Aliases maps alias names to their configuration (filters, routing).
	Aliases map[string]any `json:"aliases"`
	// Mappings contains the index mapping definition keyed by type name.
	Mappings map[string]any `json:"mappings"`
	// Settings holds the index settings including number of shards, replicas, and analysis config.
	Settings map[string]any `json:"settings"`
	// Warmers contains index warmer definitions, if any.
	Warmers map[string]any `json:"warmers"`
}

IndicesGetResponse represents the full metadata of an index returned by the get index API, including its aliases, mappings, settings, and warmers.

type IndicesGetSettingsResponse

type IndicesGetSettingsResponse struct {
	// Settings contains the user-defined settings for the index.
	Settings map[string]any `json:"settings"`
	// Defaults contains the default settings applied by OpenSearch when not explicitly set.
	Defaults map[string]any `json:"defaults,omitempty"`
}

IndicesGetSettingsResponse represents the settings for a single index returned by the get settings API, including both user-defined and default settings.

type IndicesGetTemplateResponse

type IndicesGetTemplateResponse struct {
	// IndexPatterns lists the glob patterns that determine which indices this template applies to.
	IndexPatterns []string `json:"index_patterns"`
	// Order controls precedence when multiple templates match.
	Order int `json:"order"`
	// Settings holds the index settings defined by this template.
	Settings map[string]any `json:"settings,omitempty"`
	// Mappings holds the index mapping defined by this template.
	Mappings map[string]any `json:"mappings,omitempty"`
	// Aliases holds the aliases this template creates on new matching indices.
	Aliases map[string]any `json:"aliases,omitempty"`
	// Version is an optional version number for the template.
	Version *int64 `json:"version,omitempty"`
}

IndicesGetTemplateResponse represents the definition of a legacy index template returned by the get template API.

type IndicesIndexTemplateBody

type IndicesIndexTemplateBody struct {
	// IndexPatterns lists the glob patterns that determine which indices this template applies to.
	IndexPatterns []string `json:"index_patterns"`
	// Template defines the index settings, mappings, and aliases applied by this template.
	Template IndicesTemplateContent `json:"template,omitempty"`
	// Priority determines precedence when multiple templates match; higher values take priority.
	Priority int `json:"priority,omitempty"`
	// ComposedOf lists the component template names that are composed into this index template.
	ComposedOf []string `json:"composed_of,omitempty"`
	// Meta holds optional user-defined metadata for the template.
	Meta map[string]any `json:"_meta,omitempty"`
	// DataStream configures data stream behavior when this template is used to create a data stream.
	DataStream *DataStreamTemplate `json:"data_stream,omitempty"`
	// AllowAutoCreate controls whether indices matching the template patterns are auto-created on write.
	AllowAutoCreate *bool `json:"allow_auto_create,omitempty"`
}

IndicesIndexTemplateBody holds the full definition of a composable index template, including index patterns, component composition, and data stream configuration.

type IndicesIndexTemplateItem

type IndicesIndexTemplateItem struct {
	// Name is the template name.
	Name string `json:"name"`
	// IndexTemplate contains the template definition.
	IndexTemplate IndicesIndexTemplateBody `json:"index_template"`
}

IndicesIndexTemplateItem represents a single composable index template within a get index template response.

type IndicesOpenParams

type IndicesOpenParams struct {
	// WaitForActiveShards specifies the number of active shards that must be
	// available before the request returns. Use "all" or an integer string.
	WaitForActiveShards string
	// ClusterManagerTimeout is the preferred timeout for cluster-manager operations.
	ClusterManagerTimeout string
	// MasterTimeout is a deprecated alias for ClusterManagerTimeout.
	//
	// Deprecated: use ClusterManagerTimeout.
	MasterTimeout string
	// Timeout is the operation timeout.
	Timeout string
	// ExpandWildcards controls which index name expressions are resolved to
	// concrete indices. Use the ExpandWildcard* constants in param_types.go.
	ExpandWildcards string
	// IgnoreUnavailable, when true, missing or closed indices are not returned
	// as an error.
	IgnoreUnavailable *bool
	// AllowNoIndices, when true, a wildcard expression that resolves to no
	// indices is not returned as an error.
	AllowNoIndices *bool
}

IndicesOpenParams holds the optional query parameters for the Open Index API.

See https://opensearch.org/docs/latest/api-reference/index-apis/open-index/

func (*IndicesOpenParams) ToMap

func (p *IndicesOpenParams) ToMap() map[string]string

ToMap converts IndicesOpenParams to a query-parameter map for resty SetQueryParams. Returns nil if no params are set.

type IndicesRecoveryResponse

type IndicesRecoveryResponse struct {
	Indices map[string]*IndexRecovery `json:"indices,omitempty"`
}

IndicesRecoveryResponse maps index names to their recovery state.

type IndicesResolveIndexResponse

type IndicesResolveIndexResponse struct {
	Indices     []*ResolvedIndex      `json:"indices,omitempty"`
	Aliases     []*ResolvedAlias      `json:"aliases,omitempty"`
	DataStreams []*ResolvedDataStream `json:"data_streams,omitempty"`
}

IndicesResolveIndexResponse is the response from the resolve index API.

type IndicesRolloverResponse

type IndicesRolloverResponse struct {
	// OldIndex is the name of the index that was rolled over from.
	OldIndex string `json:"old_index"`
	// NewIndex is the name of the newly created index after rollover.
	NewIndex string `json:"new_index"`
	// RolledOver indicates whether the rollover was actually performed.
	RolledOver bool `json:"rolled_over"`
	// DryRun indicates whether this was a dry-run that did not perform the rollover.
	DryRun bool `json:"dry_run"`
	// Acknowledged indicates whether the request was acknowledged by the cluster.
	Acknowledged bool `json:"acknowledged"`
	// ShardsAcknowledged indicates whether the required number of shard copies started before timeout.
	ShardsAcknowledged bool `json:"shards_acknowledged"`
	// Conditions maps each rollover condition to a boolean indicating whether it was met.
	Conditions map[string]bool `json:"conditions"`
}

IndicesRolloverResponse represents the result of a rollover operation. It indicates whether the rollover occurred, the old and new index names, and which conditions were met.

type IndicesSegmentsResponse

type IndicesSegmentsResponse struct {
	// Shards provides shard-level statistics for the request.
	Shards *types.ShardsInfo `json:"_shards"`
	// Indices maps index names to their segment information.
	Indices map[string]*IndexSegments `json:"indices,omitempty"`
}

IndicesSegmentsResponse represents the response from the segments API, containing low-level Lucene segment details per index and per shard.

type IndicesService

type IndicesService interface {
	Create(ctx context.Context, index string, body any) (*types.AcknowledgedResponse, error)
	Delete(ctx context.Context, indices []string) (*types.AcknowledgedResponse, error)
	Get(ctx context.Context, indices []string) (map[string]*IndicesGetResponse, error)
	Exists(ctx context.Context, indices []string) (bool, error)
	Open(ctx context.Context, index string, params ...*IndicesOpenParams) (*types.AcknowledgedResponse, error)
	Close(ctx context.Context, index string) (*types.AcknowledgedResponse, error)
	Rollover(ctx context.Context, alias string, body any) (*IndicesRolloverResponse, error)
	Shrink(ctx context.Context, req *ShrinkRequest) (*types.AcknowledgedResponse, error)
	Flush(ctx context.Context, indices []string) (*IndicesFlushResponse, error)
	Refresh(ctx context.Context, indices []string) (*RefreshResult, error)
	Forcemerge(ctx context.Context, indices []string) (*IndicesForcemergeResponse, error)
	// Deprecated: Freeze is not supported in OpenSearch (Elasticsearch-only).
	Freeze(ctx context.Context, index string) (*types.AcknowledgedResponse, error)
	// Deprecated: Unfreeze is not supported in OpenSearch (Elasticsearch-only).
	Unfreeze(ctx context.Context, index string) (*types.AcknowledgedResponse, error)
	ClearCache(ctx context.Context, indices []string) (*IndicesClearCacheResponse, error)
	Stats(ctx context.Context, req *IndicesStatsRequest) (*IndicesStatsResponse, error)
	Segments(ctx context.Context, indices []string) (*IndicesSegmentsResponse, error)
	Analyze(ctx context.Context, index string, body any) (*IndicesAnalyzeResponse, error)
	PutAlias(ctx context.Context, req *PutAliasRequest) (*types.AcknowledgedResponse, error)
	GetAliases(ctx context.Context, indices []string) (map[string]*IndicesGetResponse, error)
	GetSettings(ctx context.Context, indices []string) (map[string]*IndicesGetSettingsResponse, error)
	PutSettings(ctx context.Context, indices []string, body any) (*types.AcknowledgedResponse, error)
	GetMapping(ctx context.Context, indices []string) (map[string]any, error)
	PutMapping(ctx context.Context, req *PutMappingRequest) (*types.AcknowledgedResponse, error)
	GetFieldMapping(ctx context.Context, req *GetFieldMappingRequest) (map[string]any, error)
	GetTemplate(ctx context.Context, names []string) (map[string]*IndicesGetTemplateResponse, error)
	PutTemplate(ctx context.Context, req *PutTemplateRequest) (*types.AcknowledgedResponse, error)
	ExistsTemplate(ctx context.Context, name string) (bool, error)
	DeleteTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)
	PutIndexTemplate(ctx context.Context, req *PutIndexTemplateRequest) (*types.AcknowledgedResponse, error)
	GetIndexTemplate(ctx context.Context, names []string) (*IndicesGetIndexTemplateResponse, error)
	DeleteIndexTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)
	PutComponentTemplate(ctx context.Context, req *PutComponentTemplateRequest) (*types.AcknowledgedResponse, error)
	GetComponentTemplate(ctx context.Context, names []string) (*IndicesGetComponentTemplateResponse, error)
	DeleteComponentTemplate(ctx context.Context, name string) (*types.AcknowledgedResponse, error)
	CreateDataStream(ctx context.Context, name string) (*types.AcknowledgedResponse, error)
	GetDataStream(ctx context.Context, names []string) (*IndicesDataStreamGetResponse, error)
	DeleteDataStream(ctx context.Context, names []string) (*types.AcknowledgedResponse, error)
	AddBlock(ctx context.Context, req *AddBlockRequest) (*IndicesBlockResponse, error)
	Clone(ctx context.Context, req *CloneRequest) (*types.AcknowledgedResponse, error)
	Split(ctx context.Context, req *SplitRequest) (*types.AcknowledgedResponse, error)
	DeleteAlias(ctx context.Context, req *DeleteAliasRequest) (*types.AcknowledgedResponse, error)
	ExistsAlias(ctx context.Context, indices []string, name string) (bool, error)
	ExistsIndexTemplate(ctx context.Context, name string) (bool, error)
	Recovery(ctx context.Context, indices []string) (*IndicesRecoveryResponse, error)
	ShardStores(ctx context.Context, indices []string) (*IndicesShardStoresResponse, error)
	UpdateAliases(ctx context.Context, body any) (*types.AcknowledgedResponse, error)
	ResolveIndex(ctx context.Context, name string) (*IndicesResolveIndexResponse, error)
	SimulateIndexTemplate(ctx context.Context, req *SimulateIndexTemplateRequest) (*IndicesSimulateTemplateResponse, error)
	SimulateTemplate(ctx context.Context, req *SimulateTemplateRequest) (*IndicesSimulateTemplateResponse, error)
	DataStreamsStats(ctx context.Context, names []string) (*IndicesDataStreamsStatsResponse, error)
}

func NewIndicesService

func NewIndicesService(client *resty.Client, logger *logrus.Entry) IndicesService

type IndicesShardStoresResponse

type IndicesShardStoresResponse struct {
	Indices map[string]*IndexShardStores `json:"indices,omitempty"`
}

IndicesShardStoresResponse represents shard store information.

type IndicesSimulateTemplateResponse

type IndicesSimulateTemplateResponse struct {
	Template    map[string]any   `json:"template,omitempty"`
	Mappings    map[string]any   `json:"mappings,omitempty"`
	Overlapping []map[string]any `json:"overlapping,omitempty"`
}

IndicesSimulateTemplateResponse is the response from simulate template/index APIs.

type IndicesStatsRequest

type IndicesStatsRequest struct {
	Indices []string
	Metrics []string
}

type IndicesStatsResponse

type IndicesStatsResponse struct {
	// Shards provides shard-level statistics for the stats request itself.
	Shards *types.ShardsInfo `json:"_shards"`
	// All contains aggregated statistics across all indices.
	All *IndexStats `json:"_all,omitempty"`
	// Indices maps individual index names to their statistics.
	Indices map[string]*IndexStats `json:"indices,omitempty"`
}

IndicesStatsResponse represents the response from the indices stats API. It includes overall cluster shard statistics, aggregate stats across all indices, and per-index statistics when requested.

type IndicesTemplateContent

type IndicesTemplateContent struct {
	// Settings holds the index settings to apply.
	Settings map[string]any `json:"settings,omitempty"`
	// Mappings holds the index mapping to apply.
	Mappings map[string]any `json:"mappings,omitempty"`
	// Aliases holds the aliases to create on new indices matching the template.
	Aliases map[string]any `json:"aliases,omitempty"`
}

IndicesTemplateContent defines the settings, mappings, and aliases that a template applies to new indices.

type InfoResponse

type InfoResponse struct {
	Name        string       `json:"name"`
	ClusterName string       `json:"cluster_name"`
	ClusterUUID string       `json:"cluster_uuid"`
	Version     *InfoVersion `json:"version,omitempty"`
	Tagline     string       `json:"tagline"`
}

InfoResponse represents the cluster info returned by the root endpoint.

type InfoService

type InfoService interface {
	Info(ctx context.Context) (*InfoResponse, error)
	Ping(ctx context.Context) (bool, error)
}

InfoService provides access to cluster-level info and ping endpoints.

func NewInfoService

func NewInfoService(client *resty.Client, logger *logrus.Entry) InfoService

NewInfoService creates a new InfoService.

type InfoVersion

type InfoVersion struct {
	Distribution       string `json:"distribution,omitempty"`
	Number             string `json:"number"`
	BuildType          string `json:"build_type,omitempty"`
	BuildHash          string `json:"build_hash,omitempty"`
	BuildDate          string `json:"build_date,omitempty"`
	BuildSnapshot      bool   `json:"build_snapshot,omitempty"`
	LuceneVersion      string `json:"lucene_version,omitempty"`
	MinimumWireCompat  string `json:"minimum_wire_compatibility_version,omitempty"`
	MinimumIndexCompat string `json:"minimum_index_compatibility_version,omitempty"`
}

InfoVersion contains the OpenSearch version details.

type IngestDeletePipelineResponse

type IngestDeletePipelineResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IngestDeletePipelineResponse represents the acknowledgment response from deleting an ingest pipeline. The Acknowledged field indicates whether the delete was acknowledged by the cluster.

type IngestGetPipeline

type IngestGetPipeline struct {
	Description string           `json:"description"`
	Processors  []map[string]any `json:"processors"`
	Version     int64            `json:"version,omitempty"`
	OnFailure   []map[string]any `json:"on_failure,omitempty"`
}

IngestGetPipeline represents the definition of a single ingest pipeline, including its description, ordered list of processors, optional version, and optional on-failure processor chain.

type IngestGetPipelineResponse

type IngestGetPipelineResponse map[string]*IngestGetPipeline

IngestGetPipelineResponse maps pipeline IDs to their definitions. Each value is an IngestGetPipeline containing the processors, description, and optional version of the pipeline.

type IngestProcessorGrokResponse

type IngestProcessorGrokResponse struct {
	Patterns map[string]string `json:"patterns"`
}

IngestProcessorGrokResponse is returned by the grok processor endpoint. The API returns {"patterns": {"BAC": "...", ...}} where each key is a grok pattern name and each value is its regex definition.

type IngestPutPipelineRequest

type IngestPutPipelineRequest struct {
	Id   string `validate:"required"`
	Body any    `validate:"required"`
}

func (*IngestPutPipelineRequest) Validate

func (r *IngestPutPipelineRequest) Validate() error

type IngestPutPipelineResponse

type IngestPutPipelineResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

IngestPutPipelineResponse represents the acknowledgment response from creating or updating an ingest pipeline. The Acknowledged field indicates whether the operation was acknowledged by the cluster.

type IngestService

type IngestService interface {
	PutPipeline(ctx context.Context, req *IngestPutPipelineRequest) (*IngestPutPipelineResponse, error)
	GetPipeline(ctx context.Context, ids []string) (IngestGetPipelineResponse, error)
	DeletePipeline(ctx context.Context, id string) (*IngestDeletePipelineResponse, error)
	SimulatePipeline(ctx context.Context, req *IngestSimulatePipelineRequest) (*IngestSimulatePipelineResponse, error)
	ProcessorGrok(ctx context.Context) (map[string][]string, error)
}

func NewIngestService

func NewIngestService(client *resty.Client, logger *logrus.Entry) IngestService

type IngestSimulateDocumentResult

type IngestSimulateDocumentResult struct {
	Doc              map[string]any                   `json:"doc"`
	ProcessorResults []*IngestSimulateProcessorResult `json:"processor_results"`
}

IngestSimulateDocumentResult represents the simulation result for a single document, including the final document state and the output of each processor.

type IngestSimulatePipelineRequest

type IngestSimulatePipelineRequest struct {
	Id   string
	Body any `validate:"required"`
}

func (*IngestSimulatePipelineRequest) Validate

func (r *IngestSimulatePipelineRequest) Validate() error

type IngestSimulatePipelineResponse

type IngestSimulatePipelineResponse struct {
	Docs []*IngestSimulateDocumentResult `json:"docs"`
}

IngestSimulatePipelineResponse represents the result of simulating an ingest pipeline. It contains the per-document simulation results showing how each processor transforms the document.

type IngestSimulateProcessorResult

type IngestSimulateProcessorResult struct {
	ProcessorTag string         `json:"tag"`
	Doc          map[string]any `json:"doc"`
}

IngestSimulateProcessorResult represents the output of a single processor during pipeline simulation, including the processor tag and resulting document.

type IsmActionResponse

type IsmActionResponse struct {
	UpdatedIndices int64            `json:"updated_indices"`
	FailedIndices  []IsmFailedIndex `json:"failed_indices,omitempty"`
	Failures       *bool            `json:"failures,omitempty"`
}

IsmActionResponse represents the response from ISM add/remove/change/retry actions.

type IsmDeletePolicyResponse

type IsmDeletePolicyResponse struct {
	Index          *string        `json:"_index,omitempty"`
	ID             *string        `json:"_id,omitempty"`
	Version        *int64         `json:"_version,omitempty"`
	Result         *string        `json:"result,omitempty"`
	ForcedRefresh  *bool          `json:"forced_refresh,omitempty"`
	Shards         map[string]any `json:"_shards,omitempty"`
	SequenceNumber *int64         `json:"_seq_no,omitempty"`
	PrimaryTerm    *int64         `json:"_primary_term,omitempty"`
}

IsmDeletePolicyResponse represents the response from the ISM delete policy API, confirming the deletion with the document ID, version, and result status.

type IsmErrorNotification

type IsmErrorNotification struct {
	Destination     *IsmErrorNotificationDestination     `json:"destination,omitempty"`
	Channel         *IsmErrorNotificationChannel         `json:"channel,omitempty"`
	MessageTemplate *IsmErrorNotificationMessageTemplate `json:"message_template,omitempty"`
}

IsmErrorNotification defines the error notification configuration for an ISM policy, specifying where to send notifications when policy actions fail.

type IsmErrorNotificationChannel

type IsmErrorNotificationChannel struct {
	ID string `json:"id"`
}

IsmErrorNotificationChannel defines a notification channel by ID for ISM error notifications.

type IsmErrorNotificationDestination

type IsmErrorNotificationDestination struct {
	Type          string                                        `json:"type"`
	Chime         *IsmErrorNotificationDestinationChime         `json:"chime,omitempty"`
	Slack         *IsmErrorNotificationDestinationSlack         `json:"slack,omitempty"`
	CustomWebhook *IsmErrorNotificationDestinationCustomWebhook `json:"custom_webhook,omitempty"`
}

IsmErrorNotificationDestination defines the destination for ISM error notifications, supporting Chime, Slack, or custom webhook endpoints.

type IsmErrorNotificationDestinationChime

type IsmErrorNotificationDestinationChime struct {
	Url string `json:"url"`
}

IsmErrorNotificationDestinationChime defines the Chime webhook URL for ISM error notifications.

type IsmErrorNotificationDestinationCustomWebhook

type IsmErrorNotificationDestinationCustomWebhook struct {
	Url          *string           `json:"url,omitempty"`
	Scheme       *string           `json:"scheme,omitempty"`
	Host         *string           `json:"host,omitempty"`
	Port         *int64            `json:"port,omitempty"`
	Path         *string           `json:"path,omitempty"`
	QueryParams  map[string]string `json:"query_params,omitempty"`
	HeaderParams map[string]string `json:"header_params,omitempty"`
	Username     *string           `json:"username,omitempty"`
	Password     *string           `json:"password,omitempty"`
}

IsmErrorNotificationDestinationCustomWebhook defines a custom webhook destination for ISM error notifications, with configurable URL, authentication, headers, and query parameters.

type IsmErrorNotificationDestinationSlack

type IsmErrorNotificationDestinationSlack struct {
	Url string `json:"url"`
}

IsmErrorNotificationDestinationSlack defines the Slack webhook URL for ISM error notifications.

type IsmErrorNotificationMessageTemplate

type IsmErrorNotificationMessageTemplate struct {
	ScriptType string            `json:"type"`
	Lang       string            `json:"lang"`
	IdOrCode   string            `json:"idOrCode"`
	Options    map[string]string `json:"options,omitempty"`
	Params     map[string]string `json:"params,omitempty"`
}

IsmErrorNotificationMessageTemplate defines the message template for ISM error notifications, supporting inline scripts and stored script references.

type IsmExplainPolicy

type IsmExplainPolicy struct {
	PolicyId             string                    `json:"policy_id,omitempty"`
	PolicySequenceNumber int64                     `json:"policy_seq_no,omitempty"`
	PolicyPrimaryTerm    int64                     `json:"policy_primary_term,omitempty"`
	Index                string                    `json:"index,omitempty"`
	IndexId              string                    `json:"index_uuid,omitempty"`
	IndexCreationDate    int64                     `json:"index_creation_date,omitempty"`
	Enabled              bool                      `json:"enabled,omitempty"`
	Policy               *IsmGetPolicy             `json:"policy,omitempty"`
	State                IsmExplainPolicyState     `json:"state"`
	Action               IsmExplainPolicyAction    `json:"action"`
	Step                 IsmExplainPolicyStep      `json:"step"`
	RetryInfo            IsmExplainPolicyRetryInfo `json:"retry_info"`
	Info                 IsmExplainPolicyInfo      `json:"info"`
}

IsmExplainPolicy represents the ISM policy status for a single index, including the current state, action, step, retry info, and policy metadata.

type IsmExplainPolicyAction

type IsmExplainPolicyAction struct {
	Name            string `json:"name"`
	StartTime       int64  `json:"start_time"`
	Index           int64  `json:"index"`
	Failed          bool   `json:"failed"`
	ConsumedRetries int64  `json:"consumed_retries"`
	LastRetryTime   int64  `json:"last_retry_time"`
}

IsmExplainPolicyAction represents the currently executing action information within an ISM policy on a managed index.

type IsmExplainPolicyInfo

type IsmExplainPolicyInfo struct {
	Message string `json:"message"`
	Cause   string `json:"cause"`
}

IsmExplainPolicyInfo contains informational messages and error causes about the current ISM policy execution on a managed index.

type IsmExplainPolicyResponse

type IsmExplainPolicyResponse struct {
	Indexes             map[string]IsmExplainPolicy `json:",inline"`
	TotalManagedIndices int64                       `json:"total_managed_indices"`
}

IsmExplainPolicyResponse represents the response from the ISM explain API, containing a map of index names to their ISM policy status and the total count of managed indices.

type IsmExplainPolicyRetryInfo

type IsmExplainPolicyRetryInfo struct {
	Failed          bool  `json:"failed"`
	ConsumedRetries int64 `json:"consumed_retries"`
}

IsmExplainPolicyRetryInfo contains retry information for a failed ISM policy action.

type IsmExplainPolicyState

type IsmExplainPolicyState struct {
	Name      string `json:"name"`
	StartTime int64  `json:"start_time"`
}

IsmExplainPolicyState represents the current state information of an ISM policy on a managed index.

type IsmExplainPolicyStep

type IsmExplainPolicyStep struct {
	Name       string `json:"name"`
	StartTime  int64  `json:"start_time"`
	StepStatus string `json:"step_status"`
}

IsmExplainPolicyStep represents the current step status within an ISM policy action.

type IsmFailedIndex

type IsmFailedIndex struct {
	IndexName string `json:"index_name"`
	Reason    string `json:"reason"`
}

IsmFailedIndex represents a single index that failed an ISM action.

type IsmGetPolicy

type IsmGetPolicy struct {
	IsmPolicyBase   `json:",inline"`
	SchemaVersion   *int64 `json:"schema_version,omitempty"`
	LastUpdatedTime *int64 `json:"last_updated_time,omitempty"`
}

IsmGetPolicy represents the policy data returned within an ISM GET response, extending IsmPolicyBase with schema version and last updated timestamp.

type IsmGetPolicyResponse

type IsmGetPolicyResponse struct {
	Id             string       `json:"_id"`
	Version        int64        `json:"_version"`
	SequenceNumber int64        `json:"_seq_no"`
	PrimaryTerm    int64        `json:"_primary_term"`
	Policy         IsmGetPolicy `json:"policy"`
}

IsmGetPolicyResponse represents the full response from the ISM GET policy API, including the document ID, version, sequence number, primary term, and the policy definition.

type IsmListPoliciesResponse

type IsmListPoliciesResponse struct {
	Policies      []IsmPolicySummary `json:"policies"`
	TotalPolicies int64              `json:"total_policies"`
}

IsmListPoliciesResponse represents the response from the list ISM policies API.

type IsmPolicyBase

type IsmPolicyBase struct {
	ID                *string               `json:"policy_id,omitempty"`
	Description       *string               `json:"description,omitempty"`
	ErrorNotification *IsmErrorNotification `json:"error_notification,omitempty"`
	DefaultState      *string               `json:"default_state,omitempty"`
	States            []IsmPolicyState      `json:"states,omitempty"`
	IsmTemplate       []IsmPolicyTemplate   `json:"ism_template,omitempty"`
}

IsmPolicyBase represents the base definition of an Index State Management (ISM) policy, including its states, transitions, default state, error notifications, and ISM templates that auto-apply the policy to matching indices.

type IsmPolicyState

type IsmPolicyState struct {
	Name        string                     `json:"name"`
	Actions     []map[string]any           `json:"actions,omitempty"`
	Transitions []IsmPolicyStateTransition `json:"transitions,omitempty"`
}

IsmPolicyState represents a state within an ISM policy, defining the actions to perform when an index is in this state and the conditions for transitioning to other states.

type IsmPolicyStateTransition

type IsmPolicyStateTransition struct {
	StateName  string         `json:"state_name"`
	Conditions map[string]any `json:"conditions,omitempty"`
}

IsmPolicyStateTransition defines a transition rule between ISM policy states, specifying the target state name and optional conditions that trigger the transition.

type IsmPolicySummary

type IsmPolicySummary struct {
	IsmPolicyBase   `json:",inline"`
	SchemaVersion   *int64 `json:"schema_version,omitempty"`
	LastUpdatedTime *int64 `json:"last_updated_time,omitempty"`
}

IsmPolicySummary represents a single ISM policy entry as returned by the list policies API.

type IsmPolicyTemplate

type IsmPolicyTemplate struct {
	IndexPatterns   []string `json:"index_patterns,omitempty"`
	Priority        *int64   `json:"priority,omitempty"`
	LastUpdatedTime *int64   `json:"last_updated_time,omitempty"`
}

IsmPolicyTemplate defines an ISM template that auto-applies an ISM policy to indices matching the specified index patterns, with a priority for resolving template conflicts.

type IsmPutPolicy

type IsmPutPolicy struct {
	Policy IsmPolicyBase `json:"policy"`
}

IsmPutPolicy wraps an ISM policy for the PUT API request body.

type IsmPutPolicyRequest

type IsmPutPolicyRequest struct {
	PolicyName string         `validate:"required"`
	Body       *IsmPolicyBase `validate:"required"`
	Version    *types.DocumentVersion
}

func (*IsmPutPolicyRequest) Validate

func (r *IsmPutPolicyRequest) Validate() error

type IsmService

type IsmService interface {
	GetPolicy(ctx context.Context, policyName string) (*IsmGetPolicyResponse, error)
	PutPolicy(ctx context.Context, req *IsmPutPolicyRequest) (*IsmGetPolicyResponse, error)
	DeletePolicy(ctx context.Context, policyName string) (*IsmDeletePolicyResponse, error)
	ExplainPolicy(ctx context.Context, indexName string) (*IsmExplainPolicyResponse, error)
	AddPolicy(ctx context.Context, index string, body any) (*IsmActionResponse, error)
	RemovePolicy(ctx context.Context, index string) (*IsmActionResponse, error)
	ChangePolicy(ctx context.Context, index string, body any) (*IsmActionResponse, error)
	RetryFailedIndex(ctx context.Context, index string, body any) (*IsmActionResponse, error)
	ListPolicies(ctx context.Context) (*IsmListPoliciesResponse, error)
}

IsmService interacts with the OpenSearch Index State Management (ISM) plugin.

func NewIsmService

func NewIsmService(client *resty.Client, logger *logrus.Entry) IsmService

type KnnGetModelResponse

type KnnGetModelResponse map[string]any

KnnGetModelResponse represents the response from retrieving a k-NN model by its identifier. The map contains the model definition and metadata.

type KnnSearchModelsResponse

type KnnSearchModelsResponse map[string]any

KnnSearchModelsResponse represents the response from searching k-NN models. The map contains search hits and pagination information.

type KnnService

type KnnService interface {
	// KnnStats retrieves k-NN plugin statistics. When stat is empty, all
	// stats are returned; otherwise only the named stat is returned.
	KnnStats(ctx context.Context, stat string) (*KnnStatsResponse, error)

	// KnnWarmup warms up k-NN indices by loading their graphs into memory.
	KnnWarmup(ctx context.Context, index string) (*KnnWarmupResponse, error)

	// ClearCache clears the k-NN cache for the specified index.
	ClearCache(ctx context.Context, index string) (*types.AcknowledgedResponse, error)

	// TrainModel trains a k-NN model using the provided request body.
	TrainModel(ctx context.Context, body any) (*KnnTrainModelResponse, error)

	// GetModel retrieves a k-NN model by its identifier.
	GetModel(ctx context.Context, modelId string) (*KnnGetModelResponse, error)

	// SearchModels searches for k-NN models using the provided query body.
	SearchModels(ctx context.Context, body any) (*KnnSearchModelsResponse, error)

	// DeleteModel deletes a k-NN model by its identifier.
	DeleteModel(ctx context.Context, modelId string) (*types.AcknowledgedResponse, error)
}

KnnService provides access to the k-NN plugin API. It supports stats, warmup, cache management, and model operations. See https://opensearch.org/docs/latest/search-plugins/knn/.

func NewKnnService

func NewKnnService(client *resty.Client, logger *logrus.Entry) KnnService

NewKnnService creates a new KnnService instance.

type KnnStatsResponse

type KnnStatsResponse map[string]any

KnnStatsResponse represents the response from the KNN stats endpoint. The map contains cluster-level statistics about the k-NN plugin.

type KnnTrainModelResponse

type KnnTrainModelResponse map[string]any

KnnTrainModelResponse represents the response from training a k-NN model. The map contains the trained model identifier and training status.

type KnnWarmupResponse

type KnnWarmupResponse struct {
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
}

KnnWarmupResponse represents the response from the KNN warmup endpoint. It contains shard-level information about the warmup operation.

type MgetResponse

type MgetResponse struct {
	// Docs contains the result for each requested document.
	Docs []*GetResult `json:"docs,omitempty"`
}

MgetResponse represents the result of a multi-get (mget) request. It contains one GetResult per requested document, in the same order as the input items.

type MlCreateConnectorResponse

type MlCreateConnectorResponse struct {
	ConnectorId string `json:"connector_id,omitempty"`
}

MlCreateConnectorResponse represents the response from creating a connector.

type MlDeployModelResponse

type MlDeployModelResponse struct {
	TaskId string `json:"task_id,omitempty"`
	Status string `json:"status,omitempty"`
}

MlDeployModelResponse represents the response from deploying a model.

type MlExecuteResponse

type MlExecuteResponse map[string]any

MlExecuteResponse represents the response from executing an algorithm.

type MlExecuteToolResponse

type MlExecuteToolResponse map[string]any

MlExecuteToolResponse represents the response from executing a tool.

type MlGetAgentResponse

type MlGetAgentResponse map[string]any

MlGetAgentResponse represents an agent detail response.

type MlGetConnectorResponse

type MlGetConnectorResponse map[string]any

MlGetConnectorResponse represents a connector detail response.

type MlGetModelResponse

type MlGetModelResponse map[string]any

MlGetModelResponse represents a model detail response.

type MlGetTaskResponse

type MlGetTaskResponse map[string]any

MlGetTaskResponse represents a task detail response.

type MlListToolsResponse

type MlListToolsResponse map[string]any

MlListToolsResponse represents the response from listing available tools.

type MlPredictResponse

type MlPredictResponse struct {
	InferenceResults []map[string]any `json:"inference_results,omitempty"`
}

MlPredictResponse represents the response from predicting with a model.

type MlProfileResponse

type MlProfileResponse map[string]any

MlProfileResponse represents the response from getting ML profile info.

type MlRegisterAgentResponse

type MlRegisterAgentResponse struct {
	AgentId string `json:"agent_id,omitempty"`
}

MlRegisterAgentResponse represents the response from registering an agent.

type MlRegisterModelGroupResponse

type MlRegisterModelGroupResponse struct {
	ModelGroupId string `json:"model_group_id,omitempty"`
	Status       string `json:"status,omitempty"`
}

MlRegisterModelGroupResponse represents the response from registering a model group.

type MlRegisterModelResponse

type MlRegisterModelResponse struct {
	TaskId   string `json:"task_id,omitempty"`
	TaskType string `json:"task_type,omitempty"`
	Status   string `json:"status,omitempty"`
}

MlRegisterModelResponse represents the response from registering a model.

type MlSearchAgentsResponse

type MlSearchAgentsResponse map[string]any

MlSearchAgentsResponse represents the response from searching agents.

type MlSearchConnectorsResponse

type MlSearchConnectorsResponse map[string]any

MlSearchConnectorsResponse represents the response from searching connectors.

type MlSearchModelsResponse

type MlSearchModelsResponse map[string]any

MlSearchModelsResponse represents the response from searching models.

type MlService

type MlService interface {
	RegisterModel(ctx context.Context, body any) (*MlRegisterModelResponse, error)
	DeployModel(ctx context.Context, modelId string) (*MlDeployModelResponse, error)
	UndeployModel(ctx context.Context, modelId string) (MlUndeployModelResponse, error)
	GetModel(ctx context.Context, modelId string) (MlGetModelResponse, error)
	SearchModels(ctx context.Context, body any) (MlSearchModelsResponse, error)
	UpdateModel(ctx context.Context, modelId string, body any) (MlUpdateModelResponse, error)
	DeleteModel(ctx context.Context, modelId string) (*types.AcknowledgedResponse, error)
	Predict(ctx context.Context, modelId string, body any) (*MlPredictResponse, error)
	Train(ctx context.Context, algorithm string, body any) (*MlTrainResponse, error)
	TrainAndPredict(ctx context.Context, algorithm string, body any) (*MlPredictResponse, error)
	Execute(ctx context.Context, algorithm string, body any) (MlExecuteResponse, error)
	MlStats(ctx context.Context, stat string) (MlStatsResponse, error)
	GetTask(ctx context.Context, taskId string) (MlGetTaskResponse, error)
	DeleteTask(ctx context.Context, taskId string) (*types.AcknowledgedResponse, error)
	CreateConnector(ctx context.Context, body any) (*MlCreateConnectorResponse, error)
	GetConnector(ctx context.Context, connectorId string) (MlGetConnectorResponse, error)
	DeleteConnector(ctx context.Context, connectorId string) (*types.AcknowledgedResponse, error)
	SearchConnectors(ctx context.Context, body any) (MlSearchConnectorsResponse, error)
	RegisterAgent(ctx context.Context, body any) (*MlRegisterAgentResponse, error)
	GetAgent(ctx context.Context, agentId string) (MlGetAgentResponse, error)
	DeleteAgent(ctx context.Context, agentId string) (*types.AcknowledgedResponse, error)
	SearchAgents(ctx context.Context, body any) (MlSearchAgentsResponse, error)
	DeleteModelGroup(ctx context.Context, modelGroupId string) (*types.AcknowledgedResponse, error)
	RegisterModelGroup(ctx context.Context, body any) (*MlRegisterModelGroupResponse, error)
	Profile(ctx context.Context, path string) (MlProfileResponse, error)
	ListTools(ctx context.Context) (MlListToolsResponse, error)
	ExecuteTool(ctx context.Context, toolName string, body any) (MlExecuteToolResponse, error)
}

MlService defines the interface for interacting with the OpenSearch ML Commons plugin.

func NewMlService

func NewMlService(client *resty.Client, logger *logrus.Entry) MlService

NewMlService creates a new MlService with the given REST client and logger.

type MlStatsResponse

type MlStatsResponse map[string]any

MlStatsResponse represents ML plugin stats.

type MlTrainResponse

type MlTrainResponse struct {
	TaskId string `json:"task_id,omitempty"`
}

MlTrainResponse represents the response from training a model.

type MlUndeployModelResponse

type MlUndeployModelResponse map[string]any

MlUndeployModelResponse represents the response from undeploying a model.

type MlUpdateModelResponse

type MlUpdateModelResponse map[string]any

MlUpdateModelResponse represents the response from updating a model.

type MultiGetItem

type MultiGetItem struct {
	// Index is the name of the index containing the document.
	Index string `json:"_index"`
	// Id is the document ID to retrieve.
	Id string `json:"_id"`
}

MultiGetItem identifies a single document to retrieve in a MultiGet request.

type MultiSearchTemplateParams

type MultiSearchTemplateParams struct {
	SearchType                 SearchType
	MaxConcurrentSearches      *int
	TypedKeys                  bool
	RestTotalHitsAsInt         bool
	PreFilterShardSize         *int
	MaxConcurrentShardRequests *int
	CcsMinimizeRoundtrips      bool
}

func (*MultiSearchTemplateParams) ToMap

func (p *MultiSearchTemplateParams) ToMap() map[string]string

type MultiSearchTemplateRequest

type MultiSearchTemplateRequest struct {
	Indices []string
	Body    any `validate:"required"`
	Params  *MultiSearchTemplateParams
}

func (*MultiSearchTemplateRequest) Validate

func (r *MultiSearchTemplateRequest) Validate() error

type MultiTermvectorResponse

type MultiTermvectorResponse struct {
	// Docs contains the term vector result for each requested document.
	Docs []*TermvectorsResponse `json:"docs"`
}

MultiTermvectorResponse represents the result of a multi-term-vectors request. It contains one TermvectorsResponse per requested document.

type NeuralService

type NeuralService interface {
	// NeuralStats retrieves neural plugin statistics. When stat is empty, all
	// stats are returned; otherwise only the named stat is returned.
	NeuralStats(ctx context.Context, stat string) (*NeuralStatsResponse, error)

	// NeuralWarmup warms up neural search indices by loading models into memory.
	NeuralWarmup(ctx context.Context, index string) (*NeuralWarmupResponse, error)

	// NeuralClearCache clears the neural search cache for the specified index.
	NeuralClearCache(ctx context.Context, index string) (*types.AcknowledgedResponse, error)
}

NeuralService provides access to the neural search plugin API. It supports stats, warmup, and cache management for neural search indices. See https://opensearch.org/docs/latest/search-plugins/neural-search/.

func NewNeuralService

func NewNeuralService(client *resty.Client, logger *logrus.Entry) NeuralService

NewNeuralService creates a new NeuralService instance.

type NeuralStatsResponse

type NeuralStatsResponse map[string]any

NeuralStatsResponse represents the response from the neural plugin stats endpoint. The map contains cluster-level statistics about the neural search plugin.

type NeuralWarmupResponse

type NeuralWarmupResponse struct {
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
}

NeuralWarmupResponse represents the response from the neural plugin warmup endpoint. It contains shard-level information about the warmup.

type NodesInfoNode

type NodesInfoNode struct {
	Name                       string                   `json:"name"`
	TransportAddress           string                   `json:"transport_address"`
	Host                       string                   `json:"host"`
	IP                         string                   `json:"ip"`
	Version                    string                   `json:"version"`
	BuildHash                  string                   `json:"build_hash"`
	TotalIndexingBuffer        string                   `json:"total_indexing_buffer"`
	TotalIndexingBufferInBytes int64                    `json:"total_indexing_buffer_in_bytes"`
	Roles                      []string                 `json:"roles"`
	Attributes                 map[string]string        `json:"attributes"`
	Settings                   map[string]any           `json:"settings"`
	OS                         *NodesInfoNodeOS         `json:"os"`
	Process                    *NodesInfoNodeProcess    `json:"process"`
	JVM                        *NodesInfoNodeJVM        `json:"jvm"`
	ThreadPool                 *NodesInfoNodeThreadPool `json:"thread_pool"`
	Transport                  *NodesInfoNodeTransport  `json:"transport"`
	HTTP                       *NodesInfoNodeHTTP       `json:"http"`
	Plugins                    []*NodesInfoNodePlugin   `json:"plugins"`
	Modules                    []*NodesInfoNodeModule   `json:"modules"`
	Ingest                     *NodesInfoNodeIngest     `json:"ingest"`
}

NodesInfoNode represents the static information for a single cluster node, including its name, version, roles, OS, JVM, thread pools, transport, HTTP, plugins, modules, and ingest processor configuration.

func (*NodesInfoNode) HasRole

func (n *NodesInfoNode) HasRole(role string) bool

HasRole returns true if the node has the specified role assigned.

func (*NodesInfoNode) IsData

func (n *NodesInfoNode) IsData() bool

IsData returns true if the node has the "data" role.

func (*NodesInfoNode) IsIngest

func (n *NodesInfoNode) IsIngest() bool

IsIngest returns true if the node has the "ingest" role.

func (*NodesInfoNode) IsMaster

func (n *NodesInfoNode) IsMaster() bool

IsMaster returns true if the node has the "cluster_manager" role.

type NodesInfoNodeHTTP

type NodesInfoNodeHTTP struct {
	BoundAddress            []string `json:"bound_address"`
	PublishAddress          string   `json:"publish_address"`
	MaxContentLength        string   `json:"max_content_length"`
	MaxContentLengthInBytes int64    `json:"max_content_length_in_bytes"`
}

NodesInfoNodeHTTP represents the HTTP layer configuration for a node, including bound/publish addresses and the max content length setting.

type NodesInfoNodeIngest

type NodesInfoNodeIngest struct {
	Processors []*NodesInfoNodeIngestProcessorInfo `json:"processors"`
}

NodesInfoNodeIngest represents the ingest pipeline configuration for a node, listing the available ingest processor types.

type NodesInfoNodeIngestProcessorInfo

type NodesInfoNodeIngestProcessorInfo struct {
	Type string `json:"type"`
}

NodesInfoNodeIngestProcessorInfo identifies a processor type available in the node's ingest pipeline system.

type NodesInfoNodeJVM

type NodesInfoNodeJVM struct {
	PID               int       `json:"pid"`
	Version           string    `json:"version"`
	VMName            string    `json:"vm_name"`
	VMVersion         string    `json:"vm_version"`
	VMVendor          string    `json:"vm_vendor"`
	StartTime         time.Time `json:"start_time"`
	StartTimeInMillis int64     `json:"start_time_in_millis"`

	Mem struct {
		HeapInit           string `json:"heap_init"`
		HeapInitInBytes    int    `json:"heap_init_in_bytes"`
		HeapMax            string `json:"heap_max"`
		HeapMaxInBytes     int    `json:"heap_max_in_bytes"`
		NonHeapInit        string `json:"non_heap_init"`
		NonHeapInitInBytes int    `json:"non_heap_init_in_bytes"`
		NonHeapMax         string `json:"non_heap_max"`
		NonHeapMaxInBytes  int    `json:"non_heap_max_in_bytes"`
		DirectMax          string `json:"direct_max"`
		DirectMaxInBytes   int    `json:"direct_max_in_bytes"`
	} `json:"mem"`

	GCCollectors []string `json:"gc_collectors"`
	MemoryPools  []string `json:"memory_pools"`

	UsingCompressedOrdinaryObjectPointers any `json:"using_compressed_ordinary_object_pointers"`

	InputArguments []string `json:"input_arguments"`
}

NodesInfoNodeJVM represents JVM information for a node, including the JVM version, VM details, heap memory configuration, GC collectors, memory pools, and startup arguments.

type NodesInfoNodeModule

type NodesInfoNodeModule struct {
	Name                string   `json:"name"`
	Version             string   `json:"version"`
	OpensearchVersion   string   `json:"opensearchsearch_version"`
	JavaVersion         string   `json:"java_version"`
	Description         string   `json:"description"`
	Classname           string   `json:"classname"`
	ExtendedPlugins     []string `json:"extended_plugins"`
	HasNativeController bool     `json:"has_native_controller"`
	RequiresKeystore    bool     `json:"requires_keystore"`
}

NodesInfoNodeModule describes a built-in module loaded on a node, including its name, version, and compatibility requirements.

type NodesInfoNodeOS

type NodesInfoNodeOS struct {
	RefreshInterval         string `json:"refresh_interval"`
	RefreshIntervalInMillis int    `json:"refresh_interval_in_millis"`
	Name                    string `json:"name"`
	Arch                    string `json:"arch"`
	Version                 string `json:"version"`
	AvailableProcessors     int    `json:"available_processors"`
	AllocatedProcessors     int    `json:"allocated_processors"`
}

NodesInfoNodeOS represents the operating system information for a node, including OS name, architecture, version, and processor counts.

type NodesInfoNodePlugin

type NodesInfoNodePlugin struct {
	Name                string   `json:"name"`
	Version             string   `json:"version"`
	OpensearchVersion   string   `json:"opensearchsearch_version"`
	JavaVersion         string   `json:"java_version"`
	Description         string   `json:"description"`
	Classname           string   `json:"classname"`
	ExtendedPlugins     []string `json:"extended_plugins"`
	HasNativeController bool     `json:"has_native_controller"`
	RequiresKeystore    bool     `json:"requires_keystore"`
}

NodesInfoNodePlugin describes a plugin installed on a node, including its name, version, description, and compatibility requirements.

type NodesInfoNodeProcess

type NodesInfoNodeProcess struct {
	RefreshInterval         string `json:"refresh_interval"`
	RefreshIntervalInMillis int64  `json:"refresh_interval_in_millis"`
	ID                      int    `json:"id"`
	Mlockall                bool   `json:"mlockall"`
}

NodesInfoNodeProcess represents process-level information for a node, including the process ID, refresh interval, and mlockall status.

type NodesInfoNodeThreadPool

type NodesInfoNodeThreadPool struct {
	ForceMerge        *NodesInfoNodeThreadPoolSection `json:"force_merge"`
	FetchShardStarted *NodesInfoNodeThreadPoolSection `json:"fetch_shard_started"`
	Listener          *NodesInfoNodeThreadPoolSection `json:"listener"`
	Index             *NodesInfoNodeThreadPoolSection `json:"index"`
	Refresh           *NodesInfoNodeThreadPoolSection `json:"refresh"`
	Generic           *NodesInfoNodeThreadPoolSection `json:"generic"`
	Warmer            *NodesInfoNodeThreadPoolSection `json:"warmer"`
	Search            *NodesInfoNodeThreadPoolSection `json:"search"`
	Flush             *NodesInfoNodeThreadPoolSection `json:"flush"`
	FetchShardStore   *NodesInfoNodeThreadPoolSection `json:"fetch_shard_store"`
	Management        *NodesInfoNodeThreadPoolSection `json:"management"`
	Get               *NodesInfoNodeThreadPoolSection `json:"get"`
	Bulk              *NodesInfoNodeThreadPoolSection `json:"bulk"`
	Snapshot          *NodesInfoNodeThreadPoolSection `json:"snapshot"`

	Percolate *NodesInfoNodeThreadPoolSection `json:"percolate"`
	Bench     *NodesInfoNodeThreadPoolSection `json:"bench"`
	Suggest   *NodesInfoNodeThreadPoolSection `json:"suggest"`
	Optimize  *NodesInfoNodeThreadPoolSection `json:"optimize"`
	Merge     *NodesInfoNodeThreadPoolSection `json:"merge"`
}

NodesInfoNodeThreadPool holds the thread pool configuration for all named thread pools on a node, such as search, index, bulk, and flush.

type NodesInfoNodeThreadPoolSection

type NodesInfoNodeThreadPoolSection struct {
	Type      string `json:"type"`
	Min       int    `json:"min"`
	Max       int    `json:"max"`
	KeepAlive string `json:"keep_alive"`
	QueueSize any    `json:"queue_size"`
}

NodesInfoNodeThreadPoolSection describes the configuration of a single thread pool, including its type (fixed/scaling), min/max thread counts, keep-alive duration, and queue size.

type NodesInfoNodeTransport

type NodesInfoNodeTransport struct {
	BoundAddress   []string                                  `json:"bound_address"`
	PublishAddress string                                    `json:"publish_address"`
	Profiles       map[string]*NodesInfoNodeTransportProfile `json:"profiles"`
}

NodesInfoNodeTransport represents the transport layer configuration for a node, including bound/publish addresses and transport profiles.

type NodesInfoNodeTransportProfile

type NodesInfoNodeTransportProfile struct {
	BoundAddress   []string `json:"bound_address"`
	PublishAddress string   `json:"publish_address"`
}

NodesInfoNodeTransportProfile describes a named transport profile with its own bound and publish addresses.

type NodesInfoRequest

type NodesInfoRequest struct {
	NodeIds []string
	Metrics []string
}

type NodesInfoResponse

type NodesInfoResponse struct {
	ClusterName string                    `json:"cluster_name"`
	Nodes       map[string]*NodesInfoNode `json:"nodes"`
}

NodesInfoResponse represents the result of a nodes info request. It contains the cluster name and a map of node IDs to their info details.

type NodesReloadResponse

type NodesReloadResponse struct {
	Name string `json:"name"`
}

NodesReloadResponse represents the reload result for a single node.

type NodesReloadSecureSettingsResponse

type NodesReloadSecureSettingsResponse struct {
	ClusterName string                          `json:"cluster_name"`
	Nodes       map[string]*NodesReloadResponse `json:"nodes"`
}

NodesReloadSecureSettingsResponse represents the result of reloading secure settings across cluster nodes.

type NodesService

type NodesService interface {
	Info(ctx context.Context, req *NodesInfoRequest) (*NodesInfoResponse, error)
	Stats(ctx context.Context, req *NodesStatsRequest) (*NodesStatsResponse, error)
	HotThreads(ctx context.Context, nodeIds []string) (string, error)
	ReloadSecureSettings(ctx context.Context, body any) (*NodesReloadSecureSettingsResponse, error)
	Usage(ctx context.Context, req *NodesUsageRequest) (*NodesUsageResponse, error)
}

func NewNodesService

func NewNodesService(client *resty.Client, logger *logrus.Entry) NodesService

type NodesStatsBreaker

type NodesStatsBreaker struct {
	LimitSize            string  `json:"limit_size"`
	LimitSizeInBytes     int64   `json:"limit_size_in_bytes"`
	EstimatedSize        string  `json:"estimated_size"`
	EstimatedSizeInBytes int64   `json:"estimated_size_in_bytes"`
	Overhead             float64 `json:"overhead"`
	Tripped              int64   `json:"tripped"`
}

NodesStatsBreaker represents circuit breaker statistics including limit, estimated size, overhead multiplier, and tripped count.

type NodesStatsCompletionStats

type NodesStatsCompletionStats struct {
	Size        string `json:"size"`
	SizeInBytes int64  `json:"size_in_bytes"`
	Fields      map[string]struct {
		Size        string `json:"size"`
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"fields"`
}

NodesStatsCompletionStats holds completion suggester statistics including size and optional per-field breakdowns.

type NodesStatsDiscovery

type NodesStatsDiscovery struct {
	ClusterStateQueue *NodesStatsDiscoveryStats `json:"cluster_state_queue"`
}

NodesStatsDiscovery represents discovery-related statistics for a node, including the cluster state queue status.

type NodesStatsDiscoveryStats

type NodesStatsDiscoveryStats struct {
	Total     int64 `json:"total"`
	Pending   int64 `json:"pending"`
	Committed int64 `json:"committed"`
}

NodesStatsDiscoveryStats holds cluster state queue statistics including total, pending, and committed counts.

type NodesStatsDocsStats

type NodesStatsDocsStats struct {
	Count   int64 `json:"count"`
	Deleted int64 `json:"deleted"`
}

NodesStatsDocsStats holds document count statistics including total count and the number of deleted documents.

type NodesStatsFielddataStats

type NodesStatsFielddataStats struct {
	MemorySize        string `json:"memory_size"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	Evictions         int64  `json:"evictions"`
	Fields            map[string]struct {
		MemorySize        string `json:"memory_size"`
		MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	} `json:"fields"`
}

NodesStatsFielddataStats holds fielddata cache statistics including memory usage, evictions, and optional per-field breakdowns.

type NodesStatsFlushStats

type NodesStatsFlushStats struct {
	Total             int64  `json:"total"`
	TotalTime         string `json:"total_time"`
	TotalTimeInMillis int64  `json:"total_time_in_millis"`
}

NodesStatsFlushStats holds flush operation statistics including total count and cumulative time.

type NodesStatsGetStats

type NodesStatsGetStats struct {
	Total               int64  `json:"total"`
	Time                string `json:"get_time"`
	TimeInMillis        int64  `json:"time_in_millis"`
	Exists              int64  `json:"exists"`
	ExistsTime          string `json:"exists_time"`
	ExistsTimeInMillis  int64  `json:"exists_in_millis"`
	Missing             int64  `json:"missing"`
	MissingTime         string `json:"missing_time"`
	MissingTimeInMillis int64  `json:"missing_in_millis"`
	Current             int64  `json:"current"`
}

NodesStatsGetStats holds get operation statistics including total, exists, missing, and current operation counts with timing information.

type NodesStatsIndex

type NodesStatsIndex struct {
	Docs         *NodesStatsDocsStats         `json:"docs"`
	Shards       *NodesStatsShardCountStats   `json:"shards_stats"`
	Store        *NodesStatsStoreStats        `json:"store"`
	Indexing     *NodesStatsIndexingStats     `json:"indexing"`
	Get          *NodesStatsGetStats          `json:"get"`
	Search       *NodesStatsSearchStats       `json:"search"`
	Merges       *NodesStatsMergeStats        `json:"merges"`
	Refresh      *NodesStatsRefreshStats      `json:"refresh"`
	Flush        *NodesStatsFlushStats        `json:"flush"`
	Warmer       *NodesStatsWarmerStats       `json:"warmer"`
	QueryCache   *NodesStatsQueryCacheStats   `json:"query_cache"`
	Fielddata    *NodesStatsFielddataStats    `json:"fielddata"`
	Completion   *NodesStatsCompletionStats   `json:"completion"`
	Segments     *NodesStatsSegmentsStats     `json:"segments"`
	Translog     *NodesStatsTranslogStats     `json:"translog"`
	RequestCache *NodesStatsRequestCacheStats `json:"request_cache"`
	Recovery     NodesStatsRecoveryStats      `json:"recovery"`

	IndicesLevel map[string]*NodesStatsIndex `json:"indices"`
	ShardsLevel  map[string]*NodesStatsIndex `json:"shards"`
}

NodesStatsIndex represents index-level statistics for a node, including document counts, store size, indexing/search/merge/refresh/flush stats, query cache, fielddata, segments, translog, and recovery metrics.

type NodesStatsIndexingStats

type NodesStatsIndexingStats struct {
	IndexTotal            int64  `json:"index_total"`
	IndexTime             string `json:"index_time"`
	IndexTimeInMillis     int64  `json:"index_time_in_millis"`
	IndexCurrent          int64  `json:"index_current"`
	IndexFailed           int64  `json:"index_failed"`
	DeleteTotal           int64  `json:"delete_total"`
	DeleteTime            string `json:"delete_time"`
	DeleteTimeInMillis    int64  `json:"delete_time_in_millis"`
	DeleteCurrent         int64  `json:"delete_current"`
	NoopUpdateTotal       int64  `json:"noop_update_total"`
	IsThrottled           bool   `json:"is_throttled"`
	ThrottledTime         string `json:"throttle_time"`
	ThrottledTimeInMillis int64  `json:"throttle_time_in_millis"`

	Types map[string]*NodesStatsIndexingStats `json:"types"`
}

NodesStatsIndexingStats holds indexing and delete operation statistics including total counts, time spent, current operations, and throttle info.

type NodesStatsIngest

type NodesStatsIngest struct {
	Total     *NodesStatsIngestStats `json:"total"`
	Pipelines any                    `json:"pipelines"`
}

NodesStatsIngest represents ingest statistics for a node, including total ingest metrics and per-pipeline breakdowns.

type NodesStatsIngestStats

type NodesStatsIngestStats struct {
	Count        int64  `json:"count"`
	Time         string `json:"time"`
	TimeInMillis int64  `json:"time_in_millis"`
	Current      int64  `json:"current"`
	Failed       int64  `json:"failed"`
}

NodesStatsIngestStats holds aggregate ingest processing statistics including document count, time spent, current operations, and failures.

type NodesStatsMergeStats

type NodesStatsMergeStats struct {
	Current                    int64  `json:"current"`
	CurrentDocs                int64  `json:"current_docs"`
	CurrentSize                string `json:"current_size"`
	CurrentSizeInBytes         int64  `json:"current_size_in_bytes"`
	Total                      int64  `json:"total"`
	TotalTime                  string `json:"total_time"`
	TotalTimeInMillis          int64  `json:"total_time_in_millis"`
	TotalDocs                  int64  `json:"total_docs"`
	TotalSize                  string `json:"total_size"`
	TotalSizeInBytes           int64  `json:"total_size_in_bytes"`
	TotalStoppedTime           string `json:"total_stopped_time"`
	TotalStoppedTimeInMillis   int64  `json:"total_stopped_time_in_millis"`
	TotalThrottledTime         string `json:"total_throttled_time"`
	TotalThrottledTimeInMillis int64  `json:"total_throttled_time_in_millis"`
	TotalThrottleBytes         string `json:"total_auto_throttle"`
	TotalThrottleBytesInBytes  int64  `json:"total_auto_throttle_in_bytes"`
}

NodesStatsMergeStats holds segment merge statistics including current and total merge counts, sizes, durations, and throttle metrics.

type NodesStatsNode

type NodesStatsNode struct {
	Timestamp        int64                                `json:"timestamp"`
	Name             string                               `json:"name"`
	TransportAddress string                               `json:"transport_address"`
	Host             string                               `json:"host"`
	IP               string                               `json:"ip"`
	Roles            []string                             `json:"roles"`
	Attributes       map[string]any                       `json:"attributes"`
	Indices          *NodesStatsIndex                     `json:"indices"`
	OS               *NodesStatsNodeOS                    `json:"os"`
	Process          *NodesStatsNodeProcess               `json:"process"`
	JVM              *NodesStatsNodeJVM                   `json:"jvm"`
	ThreadPool       map[string]*NodesStatsNodeThreadPool `json:"thread_pool"`
	FS               *NodesStatsNodeFS                    `json:"fs"`
	Transport        *NodesStatsNodeTransport             `json:"transport"`
	HTTP             *NodesStatsNodeHTTP                  `json:"http"`
	Breaker          map[string]*NodesStatsBreaker        `json:"breakers"`
	ScriptStats      *NodesStatsScriptStats               `json:"script"`
	Discovery        *NodesStatsDiscovery                 `json:"discovery"`
	Ingest           *NodesStatsIngest                    `json:"ingest"`
}

NodesStatsNode represents the runtime statistics for a single cluster node, covering indices, OS, process, JVM, thread pools, filesystem, transport, HTTP, circuit breakers, scripts, discovery, and ingest.

type NodesStatsNodeFS

type NodesStatsNodeFS struct {
	Timestamp int64                    `json:"timestamp"`
	Total     *NodesStatsNodeFSEntry   `json:"total"`
	Data      []*NodesStatsNodeFSEntry `json:"data"`
	IOStats   *NodesStatsNodeFSIOStats `json:"io_stats"`
}

NodesStatsNodeFS represents filesystem statistics for a node, including a total summary and per-data-path breakdowns plus I/O stats.

type NodesStatsNodeFSEntry

type NodesStatsNodeFSEntry struct {
	Path             string `json:"path"`
	Mount            string `json:"mount"`
	Type             string `json:"type"`
	Total            string `json:"total"`
	TotalInBytes     int64  `json:"total_in_bytes"`
	Free             string `json:"free"`
	FreeInBytes      int64  `json:"free_in_bytes"`
	Available        string `json:"available"`
	AvailableInBytes int64  `json:"available_in_bytes"`
	Spins            string `json:"spins"`
}

NodesStatsNodeFSEntry represents a single filesystem mount point with its path, type, total/free/available space in both human-readable and byte form.

type NodesStatsNodeFSIOStats

type NodesStatsNodeFSIOStats struct {
	Devices []*NodesStatsNodeFSIOStatsEntry `json:"devices"`
	Total   *NodesStatsNodeFSIOStatsEntry   `json:"total"`
}

NodesStatsNodeFSIOStats holds I/O statistics for filesystem devices, including per-device and aggregate totals.

type NodesStatsNodeFSIOStatsEntry

type NodesStatsNodeFSIOStatsEntry struct {
	DeviceName      string `json:"device_name"`
	Operations      int64  `json:"operations"`
	ReadOperations  int64  `json:"read_operations"`
	WriteOperations int64  `json:"write_operations"`
	ReadKilobytes   int64  `json:"read_kilobytes"`
	WriteKilobytes  int64  `json:"write_kilobytes"`
}

NodesStatsNodeFSIOStatsEntry represents I/O statistics for a single block device, including read/write operations and kilobyte counts.

type NodesStatsNodeHTTP

type NodesStatsNodeHTTP struct {
	CurrentOpen int `json:"current_open"`
	TotalOpened int `json:"total_opened"`
}

NodesStatsNodeHTTP represents HTTP statistics for a node, including currently open and total opened connections.

type NodesStatsNodeJVM

type NodesStatsNodeJVM struct {
	Timestamp      int64                                   `json:"timestamp"`
	Uptime         string                                  `json:"uptime"`
	UptimeInMillis int64                                   `json:"uptime_in_millis"`
	Mem            *NodesStatsNodeJVMMem                   `json:"mem"`
	Threads        *NodesStatsNodeJVMThreads               `json:"threads"`
	GC             *NodesStatsNodeJVMGC                    `json:"gc"`
	BufferPools    map[string]*NodesStatsNodeJVMBufferPool `json:"buffer_pools"`
	Classes        *NodesStatsNodeJVMClasses               `json:"classes"`
}

NodesStatsNodeJVM represents JVM runtime statistics for a node, including uptime, heap/non-heap memory, threads, GC, buffer pools, and class loading metrics.

type NodesStatsNodeJVMBufferPool

type NodesStatsNodeJVMBufferPool struct {
	Count                int64  `json:"count"`
	TotalCapacity        string `json:"total_capacity"`
	TotalCapacityInBytes int64  `json:"total_capacity_in_bytes"`
}

NodesStatsNodeJVMBufferPool represents statistics for a single JVM buffer pool, including buffer count and total capacity.

type NodesStatsNodeJVMClasses

type NodesStatsNodeJVMClasses struct {
	CurrentLoadedCount int64 `json:"current_loaded_count"`
	TotalLoadedCount   int64 `json:"total_loaded_count"`
	TotalUnloadedCount int64 `json:"total_unloaded_count"`
}

NodesStatsNodeJVMClasses represents class loading statistics for the JVM, including current, total loaded, and total unloaded class counts.

type NodesStatsNodeJVMGC

type NodesStatsNodeJVMGC struct {
	Collectors map[string]*NodesStatsNodeJVMGCCollector `json:"collectors"`
}

NodesStatsNodeJVMGC holds garbage collection statistics, organized by collector name (e.g. "young", "old").

type NodesStatsNodeJVMGCCollector

type NodesStatsNodeJVMGCCollector struct {
	CollectionCount        int64  `json:"collection_count"`
	CollectionTime         string `json:"collection_time"`
	CollectionTimeInMillis int64  `json:"collection_time_in_millis"`
}

NodesStatsNodeJVMGCCollector represents GC statistics for a single collector, including collection count and time spent collecting.

type NodesStatsNodeJVMMem

type NodesStatsNodeJVMMem struct {
	HeapUsed                string `json:"heap_used"`
	HeapUsedInBytes         int64  `json:"heap_used_in_bytes"`
	HeapUsedPercent         int    `json:"heap_used_percent"`
	HeapCommitted           string `json:"heap_committed"`
	HeapCommittedInBytes    int64  `json:"heap_committed_in_bytes"`
	HeapMax                 string `json:"heap_max"`
	HeapMaxInBytes          int64  `json:"heap_max_in_bytes"`
	NonHeapUsed             string `json:"non_heap_used"`
	NonHeapUsedInBytes      int64  `json:"non_heap_used_in_bytes"`
	NonHeapCommitted        string `json:"non_heap_committed"`
	NonHeapCommittedInBytes int64  `json:"non_heap_committed_in_bytes"`
	Pools                   map[string]struct {
		Used            string `json:"used"`
		UsedInBytes     int64  `json:"used_in_bytes"`
		Max             string `json:"max"`
		MaxInBytes      int64  `json:"max_in_bytes"`
		PeakUsed        string `json:"peak_used"`
		PeakUsedInBytes int64  `json:"peak_used_in_bytes"`
		PeakMax         string `json:"peak_max"`
		PeakMaxInBytes  int64  `json:"peak_max_in_bytes"`
	} `json:"pools"`
}

NodesStatsNodeJVMMem represents JVM memory usage statistics including heap and non-heap memory with committed and max values, and per-pool breakdowns.

type NodesStatsNodeJVMThreads

type NodesStatsNodeJVMThreads struct {
	Count     int64 `json:"count"`
	PeakCount int64 `json:"peak_count"`
}

NodesStatsNodeJVMThreads represents JVM thread count statistics including current and peak thread counts.

type NodesStatsNodeOS

type NodesStatsNodeOS struct {
	Timestamp int64                 `json:"timestamp"`
	CPU       *NodesStatsNodeOSCPU  `json:"cpu"`
	Mem       *NodesStatsNodeOSMem  `json:"mem"`
	Swap      *NodesStatsNodeOSSwap `json:"swap"`
}

NodesStatsNodeOS represents OS-level runtime statistics for a node, including CPU usage, memory, and swap information.

type NodesStatsNodeOSCPU

type NodesStatsNodeOSCPU struct {
	Percent     int                `json:"percent"`
	LoadAverage map[string]float64 `json:"load_average"`
}

NodesStatsNodeOSCPU represents CPU usage statistics for a node, including the usage percentage and load averages.

type NodesStatsNodeOSMem

type NodesStatsNodeOSMem struct {
	Total        string `json:"total"`
	TotalInBytes int64  `json:"total_in_bytes"`
	Free         string `json:"free"`
	FreeInBytes  int64  `json:"free_in_bytes"`
	Used         string `json:"used"`
	UsedInBytes  int64  `json:"used_in_bytes"`
	FreePercent  int    `json:"free_percent"`
	UsedPercent  int    `json:"used_percent"`
}

NodesStatsNodeOSMem represents memory usage statistics for a node in both human-readable and byte representations.

type NodesStatsNodeOSSwap

type NodesStatsNodeOSSwap struct {
	Total        string `json:"total"`
	TotalInBytes int64  `json:"total_in_bytes"`
	Free         string `json:"free"`
	FreeInBytes  int64  `json:"free_in_bytes"`
	Used         string `json:"used"`
	UsedInBytes  int64  `json:"used_in_bytes"`
}

NodesStatsNodeOSSwap represents swap space usage statistics for a node.

type NodesStatsNodeProcess

type NodesStatsNodeProcess struct {
	Timestamp           int64 `json:"timestamp"`
	OpenFileDescriptors int64 `json:"open_file_descriptors"`
	MaxFileDescriptors  int64 `json:"max_file_descriptors"`
	CPU                 struct {
		Percent       int    `json:"percent"`
		Total         string `json:"total"`
		TotalInMillis int64  `json:"total_in_millis"`
	} `json:"cpu"`
	Mem struct {
		TotalVirtual        string `json:"total_virtual"`
		TotalVirtualInBytes int64  `json:"total_virtual_in_bytes"`
	} `json:"mem"`
}

NodesStatsNodeProcess represents process-level runtime statistics for a node, including open file descriptors, CPU usage, and virtual memory.

type NodesStatsNodeThreadPool

type NodesStatsNodeThreadPool struct {
	Threads   int   `json:"threads"`
	Queue     int   `json:"queue"`
	Active    int   `json:"active"`
	Rejected  int64 `json:"rejected"`
	Largest   int   `json:"largest"`
	Completed int64 `json:"completed"`
}

NodesStatsNodeThreadPool represents runtime statistics for a single thread pool, including thread count, queue size, active threads, rejected tasks, and completed count.

type NodesStatsNodeTransport

type NodesStatsNodeTransport struct {
	ServerOpen    int    `json:"server_open"`
	RxCount       int64  `json:"rx_count"`
	RxSize        string `json:"rx_size"`
	RxSizeInBytes int64  `json:"rx_size_in_bytes"`
	TxCount       int64  `json:"tx_count"`
	TxSize        string `json:"tx_size"`
	TxSizeInBytes int64  `json:"tx_size_in_bytes"`
}

NodesStatsNodeTransport represents transport layer statistics for a node, including open connection count and bytes transmitted/received.

type NodesStatsQueryCacheStats

type NodesStatsQueryCacheStats struct {
	MemorySize        string `json:"memory_size"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	TotalCount        int64  `json:"total_count"`
	HitCount          int64  `json:"hit_count"`
	MissCount         int64  `json:"miss_count"`
	CacheSize         int64  `json:"cache_size"`
	CacheCount        int64  `json:"cache_count"`
	Evictions         int64  `json:"evictions"`
}

NodesStatsQueryCacheStats holds query cache statistics including memory usage, hit/miss counts, cache size, and evictions.

type NodesStatsRecoveryStats

type NodesStatsRecoveryStats struct {
	CurrentAsSource int `json:"current_as_source"`
	CurrentAsTarget int `json:"current_as_target"`
}

NodesStatsRecoveryStats holds recovery statistics tracking how many recoveries this node is participating in as source and target.

type NodesStatsRefreshStats

type NodesStatsRefreshStats struct {
	Total             int64  `json:"total"`
	TotalTime         string `json:"total_time"`
	TotalTimeInMillis int64  `json:"total_time_in_millis"`
}

NodesStatsRefreshStats holds refresh operation statistics including total count and cumulative time.

type NodesStatsRequest

type NodesStatsRequest struct {
	NodeIds []string
	Metrics []string
}

type NodesStatsRequestCacheStats

type NodesStatsRequestCacheStats struct {
	MemorySize        string `json:"memory_size"`
	MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
	Evictions         int64  `json:"evictions"`
	HitCount          int64  `json:"hit_count"`
	MissCount         int64  `json:"miss_count"`
}

NodesStatsRequestCacheStats holds request cache statistics including memory usage, hit/miss counts, and evictions.

type NodesStatsResponse

type NodesStatsResponse struct {
	ClusterName string                     `json:"cluster_name"`
	Nodes       map[string]*NodesStatsNode `json:"nodes"`
}

NodesStatsResponse represents the result of a nodes stats request. It contains the cluster name and a map of node IDs to their runtime statistics.

type NodesStatsScriptStats

type NodesStatsScriptStats struct {
	Compilations   int64 `json:"compilations"`
	CacheEvictions int64 `json:"cache_evictions"`
}

NodesStatsScriptStats holds script compilation and cache eviction statistics for a node.

type NodesStatsSearchStats

type NodesStatsSearchStats struct {
	OpenContexts       int64  `json:"open_contexts"`
	QueryTotal         int64  `json:"query_total"`
	QueryTime          string `json:"query_time"`
	QueryTimeInMillis  int64  `json:"query_time_in_millis"`
	QueryCurrent       int64  `json:"query_current"`
	FetchTotal         int64  `json:"fetch_total"`
	FetchTime          string `json:"fetch_time"`
	FetchTimeInMillis  int64  `json:"fetch_time_in_millis"`
	FetchCurrent       int64  `json:"fetch_current"`
	ScrollTotal        int64  `json:"scroll_total"`
	ScrollTime         string `json:"scroll_time"`
	ScrollTimeInMillis int64  `json:"scroll_time_in_millis"`
	ScrollCurrent      int64  `json:"scroll_current"`

	Groups map[string]*NodesStatsSearchStats `json:"groups"`
}

NodesStatsSearchStats holds search operation statistics including query, fetch, and scroll metrics with timing and current counts.

type NodesStatsSegmentsStats

type NodesStatsSegmentsStats struct {
	Count                       int64  `json:"count"`
	Memory                      string `json:"memory"`
	MemoryInBytes               int64  `json:"memory_in_bytes"`
	TermsMemory                 string `json:"terms_memory"`
	TermsMemoryInBytes          int64  `json:"terms_memory_in_bytes"`
	StoredFieldsMemory          string `json:"stored_fields_memory"`
	StoredFieldsMemoryInBytes   int64  `json:"stored_fields_memory_in_bytes"`
	TermVectorsMemory           string `json:"term_vectors_memory"`
	TermVectorsMemoryInBytes    int64  `json:"term_vectors_memory_in_bytes"`
	NormsMemory                 string `json:"norms_memory"`
	NormsMemoryInBytes          int64  `json:"norms_memory_in_bytes"`
	DocValuesMemory             string `json:"doc_values_memory"`
	DocValuesMemoryInBytes      int64  `json:"doc_values_memory_in_bytes"`
	IndexWriterMemory           string `json:"index_writer_memory"`
	IndexWriterMemoryInBytes    int64  `json:"index_writer_memory_in_bytes"`
	IndexWriterMaxMemory        string `json:"index_writer_max_memory"`
	IndexWriterMaxMemoryInBytes int64  `json:"index_writer_max_memory_in_bytes"`
	VersionMapMemory            string `json:"version_map_memory"`
	VersionMapMemoryInBytes     int64  `json:"version_map_memory_in_bytes"`
	FixedBitSetMemory           string `json:"fixed_bit_set"`
	FixedBitSetMemoryInBytes    int64  `json:"fixed_bit_set_memory_in_bytes"`
}

NodesStatsSegmentsStats holds detailed memory usage statistics for Lucene segments, broken down by component (terms, stored fields, term vectors, norms, doc values, index writer, version map, etc.).

type NodesStatsShardCountStats

type NodesStatsShardCountStats struct {
	TotalCount int64 `json:"total_count"`
}

NodesStatsShardCountStats holds the total shard count assigned to a node.

type NodesStatsStoreStats

type NodesStatsStoreStats struct {
	Size        string `json:"size"`
	SizeInBytes int64  `json:"size_in_bytes"`
}

NodesStatsStoreStats holds index store size information in both human-readable and byte representations.

type NodesStatsTranslogStats

type NodesStatsTranslogStats struct {
	Operations  int64  `json:"operations"`
	Size        string `json:"size"`
	SizeInBytes int64  `json:"size_in_bytes"`
}

NodesStatsTranslogStats holds transaction log statistics including operation count and size.

type NodesStatsWarmerStats

type NodesStatsWarmerStats struct {
	Current           int64  `json:"current"`
	Total             int64  `json:"total"`
	TotalTime         string `json:"total_time"`
	TotalTimeInMillis int64  `json:"total_time_in_millis"`
}

NodesStatsWarmerStats holds index warmer operation statistics including current and total counts and cumulative time.

type NodesUsageNode

type NodesUsageNode struct {
	Timestamp   int64            `json:"timestamp"`
	Since       int64            `json:"since"`
	RestActions map[string]int64 `json:"rest_actions,omitempty"`
}

NodesUsageNode represents usage statistics for a single node.

type NodesUsageRequest

type NodesUsageRequest struct {
	NodeIds []string
	Metrics []string
}

type NodesUsageResponse

type NodesUsageResponse struct {
	ClusterName string                     `json:"cluster_name"`
	Nodes       map[string]*NodesUsageNode `json:"nodes"`
}

NodesUsageResponse represents node usage statistics.

type PainlessExecuteResponse

type PainlessExecuteResponse struct {
	Result json.RawMessage `json:"result"`
}

PainlessExecuteResponse represents the result of executing a Painless script via the scripts_painless_execute API. The Result field contains the raw JSON result produced by the script.

type PutAliasRequest

type PutAliasRequest struct {
	Index string `validate:"required"`
	Alias string `validate:"required"`
	Body  any
}

func (*PutAliasRequest) Validate

func (r *PutAliasRequest) Validate() error

type PutComponentTemplateRequest

type PutComponentTemplateRequest struct {
	Name string `validate:"required"`
	Body any    `validate:"required"`
}

func (*PutComponentTemplateRequest) Validate

func (r *PutComponentTemplateRequest) Validate() error

type PutIndexTemplateRequest

type PutIndexTemplateRequest struct {
	Name string `validate:"required"`
	Body any    `validate:"required"`
}

func (*PutIndexTemplateRequest) Validate

func (r *PutIndexTemplateRequest) Validate() error

type PutMappingRequest

type PutMappingRequest struct {
	Indices []string `validate:"required,min=1"`
	Body    any      `validate:"required"`
}

func (*PutMappingRequest) Validate

func (r *PutMappingRequest) Validate() error

type PutTemplateRequest

type PutTemplateRequest struct {
	Name string `validate:"required"`
	Body any    `validate:"required"`
}

func (*PutTemplateRequest) Validate

func (r *PutTemplateRequest) Validate() error

type RankEvalParams

type RankEvalParams struct {
	SearchType        SearchType
	Routing           string
	Preference        string
	RequestCache      bool
	IgnoreUnavailable bool
	AllowNoIndices    bool
	ExpandWildcards   string
}

func (*RankEvalParams) ToMap

func (p *RankEvalParams) ToMap() map[string]string

type RankEvalRequest

type RankEvalRequest struct {
	Indices []string
	Body    any `validate:"required"`
	Params  *RankEvalParams
}

func (*RankEvalRequest) Validate

func (r *RankEvalRequest) Validate() error

type Refresh

type Refresh string

Refresh controls when changes become visible to search. Valid values: RefreshTrue, RefreshFalse, RefreshWaitFor

const (
	RefreshTrue    Refresh = "true"
	RefreshFalse   Refresh = "false"
	RefreshWaitFor Refresh = "wait_for"
)

type RefreshResult

type RefreshResult struct {
	types.BroadcastResponse
}

RefreshResult wraps a BroadcastResponse to represent the result of a refresh operation.

type RenderSearchTemplateRequest

type RenderSearchTemplateRequest struct {
	Id   string
	Body any
}

type RerouteDecision

type RerouteDecision any

RerouteDecision represents an individual allocation decision made by the cluster allocator during a reroute operation. The concrete type depends on the allocator output and is unstructured.

type RerouteExplanation

type RerouteExplanation struct {
	Command    string            `json:"command"`
	Parameters map[string]any    `json:"parameters"`
	Decisions  []RerouteDecision `json:"decisions"`
}

RerouteExplanation describes a single reroute command and the allocation decisions made for it, including the command name and its parameters.

type ResolvedAlias

type ResolvedAlias struct {
	Name        string   `json:"name"`
	Indices     []string `json:"indices,omitempty"`
	DataStreams []string `json:"data_streams,omitempty"`
}

ResolvedAlias is a resolved alias entry.

type ResolvedDataStream

type ResolvedDataStream struct {
	Name           string   `json:"name"`
	BackingIndices []string `json:"backing_indices,omitempty"`
}

ResolvedDataStream is a resolved data stream entry.

type ResolvedIndex

type ResolvedIndex struct {
	Name        string   `json:"name"`
	Indices     []string `json:"indices,omitempty"`
	Aliases     []string `json:"aliases,omitempty"`
	DataStreams []string `json:"data_streams,omitempty"`
	Attributes  []string `json:"attributes,omitempty"`
}

ResolvedIndex is a resolved index entry.

type RestoreInfo

type RestoreInfo struct {
	Snapshot string           `json:"snapshot"`
	Indices  []string         `json:"indices"`
	Shards   types.ShardsInfo `json:"shards"`
}

RestoreInfo describes a completed restore operation, including the snapshot name, restored indices, and shard-level restoration results.

type RestoreSource

type RestoreSource struct {
	Repository string `json:"repository"`
	Snapshot   string `json:"snapshot"`
	Version    string `json:"version"`
	Index      string `json:"index"`
}

RestoreSource identifies the snapshot repository, snapshot name, and source index from which a shard was restored.

type RethrottleRequest

type RethrottleRequest struct {
	TaskId            string `validate:"required"`
	RequestsPerSecond float64
}

func (*RethrottleRequest) Validate

func (r *RethrottleRequest) Validate() error

type RollupExplainResponse

type RollupExplainResponse struct {
	Metadata       map[string]any `json:"metadata,omitempty"`
	RollupMetadata map[string]any `json:"rollup_metadata,omitempty"`
}

RollupExplainResponse represents explain information for a rollup job.

type RollupGetResponse

type RollupGetResponse struct {
	Id             string        `json:"_id,omitempty"`
	Version        int64         `json:"_version,omitempty"`
	SequenceNumber int64         `json:"_seq_no,omitempty"`
	PrimaryTerm    int64         `json:"_primary_term,omitempty"`
	Rollup         RollupJobBase `json:"rollup"`
}

RollupGetResponse represents a single rollup job as returned by the Rollup GET API.

type RollupJobBase

type RollupJobBase struct {
	RollupId    string           `json:"rollup_id,omitempty"`
	Enabled     *bool            `json:"enabled,omitempty"`
	Schedule    map[string]any   `json:"schedule,omitempty"`
	Description *string          `json:"description,omitempty"`
	SourceIndex string           `json:"source_index,omitempty"`
	TargetIndex string           `json:"target_index,omitempty"`
	Dimensions  []map[string]any `json:"dimensions,omitempty"`
	Metrics     []map[string]any `json:"metrics,omitempty"`
}

RollupJobBase represents the definition of a rollup job.

type RollupService

type RollupService interface {
	GetRollup(ctx context.Context, rollupId string) (*RollupGetResponse, error)
	PutRollup(ctx context.Context, rollupId string, body any) (*RollupGetResponse, error)
	DeleteRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)
	StartRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)
	StopRollup(ctx context.Context, rollupId string) (*types.AcknowledgedResponse, error)
	ExplainRollup(ctx context.Context, rollupId string) (map[string]*RollupExplainResponse, error)
}

RollupService interacts with the OpenSearch ISM Rollup plugin.

func NewRollupService

func NewRollupService(client *resty.Client, logger *logrus.Entry) RollupService

NewRollupService returns a RollupService bound to the given resty client.

type RuntimeFieldStats

type RuntimeFieldStats struct {
	Name            string   `json:"name"`
	Count           int      `json:"count"`
	IndexCount      int      `json:"index_count"`
	ScriptlessCount int      `json:"scriptless_count"`
	ShadowedCount   int      `json:"shadowed_count"`
	Lang            []string `json:"lang"`
	LinesMax        int64    `json:"lines_max"`
	LinesTotal      int64    `json:"lines_total"`
	CharsMax        int64    `json:"chars_max"`
	CharsTotal      int64    `json:"chars_total"`
	SourceMax       int64    `json:"source_max"`
	SourceTotal     int64    `json:"source_total"`
	DocMax          int64    `json:"doc_max"`
	DocTotal        int64    `json:"doc_total"`
}

RuntimeFieldStats provides detailed usage statistics for runtime fields, including character, line, and source size metrics as well as the scripting languages used.

type SQLCloseResponse

type SQLCloseResponse struct {
	Success bool `json:"success"`
}

SQLCloseResponse represents the response from closing an SQL cursor.

type SQLExplainResponse

type SQLExplainResponse struct {
	Root map[string]any `json:"root"`
}

SQLExplainResponse represents the response from the SQL/PPL explain endpoint.

type SQLResponse

type SQLResponse struct {
	Schema     []map[string]any `json:"schema"`
	Datapoints [][]any          `json:"datarows"`
	Total      int64            `json:"total"`
	Size       int64            `json:"size"`
	Status     int64            `json:"status"`
	Cursor     *string          `json:"cursor,omitempty"`
}

SQLResponse represents the standard response from the SQL/PPL plugin.

type ScriptContext

type ScriptContext struct {
	Name    string           `json:"name"`
	Methods []map[string]any `json:"methods,omitempty"`
}

ScriptContext describes a single script context (e.g. "ingest", "score").

type ScriptContextResponse

type ScriptContextResponse struct {
	Contexts []ScriptContext `json:"contexts"`
}

ScriptContextResponse represents the result of the get script context API. Contexts lists the available script contexts and their allowed methods/parameters.

type ScriptDeleteResponse

type ScriptDeleteResponse struct {
	types.AcknowledgedResponse
}

ScriptDeleteResponse represents the acknowledgment response from deleting a stored script. It embeds types.AcknowledgedResponse which contains the Acknowledged boolean.

type ScriptGetResponse

type ScriptGetResponse struct {
	Id     string          `json:"_id"`
	Found  bool            `json:"found"`
	Script json.RawMessage `json:"script"`
}

ScriptGetResponse represents the result of retrieving a stored script. The Id is the script identifier, Found indicates whether it exists, and Script contains the raw JSON script definition (lang + source).

type ScriptLanguageContext

type ScriptLanguageContext struct {
	Language string   `json:"language"`
	Contexts []string `json:"contexts"`
}

ScriptLanguageContext describes a script language and the contexts in which it is allowed.

type ScriptLanguagesResponse

type ScriptLanguagesResponse struct {
	LanguageContexts []ScriptLanguageContext `json:"language_contexts"`
	TypesAllowed     []string                `json:"types_allowed,omitempty"`
}

ScriptLanguagesResponse represents the result of the get script language API. LanguageContexts lists the available script languages and their allowed contexts.

type ScriptPutRequest

type ScriptPutRequest struct {
	Id   string `validate:"required"`
	Body any    `validate:"required"`
}

func (*ScriptPutRequest) Validate

func (r *ScriptPutRequest) Validate() error

type ScriptPutResponse

type ScriptPutResponse struct {
	types.AcknowledgedResponse
}

ScriptPutResponse represents the acknowledgment response from creating or updating a stored script. It embeds types.AcknowledgedResponse which contains the Acknowledged boolean.

type ScriptService

type ScriptService interface {
	Get(ctx context.Context, id string) (*ScriptGetResponse, error)
	Put(ctx context.Context, req *ScriptPutRequest) (*ScriptPutResponse, error)
	Delete(ctx context.Context, id string) (*ScriptDeleteResponse, error)
	PainlessExecute(ctx context.Context, body any) (*PainlessExecuteResponse, error)
	GetContext(ctx context.Context) (*ScriptContextResponse, error)
	GetLanguages(ctx context.Context) (*ScriptLanguagesResponse, error)
}

func NewScriptService

func NewScriptService(client *resty.Client, logger *logrus.Entry) ScriptService

type ScrollRequest

type ScrollRequest struct {
	ScrollId  string `validate:"required"`
	KeepAlive string
}

func (*ScrollRequest) Validate

func (r *ScrollRequest) Validate() error

type SearchParams

type SearchParams struct {
	SearchType                 SearchType
	Routing                    string
	Preference                 string
	RequestCache               bool
	Scroll                     string
	AllowPartialSearchResults  bool
	BatchedReduceSize          *int
	MaxConcurrentShardRequests *int
	PreFilterShardSize         *int
	RestTotalHitsAsInt         bool
	TypedKeys                  bool
	IgnoreUnavailable          bool
	AllowNoIndices             bool
	ExpandWildcards            string
	CcsMinimizeRoundtrips      bool
	Explain                    bool
	Size                       *int
	From                       *int
	Timeout                    string
	TrackTotalHits             string
}

func (*SearchParams) ToMap

func (p *SearchParams) ToMap() map[string]string

type SearchRequest

type SearchRequest struct {
	Indices []string
	Body    any
	Params  *SearchParams
}

func NewSearchRequest

func NewSearchRequest(r *querydsl.SearchRequest) (*SearchRequest, error)

NewSearchRequest creates a SearchRequest from a *querydsl.SearchRequest. It calls Body() on the querydsl request to serialize the query DSL and uses the result as the request body. This allows building search requests using the fluent querydsl builder API:

req, err := api.NewSearchRequest(
    querydsl.NewSearchRequest().
        Index("my-index").
        Query(querydsl.MatchAll{}).
        Size(10),
)
if err != nil {
    return err
}
result, err := client.Search().Search(ctx, req)

type SearchService

func NewSearchService

func NewSearchService(client *resty.Client, logger *logrus.Entry) SearchService

type SearchTemplateParams

type SearchTemplateParams struct {
	SearchType            SearchType
	Routing               string
	Preference            string
	RequestCache          bool
	Scroll                string
	IgnoreUnavailable     bool
	AllowNoIndices        bool
	ExpandWildcards       string
	Explain               bool
	Profile               bool
	TypedKeys             bool
	RestTotalHitsAsInt    bool
	CcsMinimizeRoundtrips bool
}

func (*SearchTemplateParams) ToMap

func (p *SearchTemplateParams) ToMap() map[string]string

type SearchTemplateRequest

type SearchTemplateRequest struct {
	Indices []string
	Body    any `validate:"required"`
	Params  *SearchTemplateParams
}

func (*SearchTemplateRequest) Validate

func (r *SearchTemplateRequest) Validate() error

type SearchType

type SearchType string

SearchType controls how distributed term frequencies affect scoring.

const (
	SearchTypeQueryThenFetch    SearchType = "query_then_fetch"
	SearchTypeDfsQueryThenFetch SearchType = "dfs_query_then_fetch"
)

type SecurityAccountResponse

type SecurityAccountResponse struct {
	UserName         string            `json:"user_name"`
	IsReserved       bool              `json:"is_reserved"`
	IsHidden         bool              `json:"is_hidden"`
	IsSystemUser     bool              `json:"is_system_user,omitempty"`
	BackendRoles     []string          `json:"backend_roles,omitempty"`
	Roles            []string          `json:"opendistro_security_roles,omitempty"`
	CustomAttributes map[string]string `json:"custom_attribute_names,omitempty"`
}

SecurityAccountResponse represents the current user's account information.

type SecurityActionGroup

type SecurityActionGroup struct {
	SecurityPutActionGroup `json:",inline"`
	Reserved               *bool `json:"reserved,omitempty"`
	Hidden                 *bool `json:"hidden,omitempty"`
	Static                 *bool `json:"static,omitempty"`
}

SecurityActionGroup represents a security action group returned from the OpenSearch Security plugin. Action groups are named collections of allowed actions used in role definitions.

type SecurityAllowlist

type SecurityAllowlist struct {
	Enabled  *bool               `json:"enabled,omitempty"`
	Requests map[string][]string `json:"requests,omitempty"`
}

SecurityAllowlist represents the Security plugin REST API allowlist configuration.

type SecurityAudit

type SecurityAudit struct {
	Enabled    *bool                   `json:"enabled,omitempty"`
	Compliance SecurityAuditCompliance `json:"compliance"`
	Audit      SecurityAuditSpec       `json:"audit"`
}

SecurityAudit represents the audit logging configuration for the OpenSearch Security plugin, including the overall enabled flag, compliance settings, and audit event specifications.

type SecurityAuditCompliance

type SecurityAuditCompliance struct {
	Enabled             *bool               `json:"enabled,omitempty"`
	WriteLogDiffs       *bool               `json:"write_log_diffs,omitempty"`
	ReadWatchedFields   map[string][]string `json:"read_watched_fields,omitempty"`
	ReadIgnoreUsers     []string            `json:"read_ignore_users,omitempty"`
	WriteWatchedIndices []string            `json:"write_watched_indices,omitempty"`
	WriteIgnoreUsers    []string            `json:"write_ignore_users,omitempty"`
	ReadMetadataOnly    *bool               `json:"read_metadata_only,omitempty"`
	WriteMetadataOnly   *bool               `json:"write_metadata_only,omitempty"`
	ExternalConfig      *bool               `json:"external_config,omitempty"`
	InternalConfig      *bool               `json:"internal_config,omitempty"`
}

SecurityAuditCompliance defines the compliance auditing settings for the Security plugin, including read/write access logging, metadata options, and user ignore lists.

type SecurityAuditSpec

type SecurityAuditSpec struct {
	IgnoreUsers                 []string `json:"ignore_users,omitempty"`
	IgnoreRequests              []string `json:"ignore_requests,omitempty"`
	DisabledRestCategories      []string `json:"disabled_rest_categories,omitempty"`
	DisabledTransportCategories []string `json:"disabled_transport_categories,omitempty"`
	LogRequestBody              *bool    `json:"log_request_body,omitempty"`
	ResolveIndices              *bool    `json:"resolve_indices,omitempty"`
	ResolveBulkRequests         *bool    `json:"resolve_bulk_requests,omitempty"`
	ExcludeSensitiveHeaders     *bool    `json:"exclude_sensitive_headers,omitempty"`
	EnableTransport             *bool    `json:"enable_transport,omitempty"`
	EnableRest                  *bool    `json:"enable_rest,omitempty"`
}

SecurityAuditSpec defines the audit event logging settings, including which users and requests to ignore, which categories to disable, and various logging behavior options.

type SecurityAuthInfoResponse

type SecurityAuthInfoResponse struct {
	User                   string          `json:"user"`
	UserName               string          `json:"user_name"`
	BackendRoles           []string        `json:"backend_roles"`
	CustomAttributeNames   []string        `json:"custom_attribute_names,omitempty"`
	Roles                  []string        `json:"roles"`
	Tenants                map[string]bool `json:"tenants"`
	Principal              *string         `json:"principal"`
	PeerCertificates       string          `json:"peer_certificates"`
	SSOLogoutURL           *string         `json:"sso_logout_url"`
	RemoteAddress          string          `json:"remote_address"`
	SizeOfUser             string          `json:"size_of_user,omitempty"`
	SizeOfBackendRoles     string          `json:"size_of_backendroles,omitempty"`
	SizeOfCustomAttributes string          `json:"size_of_custom_attributes,omitempty"`
	UserRequestedTenant    *string         `json:"user_requested_tenant,omitempty"`
}

SecurityAuthInfoResponse represents the authentication information returned from the Security plugin's /_plugins/_security/authinfo endpoint. It includes the authenticated user's name, roles, tenants, peer certificates, and other metadata.

type SecurityAuthTokenResponse

type SecurityAuthTokenResponse struct {
	Authorization string `json:"authorization"`
}

SecurityAuthTokenResponse represents an authentication token issued by the Security plugin.

type SecurityCertificate

type SecurityCertificate struct {
	IssuerDN     string `json:"issuer_dn,omitempty"`
	SubjectDN    string `json:"subject_dn,omitempty"`
	San          string `json:"san,omitempty"`
	NotBefore    string `json:"not_before,omitempty"`
	NotAfter     string `json:"not_after,omitempty"`
	SerialNumber string `json:"serial_number,omitempty"`
}

SecurityCertificate represents a single SSL certificate entry.

type SecurityCertificatesResponse

type SecurityCertificatesResponse struct {
	Certificates []SecurityCertificate `json:"certificates,omitempty"`
}

SecurityCertificatesResponse represents a collection of SSL certificates.

type SecurityConfig

type SecurityConfig struct {
	Dynamic SecurityConfigDynamic `json:"dynamic"`
}

SecurityConfig represents the top-level dynamic configuration of the OpenSearch Security plugin. The Dynamic field contains all runtime-configurable settings.

type SecurityConfigAuthFailureListeners

type SecurityConfigAuthFailureListeners struct {
	Type           *string `json:"type,omitempty"`
	WindowDuration *string `json:"window_duration,omitempty"`
	MaxCount       *int    `json:"max_count,omitempty"`
	BlockDuration  *string `json:"block_duration,omitempty"`
}

SecurityConfigAuthFailureListeners defines the configuration for authentication failure listeners in the Security plugin, which trigger actions on repeated auth failures.

type SecurityConfigAuthc

type SecurityConfigAuthc struct {
	Description           *string                              `json:"description,omitempty"`
	HttpEnabled           *bool                                `json:"http_enabled,omitempty"`
	TransportEnabled      *bool                                `json:"transport_enabled,omitempty"`
	Order                 *int                                 `json:"order,omitempty"`
	HttpAuthenticator     *SecurityConfigHttpAuthenticator     `json:"http_authenticator,omitempty"`
	AuthenticationBackend *SecurityConfigAuthenticationBackend `json:"authentication_backend,omitempty"`
}

SecurityConfigAuthc defines an authentication domain in the Security plugin, specifying the HTTP authenticator and authentication backend to use.

type SecurityConfigAuthenticationBackend

type SecurityConfigAuthenticationBackend struct {
	Type   string         `json:"type"`
	Config map[string]any `json:"config,omitempty"`
}

SecurityConfigAuthenticationBackend specifies the authentication backend type and its configuration for a Security plugin authentication domain.

type SecurityConfigAuthorizationBackend

type SecurityConfigAuthorizationBackend struct {
	Type   string         `json:"type"`
	Config map[string]any `json:"config,omitempty"`
}

SecurityConfigAuthorizationBackend specifies the authorization backend type and its configuration for a Security plugin authorization domain.

type SecurityConfigAuthz

type SecurityConfigAuthz struct {
	Description          *string                             `json:"description,omitempty"`
	HttpEnabled          *bool                               `json:"http_enabled,omitempty"`
	AuthorizationBackend *SecurityConfigAuthorizationBackend `json:"authorization_backend,omitempty"`
}

SecurityConfigAuthz defines an authorization domain in the Security plugin, specifying the authorization backend to use for resolving roles.

type SecurityConfigDynamic

type SecurityConfigDynamic struct {
	FilteredAliasMode            *string                                       `json:"filtered_alias_mode,omitempty"`
	DisableRestAuth              *bool                                         `json:"disable_rest_auth,omitempty"`
	DisableIntertransportAuth    *bool                                         `json:"disable_intertransport_auth,omitempty"`
	RespectRequestIndicesOptions *bool                                         `json:"respect_request_indices_options,omitempty"`
	License                      *string                                       `json:"license,omitempty"`
	Kibana                       *SecurityConfigKibana                         `json:"kibana,omitempty"`
	Http                         *SecurityConfigHttp                           `json:"http,omitempty"`
	Authc                        map[string]SecurityConfigAuthc                `json:"authc,omitempty"`
	Authz                        map[string]SecurityConfigAuthz                `json:"authz,omitempty"`
	AuthFailureListeners         map[string]SecurityConfigAuthFailureListeners `json:"auth_failure_listeners,omitempty"`
	DoNotFailOnForbidden         *bool                                         `json:"do_not_fail_on_forbidden,omitempty"`
	MultiRolespanEnabled         *bool                                         `json:"multi_rolespan_enabled,omitempty"`
	HostsResolverMode            *string                                       `json:"hosts_resolver_mode,omitempty"`
	TransportUserrnameAttribute  *string                                       `json:"transport_userrname_attribute,omitempty"`
	DoNotFailOnForbiddenEmpty    *bool                                         `json:"do_not_fail_on_forbidden_empty,omitempty"`
	OnBehalfOfSettings           *SecurityConfigOnBehalfOfSettings             `json:"on_behalf_of,omitempty"`
}

SecurityConfigDynamic contains the dynamic (runtime-configurable) settings for the OpenSearch Security plugin, including authentication backends, authorization, HTTPS configuration, and various security behavior toggles.

type SecurityConfigHttp

type SecurityConfigHttp struct {
	AnonymousAuthEnabled *bool                          `json:"anonymous_auth_enabled,omitempty"`
	Xff                  *SecurityConfigXff             `json:"xff,omitempty"`
	Authc                map[string]SecurityConfigAuthc `json:"authc,omitempty"`
}

SecurityConfigHttp contains HTTP-layer security settings for the Security plugin, including anonymous authentication and X-Forwarded-For configuration.

type SecurityConfigHttpAuthenticator

type SecurityConfigHttpAuthenticator struct {
	Type      string         `json:"type"`
	Challenge *bool          `json:"challenge,omitempty"`
	Config    map[string]any `json:"config,omitempty"`
}

SecurityConfigHttpAuthenticator specifies the HTTP authenticator type and its configuration for a Security plugin authentication domain.

type SecurityConfigKibana

type SecurityConfigKibana struct {
	MultitenancyEnabled  *bool   `json:"multitenancy_enabled,omitempty"`
	ServerUsername       *string `json:"server_username,omitempty"`
	ServerPassword       *string `json:"server_password,omitempty"`
	Index                *string `json:"index,omitempty"`
	DoNotFailOnForbidden *bool   `json:"doNotFailOnForbidden,omitempty"`
}

SecurityConfigKibana contains the Dashboards (Kibana) integration settings for the Security plugin, including multitenancy and server credentials.

type SecurityConfigOnBehalfOfSettings

type SecurityConfigOnBehalfOfSettings struct {
	Enabled       *bool   `json:"enabled,omitempty"`
	SigningKey    *string `json:"signing_key,omitempty"`
	EncryptionKey *string `json:"encryption_key,omitempty"`
}

SecurityConfigOnBehalfOfSettings defines the "on behalf of" token settings for the Security plugin, allowing users to act on behalf of other users.

type SecurityConfigUpdateResponse

type SecurityConfigUpdateResponse struct {
	Status      *string `json:"status,omitempty"`
	NodeSize    int     `json:"nodes_size,omitempty"`
	UpdatedNode int     `json:"updated_node,omitempty"`
}

SecurityConfigUpdateResponse represents the result of a security configuration update.

type SecurityConfigXff

type SecurityConfigXff struct {
	Enabled         *bool   `json:"enabled,omitempty"`
	InternalProxies *string `json:"internalProxies,omitempty"`
	RemoteIpHeader  *string `json:"remoteIpHeader,omitempty"`
}

SecurityConfigXff configures X-Forwarded-For header handling for the Security plugin, controlling how client IP addresses are resolved behind proxies.

type SecurityDistinguishedName

type SecurityDistinguishedName struct {
	NodesDN []string `json:"nodes_dn"`
}

SecurityDistinguishedName represents a node distinguished name (DN) entry used for node-to-node authentication in the Security plugin. NodesDN contains the list of distinguished names for trusted nodes.

type SecurityGetConfigResponse

type SecurityGetConfigResponse struct {
	Config SecurityConfig `json:"config"`
}

SecurityGetConfigResponse wraps the Security plugin configuration returned from the GET /_plugins/_security/api/securityconfig endpoint.

type SecurityHealthResponse

type SecurityHealthResponse struct {
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

SecurityHealthResponse represents the health status of the Security plugin.

type SecurityIndexPermissions

type SecurityIndexPermissions struct {
	IndexPatterns         []string `json:"index_patterns"`
	MaskedFields          []string `json:"masked_fields,omitempty"`
	AllowedActions        []string `json:"allowed_actions"`
	DocumentLevelSecurity *string  `json:"dls,omitempty"`
	FieldLevelSecurity    []string `json:"fls,omitempty"`
}

SecurityIndexPermissions defines the index-level permissions within a security role, including index patterns, allowed actions, document-level security, field-level security, and masked fields.

type SecurityMultiTenancyConfigResponse

type SecurityMultiTenancyConfigResponse struct {
	Enabled        *bool    `json:"enabled,omitempty"`
	DefaultTenant  *string  `json:"default_tenant,omitempty"`
	PrivateEnabled *bool    `json:"private_tenant_enabled,omitempty"`
	AdminUsernames []string `json:"admin_usernames,omitempty"`
}

SecurityMultiTenancyConfigResponse represents the multi-tenancy configuration.

type SecurityPermissionsInfoResponse

type SecurityPermissionsInfoResponse struct {
	HasAccess           bool     `json:"has_access"`
	DisabledEndpoints   []string `json:"disabled_endpoints,omitempty"`
	DisabledEndpointsV2 []string `json:"disabledEndpoints,omitempty"`
	EnabledEndpoints    []string `json:"enabled_endpoints,omitempty"`
}

SecurityPermissionsInfoResponse represents the current user's permission information.

type SecurityPutActionGroup

type SecurityPutActionGroup struct {
	Description    *string  `json:"description,omitempty"`
	Type           *string  `json:"type,omitempty"`
	AllowedActions []string `json:"allowed_actions"`
}

SecurityPutActionGroup represents the request body for creating or updating a security action group. It defines the group type, description, and the list of allowed actions.

type SecurityPutRole

type SecurityPutRole struct {
	Description        *string                     `json:"description,omitempty"`
	ClusterPermissions []string                    `json:"cluster_permissions,omitempty"`
	IndexPermissions   []SecurityIndexPermissions  `json:"index_permissions,omitempty"`
	TenantPermissions  []SecurityTenantPermissions `json:"tenant_permissions,omitempty"`
}

SecurityPutRole represents the request body for creating or updating a security role. It defines cluster-level permissions, index-level permissions, and tenant permissions.

type SecurityPutRoleMapping

type SecurityPutRoleMapping struct {
	BackendRoles    []string `json:"backend_roles,omitempty"`
	AndBackendRoles []string `json:"and_backend_roles,omitempty"`
	Hosts           []string `json:"hosts,omitempty"`
	Users           []string `json:"users,omitempty"`
}

SecurityPutRoleMapping represents the request body for creating or updating a role mapping. It maps backend roles, hosts, and users to a security role.

type SecurityPutTenant

type SecurityPutTenant struct {
	Description *string `json:"description"`
}

SecurityPutTenant represents the request body for creating or updating a security tenant.

type SecurityPutUser

type SecurityPutUser struct {
	SecurityUserBase `json:",inline"`
	Password         *string `json:"password,omitempty"`
}

SecurityPutUser represents the request body for creating or updating an internal user. It extends SecurityUserBase with an optional plaintext password field.

type SecurityRateLimiter

type SecurityRateLimiter struct {
	Type           string `json:"type,omitempty"`
	WindowDuration string `json:"window_duration,omitempty"`
	MaxCount       *int   `json:"max_count,omitempty"`
	BlockDuration  string `json:"block_duration,omitempty"`
}

SecurityRateLimiter represents an authentication failure rate limiter configuration.

type SecurityResponse

type SecurityResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

SecurityResponse represents a generic response from the Security plugin API, containing a status string and a human-readable message.

type SecurityRole

type SecurityRole struct {
	SecurityPutRole `json:",inline"`
	Reserved        *bool `json:"reserved,omitempty"`
	Hidden          *bool `json:"hidden,omitempty"`
	Static          *bool `json:"static,omitempty"`
}

SecurityRole represents a security role returned from the OpenSearch Security plugin, including its permissions and metadata flags (reserved, hidden, static).

type SecurityRoleMapping

type SecurityRoleMapping struct {
	SecurityPutRoleMapping `json:",inline"`
	Reserved               *bool `json:"reserved,omitempty"`
	Hidden                 *bool `json:"hidden,omitempty"`
}

SecurityRoleMapping represents a security role mapping returned from the OpenSearch Security plugin, linking backend roles, hosts, and users to a security role.

type SecuritySSLInfoDetail

type SecuritySSLInfoDetail struct {
	Principal string           `json:"principal,omitempty"`
	CertList  []map[string]any `json:"certs_list,omitempty"`
}

SecuritySSLInfoDetail contains details about SSL certificates for either HTTP or transport layers.

type SecuritySSLInfoResponse

type SecuritySSLInfoResponse struct {
	HttpSslCertificatesInfo      *SecuritySSLInfoDetail `json:"http_sslinfo,omitempty"`
	TransportSslCertificatesInfo *SecuritySSLInfoDetail `json:"transport_sslinfo,omitempty"`
}

SecuritySSLInfoResponse represents SSL certificate information from the Security plugin.

type SecurityService

type SecurityService interface {
	// GetRole retrieves a security role by name from the Security plugin.
	// The roleName parameter is required and specifies the name of the role to retrieve.
	// Returns a map keyed by role name containing the SecurityRole definition, or an error.
	GetRole(ctx context.Context, roleName string) (map[string]SecurityRole, error)

	// PutRole creates or updates a security role in the Security plugin.
	// The roleName parameter is required and specifies the name of the role.
	// The body parameter should contain the role definition including cluster permissions,
	// index permissions, and tenant permissions.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutRole(ctx context.Context, roleName string, body *SecurityPutRole) (*SecurityResponse, error)

	// DeleteRole deletes a security role from the Security plugin.
	// The roleName parameter is required and specifies the name of the role to delete.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteRole(ctx context.Context, roleName string) (*SecurityResponse, error)

	// GetRoleMapping retrieves the role mapping for a given role from the Security plugin.
	// The roleName parameter is required and specifies which role's mapping to retrieve.
	// Returns a map keyed by role name containing the SecurityRoleMapping, or an error.
	GetRoleMapping(ctx context.Context, roleName string) (map[string]SecurityRoleMapping, error)

	// PutRoleMapping creates or updates a role mapping that assigns backend roles, hosts,
	// and users to a security role.
	// The roleName parameter is required. The body should contain the mapping definition
	// with backend_roles, hosts, and users.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutRoleMapping(ctx context.Context, roleName string, body *SecurityPutRoleMapping) (*SecurityResponse, error)

	// DeleteRoleMapping deletes the role mapping for a given security role.
	// The roleName parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteRoleMapping(ctx context.Context, roleName string) (*SecurityResponse, error)

	// GetUser retrieves an internal user from the Security plugin by username.
	// The username parameter is required.
	// Returns a map keyed by username containing the SecurityUser definition, or an error.
	GetUser(ctx context.Context, username string) (map[string]SecurityUser, error)

	// PutUser creates or updates an internal user in the Security plugin.
	// The username parameter is required. The body should contain the user definition
	// including password, backend roles, attributes, and other user properties.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutUser(ctx context.Context, username string, body *SecurityPutUser) (*SecurityResponse, error)

	// DeleteUser deletes an internal user from the Security plugin.
	// The username parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteUser(ctx context.Context, username string) (*SecurityResponse, error)

	// GetActionGroup retrieves a security action group by name.
	// The name parameter is required and specifies the action group to retrieve.
	// Returns a map keyed by action group name containing the SecurityActionGroup, or an error.
	GetActionGroup(ctx context.Context, name string) (map[string]SecurityActionGroup, error)

	// PutActionGroup creates or updates a security action group.
	// The name parameter is required. The body should contain the action group definition
	// including allowed_actions, type, and description.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutActionGroup(ctx context.Context, name string, body *SecurityPutActionGroup) (*SecurityResponse, error)

	// DeleteActionGroup deletes a security action group by name.
	// The name parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteActionGroup(ctx context.Context, name string) (*SecurityResponse, error)

	// GetTenant retrieves a security tenant by name.
	// The name parameter is required and specifies the tenant to retrieve.
	// Returns a map keyed by tenant name containing the SecurityTenant definition, or an error.
	GetTenant(ctx context.Context, name string) (map[string]SecurityTenant, error)

	// PutTenant creates or updates a security tenant.
	// The name parameter is required. The body should contain the tenant definition
	// including description.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutTenant(ctx context.Context, name string, body *SecurityPutTenant) (*SecurityResponse, error)

	// DeleteTenant deletes a security tenant by name.
	// The name parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteTenant(ctx context.Context, name string) (*SecurityResponse, error)

	// GetDistinguishedName retrieves a node distinguished name (DN) entry by name
	// from the Security plugin's nodes DN configuration.
	// The name parameter is required.
	// Returns a map keyed by name containing the SecurityDistinguishedName, or an error.
	GetDistinguishedName(ctx context.Context, name string) (map[string]SecurityDistinguishedName, error)

	// PutDistinguishedName creates or updates a node distinguished name entry
	// in the Security plugin's nodes DN configuration.
	// The name parameter is required. The body should contain the nodes_dn list.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutDistinguishedName(ctx context.Context, name string, body *SecurityDistinguishedName) (*SecurityResponse, error)

	// DeleteDistinguishedName deletes a node distinguished name entry by name
	// from the Security plugin's nodes DN configuration.
	// The name parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteDistinguishedName(ctx context.Context, name string) (*SecurityResponse, error)

	// FlushCache flushes the Security plugin's internal caches.
	// Returns a SecurityResponse confirming the cache flush, or an error.
	FlushCache(ctx context.Context) (*SecurityResponse, error)

	// AuthInfo retrieves the authentication information for the currently authenticated user.
	// Returns a SecurityAuthInfoResponse containing user details, roles, tenants, and other auth metadata, or an error.
	AuthInfo(ctx context.Context) (*SecurityAuthInfoResponse, error)

	// GetConfig retrieves the current Security plugin dynamic configuration.
	// Returns a SecurityGetConfigResponse containing the full security configuration, or an error.
	GetConfig(ctx context.Context) (*SecurityGetConfigResponse, error)

	// PutConfig updates the Security plugin's dynamic configuration.
	// The body parameter should contain the security configuration to apply.
	// Returns a SecurityResponse confirming the update, or an error.
	PutConfig(ctx context.Context, body any) (*SecurityResponse, error)

	// GetAudit retrieves the current Security plugin audit logging configuration.
	// Returns a SecurityAudit containing the audit configuration, or an error.
	GetAudit(ctx context.Context) (*SecurityAudit, error)

	// PutAudit updates the Security plugin's audit logging configuration.
	// The body parameter should contain the audit configuration to apply.
	// Returns a SecurityResponse confirming the update, or an error.
	PutAudit(ctx context.Context, body any) (*SecurityResponse, error)

	// Health retrieves the health status of the Security plugin.
	// Returns a SecurityHealthResponse containing the plugin health status, or an error.
	Health(ctx context.Context) (*SecurityHealthResponse, error)

	// WhoAmI retrieves the identity information of the currently authenticated user.
	// Returns a SecurityWhoAmIResponse containing the user's DN and admin status, or an error.
	WhoAmI(ctx context.Context) (*SecurityWhoAmIResponse, error)

	// TenantInfo retrieves the available tenant information from the Security plugin.
	// Returns a map of tenant data, or an error.
	TenantInfo(ctx context.Context) (map[string]any, error)

	// DashboardsInfo retrieves the Dashboards integration information from the Security plugin.
	// Returns a map of Dashboards info data, or an error.
	DashboardsInfo(ctx context.Context) (map[string]any, error)

	// ConfigUpdate triggers a security configuration update across cluster nodes.
	// The configTypes parameter specifies which configuration types to update.
	// Returns a SecurityConfigUpdateResponse with node update results, or an error.
	ConfigUpdate(ctx context.Context, configTypes []string) (*SecurityConfigUpdateResponse, error)

	// SSLInfo retrieves SSL certificate information from the Security plugin.
	// Returns a SecuritySSLInfoResponse containing HTTP and transport SSL info, or an error.
	SSLInfo(ctx context.Context) (*SecuritySSLInfoResponse, error)

	// PermissionsInfo retrieves the current user's permission information from the Security plugin.
	// Returns a SecurityPermissionsInfoResponse with access and endpoint details, or an error.
	PermissionsInfo(ctx context.Context) (*SecurityPermissionsInfoResponse, error)

	// GetAccount retrieves the current user's account information from the Security plugin.
	// Returns a SecurityAccountResponse with user account details, or an error.
	GetAccount(ctx context.Context) (*SecurityAccountResponse, error)

	// PutAccount updates the current user's account in the Security plugin.
	// The body parameter should contain the account fields to update.
	// Returns a SecurityResponse confirming the update, or an error.
	PutAccount(ctx context.Context, body any) (*SecurityResponse, error)

	// AuthToken requests an authentication token from the Security plugin.
	// Returns a SecurityAuthTokenResponse containing the issued token, or an error.
	AuthToken(ctx context.Context) (*SecurityAuthTokenResponse, error)

	// GetAllowlist retrieves the Security plugin REST API allowlist configuration.
	// Returns a SecurityAllowlist with the current allowlist settings, or an error.
	GetAllowlist(ctx context.Context) (*SecurityAllowlist, error)

	// PutAllowlist updates the Security plugin REST API allowlist configuration.
	// The body parameter should contain the allowlist configuration to apply.
	// Returns a SecurityResponse confirming the update, or an error.
	PutAllowlist(ctx context.Context, body any) (*SecurityResponse, error)

	// GetCertificates retrieves the SSL certificates known to the Security plugin.
	// Returns a SecurityCertificatesResponse containing the certificate list, or an error.
	GetCertificates(ctx context.Context) (*SecurityCertificatesResponse, error)

	// GetMultiTenancyConfig retrieves the multi-tenancy configuration from the Security plugin.
	// Returns a SecurityMultiTenancyConfigResponse with tenancy settings, or an error.
	GetMultiTenancyConfig(ctx context.Context) (*SecurityMultiTenancyConfigResponse, error)

	// PutMultiTenancyConfig updates the multi-tenancy configuration in the Security plugin.
	// The body parameter should contain the tenancy configuration to apply.
	// Returns a SecurityResponse confirming the update, or an error.
	PutMultiTenancyConfig(ctx context.Context, body any) (*SecurityResponse, error)

	// GetRateLimiters retrieves the authentication failure rate limiter configurations.
	// Returns a map of rate limiter name to SecurityRateLimiter, or an error.
	GetRateLimiters(ctx context.Context) (map[string]SecurityRateLimiter, error)

	// PutRateLimiter creates or updates an authentication failure rate limiter.
	// The name parameter is required. The body should contain the rate limiter definition.
	// Returns a SecurityResponse confirming the operation, or an error.
	PutRateLimiter(ctx context.Context, name string, body any) (*SecurityResponse, error)

	// DeleteRateLimiter deletes an authentication failure rate limiter by name.
	// The name parameter is required.
	// Returns a SecurityResponse confirming the deletion, or an error.
	DeleteRateLimiter(ctx context.Context, name string) (*SecurityResponse, error)

	// ListRoles retrieves all security roles from the Security plugin.
	// Returns a map keyed by role name containing each SecurityRole definition, or an error.
	ListRoles(ctx context.Context) (map[string]SecurityRole, error)

	// ListUsers retrieves all internal users from the Security plugin.
	// Returns a map keyed by username containing each SecurityUser definition, or an error.
	ListUsers(ctx context.Context) (map[string]SecurityUser, error)

	// ListRoleMappings retrieves all role mappings from the Security plugin.
	// Returns a map keyed by role name containing each SecurityRoleMapping, or an error.
	ListRoleMappings(ctx context.Context) (map[string]SecurityRoleMapping, error)

	// ListActionGroups retrieves all security action groups from the Security plugin.
	// Returns a map keyed by action group name containing each SecurityActionGroup, or an error.
	ListActionGroups(ctx context.Context) (map[string]SecurityActionGroup, error)

	// ListTenants retrieves all security tenants from the Security plugin.
	// Returns a map keyed by tenant name containing each SecurityTenant definition, or an error.
	ListTenants(ctx context.Context) (map[string]SecurityTenant, error)

	// ListNodesDN retrieves all node distinguished name entries from the Security plugin.
	// Returns a map keyed by name containing each SecurityDistinguishedName, or an error.
	ListNodesDN(ctx context.Context) (map[string]SecurityDistinguishedName, error)
}

SecurityService defines the interface for interacting with the OpenSearch Security plugin API. It provides methods to manage roles, role mappings, users, action groups, tenants, distinguished names, cache, authentication info, security configuration, and audit logging. See https://opensearch.org/docs/latest/security/access-control/api/ for the OpenSearch Security plugin documentation.

func NewSecurityService

func NewSecurityService(client *resty.Client, logger *logrus.Entry) SecurityService

NewSecurityService creates a new DefaultSecurityService with the given HTTP client and logger.

type SecurityTenant

type SecurityTenant struct {
	SecurityPutTenant `json:",inline"`
	Reserved          *bool `json:"reserved,omitempty"`
	Hidden            *bool `json:"hidden,omitempty"`
	Static            *bool `json:"static,omitempty"`
}

SecurityTenant represents a security tenant returned from the OpenSearch Security plugin. Tenants provide isolated spaces for Dashboards users.

type SecurityTenantPermissions

type SecurityTenantPermissions struct {
	TenantPatterns []string `json:"tenant_patterns"`
	AllowedActions []string `json:"allowed_actions"`
}

SecurityTenantPermissions defines the tenant-level permissions within a security role, specifying which tenants are accessible and what actions are allowed.

type SecurityUser

type SecurityUser struct {
	SecurityUserBase `json:",inline"`
	Reserved         *bool `json:"reserved,omitempty"`
	Hidden           *bool `json:"hidden,omitempty"`
	Static           *bool `json:"static,omitempty"`
}

SecurityUser represents an internal user returned from the OpenSearch Security plugin, including user attributes, backend roles, and metadata flags.

type SecurityUserBase

type SecurityUserBase struct {
	Hash          string            `json:"hash,omitempty"`
	BackendRoles  []string          `json:"backend_roles,omitempty"`
	SecurityRoles []string          `json:"opendistro_security_roles,omitempty"`
	Attributes    map[string]string `json:"attributes,omitempty"`
	Description   *string           `json:"description,omitempty"`
	Service       *bool             `json:"service,omitempty"`
}

SecurityUserBase contains the common fields for a security user, including password hash, backend roles, security roles, and custom attributes.

type SecurityWhoAmIResponse

type SecurityWhoAmIResponse struct {
	Dn                       string `json:"dn"`
	IsAdmin                  bool   `json:"is_admin"`
	IsNodeCertificateRequest bool   `json:"is_node_certificate_request"`
}

SecurityWhoAmIResponse represents the identity information of the currently authenticated user.

type ShardRecovery

type ShardRecovery struct {
	Id        int            `json:"id"`
	Type      string         `json:"type"`
	Stage     string         `json:"stage"`
	Primary   bool           `json:"primary"`
	StartTime string         `json:"start_time,omitempty"`
	StopTime  string         `json:"stop_time,omitempty"`
	TotalTime string         `json:"total_time_in_millis,omitempty"`
	Source    map[string]any `json:"source,omitempty"`
	Target    map[string]any `json:"target,omitempty"`
	Index     map[string]any `json:"index,omitempty"`
}

ShardRecovery describes a single shard's recovery progress.

type ShardStoreWrapper

type ShardStoreWrapper struct {
	Stores []map[string]any `json:"stores,omitempty"`
}

ShardStoreWrapper wraps the stores info for a single shard.

type ShrinkRequest

type ShrinkRequest struct {
	Source string `validate:"required"`
	Target string `validate:"required"`
	Body   any
}

func (*ShrinkRequest) Validate

func (r *ShrinkRequest) Validate() error

type SimulateIndexTemplateRequest

type SimulateIndexTemplateRequest struct {
	Name string `validate:"required"`
	Body any
}

func (*SimulateIndexTemplateRequest) Validate

func (r *SimulateIndexTemplateRequest) Validate() error

type SimulateTemplateRequest

type SimulateTemplateRequest struct {
	Name string
	Body any
}

type SmDeletePolicyResponse

type SmDeletePolicyResponse struct {
	Index          string         `json:"_index"`
	ID             string         `json:"_id"`
	Version        int64          `json:"_version"`
	Result         string         `json:"result"`
	ForcedRefresh  bool           `json:"forced_refresh"`
	Shard          map[string]any `json:"_shards"`
	SequenceNumber int64          `json:"_seq_no"`
	PrimaryTerm    int64          `json:"_primary_term"`
}

SmDeletePolicyResponse represents the response from the SM delete policy API, confirming the deletion with the document ID, version, and result status.

type SmExplainPolicy

type SmExplainPolicy struct {
	Name           string                `json:"policy_id,omitempty"`
	SequenceNumber int64                 `json:"policy_seq_no,omitempty"`
	PrimaryTerm    int64                 `json:"policy_primary_term,omitempty"`
	Enabled        bool                  `json:"enabled,omitempty"`
	Creation       *SmExplainPolicyState `json:"creation,omitempty"`
	Deletion       *SmExplainPolicyState `json:"deletion,omitempty"`
}

SmExplainPolicy represents the execution status of a single SM policy, including creation and deletion state, sequences numbers, and enabled status.

type SmExplainPolicyInfo

type SmExplainPolicyInfo struct {
	Message string `json:"message,omitempty"`
	Cause   string `json:"cause,omitempty"`
}

SmExplainPolicyInfo contains informational messages and error causes about an SM policy execution.

type SmExplainPolicyLatestExecution

type SmExplainPolicyLatestExecution struct {
	Status    string              `json:"status,omitempty"`
	StartTime int64               `json:"start_time,omitempty"`
	EndTime   int64               `json:"end_time,omitempty"`
	Info      SmExplainPolicyInfo `json:"info,omitempty"`
}

SmExplainPolicyLatestExecution contains details about the most recent execution of an SM policy snapshot creation or deletion.

type SmExplainPolicyResponse

type SmExplainPolicyResponse struct {
	Policies []SmExplainPolicy `json:"policies"`
}

SmExplainPolicyResponse represents the response from the SM explain API, containing execution status for one or more snapshot management policies.

type SmExplainPolicyRetry

type SmExplainPolicyRetry struct {
	Count int64 `json:"count,omitempty"`
}

SmExplainPolicyRetry contains retry count information for a failed SM policy execution.

type SmExplainPolicyState

type SmExplainPolicyState struct {
	CurrentState    string                         `json:"current_state,omitempty"`
	Trigger         SmExplainPolicyTrigger         `json:"trigger,omitempty"`
	LatestExecution SmExplainPolicyLatestExecution `json:"latest_execution,omitempty"`
	Retry           SmExplainPolicyRetry           `json:"retry,omitempty"`
}

SmExplainPolicyState represents the current execution state of an SM policy's creation or deletion schedule, including trigger details and latest execution info.

type SmExplainPolicyTrigger

type SmExplainPolicyTrigger struct {
	Time int64 `json:"time,omitempty"`
}

SmExplainPolicyTrigger represents the trigger timing for an SM policy schedule event.

type SmGetPolicyResponse

type SmGetPolicyResponse struct {
	Id             string   `json:"_id"`
	Version        int64    `json:"_version"`
	SequenceNumber int64    `json:"_seq_no"`
	PrimaryTerm    int64    `json:"_primary_term"`
	Policy         SmPolicy `json:"sm_policy"`
}

SmGetPolicyResponse represents the full response from the SM GET policy API, including the document ID, version, sequence number, primary term, and the policy definition.

type SmListPoliciesResponse

type SmListPoliciesResponse struct {
	Policies      []SmPolicyBase `json:"policies"`
	TotalPolicies int64          `json:"total_policies"`
}

SmListPoliciesResponse represents the response from listing SM policies.

type SmPolicy

type SmPolicy struct {
	SmPutPolicy    `json:",inline"`
	Name           *string        `json:"policy_id,omitempty"`
	SchemaVersion  *int64         `json:"schema_version,omitempty"`
	LastUpdateTime *int64         `json:"last_updated_time,omitempty"`
	EnabledTime    *int64         `json:"enabled_time,omitempty"`
	Schedule       map[string]any `json:"schedule,omitempty"`
}

SmPolicy represents a Snapshot Management policy as returned from the SM API, extending SmPutPolicy with metadata like name, schema version, and timestamps.

type SmPolicyBase

type SmPolicyBase struct {
	SmPolicy       `json:",inline"`
	SequenceNumber *int64 `json:"_seq_no,omitempty"`
	PrimaryTerm    *int64 `json:"_primary_term,omitempty"`
}

SmPolicyBase represents a single SM policy entry as returned by the list policies API.

type SmPolicyCreation

type SmPolicyCreation struct {
	Schedule  map[string]any `json:"schedule"`
	TimeLimit *string        `json:"time_limit,omitempty"`
}

SmPolicyCreation defines the creation schedule for snapshots in an SM policy.

type SmPolicyDeleteCondition

type SmPolicyDeleteCondition struct {
	MaxCount *int64  `json:"max_count,omitempty"`
	MaxAge   *string `json:"max_age,omitempty"`
	MinCount *int64  `json:"min_count,omitempty"`
}

SmPolicyDeleteCondition defines the retention conditions for snapshot deletion, including maximum count, maximum age, and minimum count constraints.

type SmPolicyDeletion

type SmPolicyDeletion struct {
	Schedule  map[string]any           `json:"schedule,omitempty"`
	Condition *SmPolicyDeleteCondition `json:"condition,omitempty"`
	TimeLimit *string                  `json:"time_limit,omitempty"`
}

SmPolicyDeletion defines the deletion (retention) schedule for snapshots in an SM policy.

type SmPolicyNotification

type SmPolicyNotification struct {
	Channel    SmPolicyNotificationChannel    `json:"channel"`
	Conditions *SmPolicyNotificationCondition `json:"conditions,omitempty"`
}

SmPolicyNotification defines the notification configuration for SM policy events.

type SmPolicyNotificationChannel

type SmPolicyNotificationChannel struct {
	ID string `json:"id"`
}

SmPolicyNotificationChannel identifies a notification channel by its ID.

type SmPolicyNotificationCondition

type SmPolicyNotificationCondition struct {
	Creation          *bool `json:"creation,omitempty"`
	Deletion          *bool `json:"deletion,omitempty"`
	Failure           *bool `json:"failure,omitempty"`
	TimeLimitExceeded *bool `json:"time_limit_exceeded,omitempty"`
}

SmPolicyNotificationCondition specifies which SM policy events trigger notifications, such as snapshot creation, deletion, failure, or time limit exceeded.

type SmPolicySnapshotConfig

type SmPolicySnapshotConfig struct {
	DateFormat         *string        `json:"date_format,omitempty"`
	Timezone           *string        `json:"timezone,omitempty"`
	Indices            *string        `json:"indices,omitempty"`
	Repository         string         `json:"repository,omitempty"`
	IgnoreUnavailable  *bool          `json:"ignore_unavailable,omitempty"`
	IncludeGlobalState *bool          `json:"include_global_state,omitempty"`
	Partial            *bool          `json:"partial,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
}

SmPolicySnapshotConfig defines the snapshot-specific configuration for an SM policy, including repository, indices, date format, and snapshot options.

type SmPutPolicy

type SmPutPolicy struct {
	Description    *string                `json:"description,omitempty"`
	Enabled        *bool                  `json:"enabled,omitempty"`
	SnapshotConfig SmPolicySnapshotConfig `json:"snapshot_config"`
	Creation       SmPolicyCreation       `json:"creation"`
	Deletion       *SmPolicyDeletion      `json:"deletion,omitempty"`
	Notification   *SmPolicyNotification  `json:"notification,omitempty"`
}

SmPutPolicy represents the request body for creating or updating a Snapshot Management policy. It includes the snapshot configuration, creation and deletion schedules, and notification settings.

type SmPutPolicyRequest

type SmPutPolicyRequest struct {
	PolicyName string       `validate:"required"`
	Body       *SmPutPolicy `validate:"required"`
	Version    *types.DocumentVersion
}

func (*SmPutPolicyRequest) Validate

func (r *SmPutPolicyRequest) Validate() error

type SmService

type SmService interface {
	GetPolicy(ctx context.Context, policyName string) (*SmGetPolicyResponse, error)
	PutPolicy(ctx context.Context, req *SmPutPolicyRequest) (*SmGetPolicyResponse, error)
	PostPolicy(ctx context.Context, policyName string, body *SmPutPolicy) (*SmGetPolicyResponse, error)
	DeletePolicy(ctx context.Context, policyName string) (*SmDeletePolicyResponse, error)
	ExplainPolicy(ctx context.Context, policyNames []string) (*SmExplainPolicyResponse, error)
	StartPolicy(ctx context.Context, policyName string) (*SmStartStopResponse, error)
	StopPolicy(ctx context.Context, policyName string) (*SmStartStopResponse, error)
	ListPolicies(ctx context.Context) (*SmListPoliciesResponse, error)
}

SmService interacts with the OpenSearch Snapshot Management (SM) plugin.

func NewSmService

func NewSmService(client *resty.Client, logger *logrus.Entry) SmService

type SmStartStopResponse

type SmStartStopResponse struct {
	Acknowledged bool   `json:"acknowledged,omitempty"`
	Status       string `json:"status,omitempty"`
}

SmStartStopResponse represents the response from starting or stopping an SM policy.

type Snapshot

type Snapshot struct {
	Snapshot          string                 `json:"snapshot"`
	UUID              string                 `json:"uuid"`
	VersionID         int                    `json:"version_id"`
	Version           string                 `json:"version"`
	Indices           []string               `json:"indices"`
	State             string                 `json:"state"`
	Reason            string                 `json:"reason"`
	StartTime         time.Time              `json:"start_time"`
	StartTimeInMillis int64                  `json:"start_time_in_millis"`
	EndTime           time.Time              `json:"end_time"`
	EndTimeInMillis   int64                  `json:"end_time_in_millis"`
	DurationInMillis  int64                  `json:"duration_in_millis"`
	Failures          []SnapshotShardFailure `json:"failures"`
	Shards            *types.ShardsInfo      `json:"shards"`
}

Snapshot represents a single OpenSearch snapshot with its metadata, timing, included indices, shard statistics, and any shard-level failures. Key fields include Snapshot (name), State, StartTime, EndTime, and Shards.

type SnapshotCleanupRepositoryResponse

type SnapshotCleanupRepositoryResponse struct {
	Results *SnapshotCleanupResults `json:"results,omitempty"`
}

SnapshotCleanupRepositoryResponse represents the result of cleaning up a snapshot repository.

type SnapshotCleanupResults

type SnapshotCleanupResults struct {
	DeletedBytes int64 `json:"deleted_bytes"`
	DeletedBlobs int64 `json:"deleted_blobs"`
}

SnapshotCleanupResults contains counts of deleted bytes and blobs.

type SnapshotCloneRequest

type SnapshotCloneRequest struct {
	Repository     string `validate:"required"`
	Snapshot       string `validate:"required"`
	TargetSnapshot string `validate:"required"`
	Body           any
}

func (*SnapshotCloneRequest) Validate

func (r *SnapshotCloneRequest) Validate() error

type SnapshotCreateRepositoryResponse

type SnapshotCreateRepositoryResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

SnapshotCreateRepositoryResponse represents the acknowledgment response from creating or updating a snapshot repository.

type SnapshotCreateRequest

type SnapshotCreateRequest struct {
	Repository string `validate:"required"`
	Snapshot   string `validate:"required"`
	Body       any
}

func (*SnapshotCreateRequest) Validate

func (r *SnapshotCreateRequest) Validate() error

type SnapshotCreateResponse

type SnapshotCreateResponse struct {
	Accepted *bool     `json:"accepted"`
	Snapshot *Snapshot `json:"snapshot"`
}

SnapshotCreateResponse represents the result of creating a snapshot. When the snapshot is taken synchronously, Snapshot contains the full snapshot details; for async operations, Accepted is set to true.

type SnapshotDeleteRepositoryResponse

type SnapshotDeleteRepositoryResponse struct {
	Acknowledged       bool   `json:"acknowledged"`
	ShardsAcknowledged bool   `json:"shards_acknowledged"`
	Index              string `json:"index,omitempty"`
}

SnapshotDeleteRepositoryResponse represents the acknowledgment response from unregistering a snapshot repository.

type SnapshotDeleteRequest

type SnapshotDeleteRequest struct {
	Repository string `validate:"required"`
	Snapshot   string `validate:"required"`
}

func (*SnapshotDeleteRequest) Validate

func (r *SnapshotDeleteRequest) Validate() error

type SnapshotDeleteResponse

type SnapshotDeleteResponse struct {
	Acknowledged bool `json:"acknowledged"`
}

SnapshotDeleteResponse represents the result of deleting a snapshot. The Acknowledged field indicates whether the delete was accepted.

type SnapshotFailure

type SnapshotFailure struct {
	NodeID string `json:"node_id,omitempty"`
	Indice string `json:"index,omitempty"`
	Reason string `json:"reason,omitempty"`
	Status string `json:"status,omitempty"`
}

SnapshotFailure describes a single failure that occurred during a snapshot operation, including the affected node, index, and reason.

type SnapshotGetRepositoryResponse

type SnapshotGetRepositoryResponse struct {
	Type     string         `json:"type"`
	Settings map[string]any `json:"settings,omitempty"`
}

SnapshotGetRepositoryResponse represents a registered snapshot repository, containing its storage backend type and configuration settings.

type SnapshotGetRequest

type SnapshotGetRequest struct {
	Repository string `validate:"required"`
	Snapshots  []string
}

func (*SnapshotGetRequest) Validate

func (r *SnapshotGetRequest) Validate() error

type SnapshotGetResponse

type SnapshotGetResponse struct {
	Snapshots []*Snapshot `json:"snapshots"`
}

SnapshotGetResponse represents the result of retrieving snapshot information. It contains a list of Snapshot objects matching the request.

type SnapshotIndexShardStatus

type SnapshotIndexShardStatus struct {
	Stage  string        `json:"stage"`
	Stats  SnapshotStats `json:"stats"`
	Node   string        `json:"node"`
	Reason string        `json:"reason"`
}

SnapshotIndexShardStatus represents the snapshot status for a single shard within an index, including its current stage, transfer stats, assigned node, and failure reason if applicable.

type SnapshotIndexStatus

type SnapshotIndexStatus struct {
	ShardsStats SnapshotShardsStats                 `json:"shards_stats"`
	Stats       SnapshotStats                       `json:"stats"`
	Shards      map[string]SnapshotIndexShardStatus `json:"shards"`
}

SnapshotIndexStatus represents the snapshot status for a single index, including aggregate shard statistics, file progress, and per-shard details.

type SnapshotRepositoryMetaData

type SnapshotRepositoryMetaData struct {
	Type     string         `json:"type"`
	Settings map[string]any `json:"settings,omitempty"`
}

SnapshotRepositoryMetaData holds the type and settings for a snapshot repository definition, identical in structure to SnapshotGetRepositoryResponse.

type SnapshotRestoreRequest

type SnapshotRestoreRequest struct {
	Repository string `validate:"required"`
	Snapshot   string `validate:"required"`
	Body       any
}

func (*SnapshotRestoreRequest) Validate

func (r *SnapshotRestoreRequest) Validate() error

type SnapshotRestoreResponse

type SnapshotRestoreResponse struct {
	Accepted *bool        `json:"accepted"`
	Snapshot *RestoreInfo `json:"snapshot"`
}

SnapshotRestoreResponse represents the result of a snapshot restore operation. When the restore is synchronous, Snapshot contains the restore info; for async operations, Accepted is set to true.

type SnapshotShardFailure

type SnapshotShardFailure struct {
	Index     string `json:"index"`
	IndexUUID string `json:"index_uuid"`
	ShardID   int    `json:"shard_id"`
	Reason    string `json:"reason"`
	NodeID    string `json:"node_id"`
	Status    string `json:"status"`
}

SnapshotShardFailure describes a single shard that failed during a snapshot operation, including the index, shard ID, failure reason, and node involved.

type SnapshotShardsStats

type SnapshotShardsStats struct {
	Initializing int `json:"initializing"`
	Started      int `json:"started"`
	Finalizing   int `json:"finalizing"`
	Done         int `json:"done"`
	Failed       int `json:"failed"`
	Total        int `json:"total"`
}

SnapshotShardsStats tracks the number of shards in each snapshot phase: initializing, started, finalizing, done, and failed.

type SnapshotStats

type SnapshotStats struct {
	Incremental struct {
		FileCount   int    `json:"file_count"`
		Size        string `json:"size"`
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"incremental"`

	Processed struct {
		FileCount   int    `json:"file_count"`
		Size        string `json:"size"`
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"processed"`

	Total struct {
		FileCount   int    `json:"file_count"`
		Size        string `json:"size"`
		SizeInBytes int64  `json:"size_in_bytes"`
	} `json:"total"`

	StartTime         string `json:"start_time"`
	StartTimeInMillis int64  `json:"start_time_in_millis"`

	Time         string `json:"time"`
	TimeInMillis int64  `json:"time_in_millis"`

	NumberOfFiles  int `json:"number_of_files"`
	ProcessedFiles int `json:"processed_files"`

	TotalSize        string `json:"total_size"`
	TotalSizeInBytes int64  `json:"total_size_in_bytes"`
}

SnapshotStats tracks file and size statistics for a snapshot operation, including incremental, processed, and total counts along with timing.

type SnapshotStatus

type SnapshotStatus struct {
	Snapshot           string                         `json:"snapshot"`
	Repository         string                         `json:"repository"`
	UUID               string                         `json:"uuid"`
	State              string                         `json:"state"`
	IncludeGlobalState bool                           `json:"include_global_state"`
	ShardsStats        SnapshotShardsStats            `json:"shards_stats"`
	Stats              SnapshotStats                  `json:"stats"`
	Indices            map[string]SnapshotIndexStatus `json:"indices"`
	Failures           []SnapshotFailure              `json:"failures,omitempty"`
	StartTime          time.Time                      `json:"start_time,omitempty"`
	EndTime            time.Time                      `json:"end_time,omitempty"`
}

SnapshotStatus represents the detailed status of a single in-progress snapshot, including its state, shard statistics, file/size progress, per-index status, and any failures encountered.

type SnapshotStatusRequest

type SnapshotStatusRequest struct {
	Repository string `validate:"required"`
	Snapshots  []string
}

func (*SnapshotStatusRequest) Validate

func (r *SnapshotStatusRequest) Validate() error

type SnapshotStatusResponse

type SnapshotStatusResponse struct {
	Snapshots []SnapshotStatus `json:"snapshots"`
}

SnapshotStatusResponse represents the result of a snapshot status request. It contains a list of SnapshotStatus objects for in-progress snapshots.

type SnapshotVerifyRepositoryNode

type SnapshotVerifyRepositoryNode struct {
	Name string `json:"name"`
}

SnapshotVerifyRepositoryNode represents a single node that participated in a repository verification, identified by its name.

type SnapshotVerifyRepositoryResponse

type SnapshotVerifyRepositoryResponse struct {
	Nodes map[string]*SnapshotVerifyRepositoryNode `json:"nodes"`
}

SnapshotVerifyRepositoryResponse represents the result of verifying a snapshot repository. It maps node IDs to the node names that successfully verified access to the repository.

type SplitRequest

type SplitRequest struct {
	Source string `validate:"required"`
	Target string `validate:"required"`
	Body   any
}

func (*SplitRequest) Validate

func (r *SplitRequest) Validate() error

type SqlService

type SqlService interface {
	PPLQuery(ctx context.Context, body any) (*SQLResponse, error)
	PPLExplain(ctx context.Context, body any) (*SQLExplainResponse, error)
	SQLQuery(ctx context.Context, body any, format string) (*SQLResponse, error)
	SQLExplain(ctx context.Context, body any) (*SQLExplainResponse, error)
	SQLCloseCursor(ctx context.Context, body any) (*SQLCloseResponse, error)
}

SqlService defines the interface for interacting with the OpenSearch SQL/PPL plugin.

func NewSqlService

func NewSqlService(client *resty.Client, logger *logrus.Entry) SqlService

NewSqlService creates a new SqlService with the given REST client and logger.

type StartTaskResult

type StartTaskResult struct {
	Header http.Header `json:"-"`
	TaskId string      `json:"task"`
}

StartTaskResult represents the result of starting an async task, containing the task identifier that can be used to poll for completion.

type TaskInfo

type TaskInfo struct {
	Node               string            `json:"node"`
	Id                 int64             `json:"id"`
	Type               string            `json:"type"`
	Action             string            `json:"action"`
	Status             any               `json:"status"`
	Description        any               `json:"description"`
	StartTime          string            `json:"start_time"`
	StartTimeInMillis  int64             `json:"start_time_in_millis"`
	RunningTime        string            `json:"running_time"`
	RunningTimeInNanos int64             `json:"running_time_in_nanos"`
	Cancellable        bool              `json:"cancellable"`
	Cancelled          bool              `json:"cancelled"`
	ParentTaskId       string            `json:"parent_task_id"`
	Headers            map[string]string `json:"headers"`
}

TaskInfo represents detailed information about a single running task, including its type, action, start time, running duration, cancellability, parent task reference, headers, status, and description.

type TaskOperationFailure

type TaskOperationFailure struct {
	TaskId int64                         `json:"task_id"`
	NodeId string                        `json:"node_id"`
	Status string                        `json:"status"`
	Reason *types.OpenSearchErrorDetails `json:"reason"`
}

TaskOperationFailure represents a failure that occurred during a task operation, including the task ID, node ID, status, and error reason.

type TasksCancelResponse

type TasksCancelResponse struct {
	Header       http.Header                  `json:"-"`
	TaskFailures []*TaskOperationFailure      `json:"task_failures"`
	NodeFailures []*types.FailedNodeException `json:"node_failures"`
	Nodes        map[string]*DiscoveryNode    `json:"nodes"`
}

TasksCancelResponse represents the result of cancelling a running task. It contains per-node task listings showing which nodes held the task, along with any task or node-level failures encountered during cancellation.

type TasksGetTaskResponse

type TasksGetTaskResponse struct {
	Header    http.Header                   `json:"-"`
	Completed bool                          `json:"completed"`
	Task      *TaskInfo                     `json:"task,omitempty"`
	Error     *types.OpenSearchErrorDetails `json:"error,omitempty"`
}

TasksGetTaskResponse represents the result of retrieving a specific task. The Completed field indicates whether the task has finished; if so, the Task field contains its final state, and Error contains any failure details.

type TasksListResponse

type TasksListResponse struct {
	Header       http.Header                  `json:"-"`
	TaskFailures []*TaskOperationFailure      `json:"task_failures"`
	NodeFailures []*types.FailedNodeException `json:"node_failures"`
	Nodes        map[string]*DiscoveryNode    `json:"nodes"`
}

TasksListResponse represents the result of listing all running tasks. It contains per-node task listings, any task or node-level failures, and optional HTTP response headers.

type TasksService

type TasksService interface {
	// List returns all currently running tasks across cluster nodes.
	List(ctx context.Context) (*TasksListResponse, error)

	// Get retrieves a specific task by its ID.
	// The taskId must be in the format "nodeId:taskId".
	Get(ctx context.Context, taskId string) (*TasksGetTaskResponse, error)

	// Cancel cancels a running task identified by its ID.
	// The taskId must be in the format "nodeId:taskId".
	Cancel(ctx context.Context, taskId string) (*TasksCancelResponse, error)
}

TasksService provides access to the OpenSearch Tasks API group. It exposes operations for listing, retrieving, and cancelling long-running tasks across cluster nodes.

Example usage:

list, err := svc.List(ctx)
for _, node := range list.Nodes {
    for _, task := range node.Tasks {
        fmt.Println(task.Action, taskRunningTime)
    }
}

func NewTasksService

func NewTasksService(client *resty.Client, logger *logrus.Entry) TasksService

NewTasksService creates a new TasksService using the provided HTTP client and logger. The logger is scoped with a "service=tasks" field.

type TermVectorsFieldInfo

type TermVectorsFieldInfo struct {
	// FieldStatistics contains aggregate statistics across all terms in this field.
	FieldStatistics FieldStatistics `json:"field_statistics"`
	// Terms maps each term string to its statistics within this field.
	Terms map[string]TermsInfo `json:"terms"`
}

TermVectorsFieldInfo holds the term vector data for a single field, including field-level statistics and per-term information.

type TermsInfo

type TermsInfo struct {
	// DocFreq is the number of documents containing this term.
	DocFreq int64 `json:"doc_freq"`
	// Score is the relevance score for this term, if computed.
	Score float64 `json:"score"`
	// TermFreq is the number of times this term appears in the document field.
	TermFreq int64 `json:"term_freq"`
	// Ttf is the total term frequency across all documents in the index.
	Ttf int64 `json:"ttf"`
	// Tokens lists each token occurrence with position and offset information.
	Tokens []TokenInfo `json:"tokens"`
}

TermsInfo provides per-term statistics within a field's term vector, including document frequency, term frequency, total term frequency, and token positions.

type TermvectorsResponse

type TermvectorsResponse struct {
	// Index is the index containing the document.
	Index string `json:"_index"`
	// Type is the document type (deprecated).
	Type string `json:"_type"`
	// Id is the document ID.
	Id string `json:"_id,omitempty"`
	// Version is the version of the document.
	Version int `json:"_version"`
	// Found indicates whether the document was found.
	Found bool `json:"found"`
	// Took is the time in milliseconds the request took.
	Took int64 `json:"took"`
	// TermVectors maps field names to their respective term vector data.
	TermVectors map[string]TermVectorsFieldInfo `json:"term_vectors"`
}

TermvectorsResponse represents the result of a term vectors request for a single document.

type TimestampField

type TimestampField struct {
	// Name is the name of the timestamp field (typically "@timestamp").
	Name string `json:"name"`
}

TimestampField identifies the field used as the timestamp in a data stream.

type TokenInfo

type TokenInfo struct {
	// StartOffset is the character offset where the token starts.
	StartOffset int64 `json:"start_offset"`
	// EndOffset is the character offset where the token ends (exclusive).
	EndOffset int64 `json:"end_offset"`
	// Position is the ordinal position of the token in the field.
	Position int64 `json:"position"`
	// Payload is an optional payload associated with the token.
	Payload string `json:"payload"`
}

TokenInfo describes a single token occurrence within a term vector response, including its position and character offsets in the original text.

type TransformDeleteJobResponse

type TransformDeleteJobResponse struct {
	Took   int64            `json:"took,omitempty"`
	Errors bool             `json:"errors,omitempty"`
	Items  []map[string]any `json:"items,omitempty"`
}

TransformDeleteJobResponse represents the response from the Transform delete job API, indicating whether the deletion was successful and any per-item results.

type TransformExplainJob

type TransformExplainJob struct {
	MetadataId        string                  `json:"metadata_id"`
	TransformMetadata map[string]any          `json:"transform_metadata"`
	TransformId       string                  `json:"transform_id"`
	LastUpdatedAt     int64                   `json:"last_updated_at"`
	Status            string                  `json:"status"`
	FailureReason     string                  `json:"failure_reason"`
	Stats             TransformExplainJobStat `json:"stats"`
}

TransformExplainJob represents the execution status and statistics for a Transform job, including metadata, status, failure reason, and processing stats.

type TransformExplainJobStat

type TransformExplainJobStat struct {
	PagesProcessed     int64 `json:"pages_processed"`
	DocumentsProcessed int64 `json:"documents_processed"`
	DocumentsIndexed   int64 `json:"documents_indexed"`
	IndexTimeInMillis  int64 `json:"index_time_in_millis"`
	SearchTimeInMillis int64 `json:"search_time_in_millis"`
}

TransformExplainJobStat contains processing statistics for a Transform job, including pages processed, documents processed/indexed, and time spent indexing/searching.

type TransformGetJobResponse

type TransformGetJobResponse struct {
	Id             string           `json:"_id"`
	Version        int64            `json:"_version"`
	SequenceNumber int64            `json:"_seq_no"`
	PrimaryTerm    int64            `json:"_primary_term"`
	Transform      TransformJobBase `json:"transform"`
}

TransformGetJobResponse represents the full response from the Transform GET job API, including the document ID, version, sequence number, primary term, and the job definition.

type TransformJobBase

type TransformJobBase struct {
	Enabled            *bool          `json:"enabled,omitempty"`
	Continuous         *bool          `json:"continuous,omitempty"`
	Schedule           map[string]any `json:"schedule,omitempty"`
	Description        *string        `json:"description,omitempty"`
	MetadataId         *string        `json:"metadata_id,omitempty"`
	SourceIndex        string         `json:"source_index,omitempty"`
	TargetIndex        string         `json:"target_index,omitempty"`
	DataSelectionQuery any            `json:"data_selection_query,omitempty"`
	PageSize           int64          `json:"page_size,omitempty"`
	Groups             []any          `json:"groups,omitempty"`
	SourceField        string         `json:"source_field,omitempty"`
	Aggregations       any            `json:"aggregations,omitempty"`
}

TransformJobBase represents the base definition of a Transform job, including source/target indices, schedule, data selection query, groups, and aggregations.

type TransformPreviewJobResponse

type TransformPreviewJobResponse struct {
	Documents []map[string]any `json:"documents"`
}

TransformPreviewJobResponse represents the response from the Transform preview API, containing sample transformed documents without persisting to the target index.

type TransformPutJob

type TransformPutJob struct {
	Transform TransformJobBase `json:"transform"`
}

TransformPutJob wraps a Transform job for the PUT API request body.

type TransformPutJobRequest

type TransformPutJobRequest struct {
	JobName string            `validate:"required"`
	Body    *TransformJobBase `validate:"required"`
	Version *types.DocumentVersion
}

func (*TransformPutJobRequest) Validate

func (r *TransformPutJobRequest) Validate() error

type TransformSearchJobResponse

type TransformSearchJobResponse struct {
	TotalTransforms int64                     `json:"total_transforms"`
	Transforms      []TransformGetJobResponse `json:"transforms"`
}

TransformSearchJobResponse represents the response from the Transform search API, containing the total count and list of matching transform jobs.

type TransformService

type TransformService interface {
	GetJob(ctx context.Context, jobName string) (*TransformGetJobResponse, error)
	PutJob(ctx context.Context, req *TransformPutJobRequest) (*TransformGetJobResponse, error)
	DeleteJob(ctx context.Context, jobName string) (*TransformDeleteJobResponse, error)
	SearchJob(ctx context.Context, body any) (*TransformSearchJobResponse, error)
	ExplainJob(ctx context.Context, jobName string) (map[string]TransformExplainJob, error)
	PreviewJobResults(ctx context.Context, body any) (*TransformPreviewJobResponse, error)
	StartJob(ctx context.Context, jobName string) (*TransformStartJobResponse, error)
	StopJob(ctx context.Context, jobName string) (*TransformStopJobResponse, error)
}

func NewTransformService

func NewTransformService(client *resty.Client, logger *logrus.Entry) TransformService

type TransformStartJobResponse

type TransformStartJobResponse struct {
	Acknowledged bool `json:"acknowledged,omitempty"`
}

TransformStartJobResponse represents the response from the Transform start job API, indicating whether the start request was acknowledged.

type TransformStopJobResponse

type TransformStopJobResponse struct {
	Acknowledged bool `json:"acknowledged,omitempty"`
}

TransformStopJobResponse represents the response from the Transform stop job API, indicating whether the stop request was acknowledged.

type UpdateParams

type UpdateParams struct {
	Refresh         Refresh
	Routing         string
	Timeout         string
	RetryOnConflict *int
	Source          string
	SourceExcludes  string
	SourceIncludes  string
	IfSeqNo         *int64
	IfPrimaryTerm   *int64
	RequireAlias    bool
}

func (*UpdateParams) ToMap

func (p *UpdateParams) ToMap() map[string]string

type UpdateRequest

type UpdateRequest struct {
	Index  string `validate:"required"`
	Id     string `validate:"required"`
	Body   any
	Params *UpdateParams
}

func (*UpdateRequest) Validate

func (r *UpdateRequest) Validate() error

type UpdateResponse

type UpdateResponse struct {
	// Index is the name of the index the document was updated in.
	Index string `json:"_index,omitempty"`
	// Type is the document type (deprecated).
	Type string `json:"_type,omitempty"`
	// Id is the updated document's ID.
	Id string `json:"_id,omitempty"`
	// Version is the document version after the update.
	Version int64 `json:"_version,omitempty"`
	// Result indicates the outcome of the operation (e.g. "updated", "noop").
	Result string `json:"result,omitempty"`
	// Shards provides shard-level acknowledgment of the update.
	Shards *types.ShardsInfo `json:"_shards,omitempty"`
	// SeqNo is the sequence number assigned to this update operation.
	SeqNo int64 `json:"_seq_no,omitempty"`
	// PrimaryTerm is the primary term of the shard that processed this operation.
	PrimaryTerm int64 `json:"_primary_term,omitempty"`
	// Status is the HTTP status code returned by the server.
	Status int `json:"status,omitempty"`
	// ForcedRefresh indicates whether the index was force-refreshed as part of this operation.
	ForcedRefresh bool `json:"forced_refresh,omitempty"`
	// GetResult contains the updated document source when requested.
	GetResult *GetResult `json:"get,omitempty"`
}

UpdateResponse represents the result of an update document operation. When the update request includes "detect_noop": false or requests the updated source, the GetResult field is populated.

type VersionType

type VersionType string

VersionType controls versioning strategy for document operations. Valid values: VersionTypeInternal, VersionTypeExternal, VersionTypeExternalGte

const (
	VersionTypeInternal    VersionType = "internal"
	VersionTypeExternal    VersionType = "external"
	VersionTypeExternalGte VersionType = "external_gte"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL