clients

package
v0.0.0-...-807eb99 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilterHostsWithLucene = ""

Functions

This section is empty.

Types

type EsAggByHost

type EsAggByHost struct {
	Composite EsAggComposite `json:"composite"`
}

type EsAggComposite

type EsAggComposite struct {
	Size    int           `json:"size"`
	Sources []interface{} `json:"sources"`
	After   interface{}   `json:"after,omitempty"`
}

type EsAggTerm

type EsAggTerm struct {
	Term EsAggTermField `json:"terms"`
}

type EsAggTermField

type EsAggTermField struct {
	Field string `json:"field"`
}

type EsAggregation

type EsAggregation struct {
	AfterKey *EsAggregationKey     `json:"after_key,omitempty"`
	Buckets  []EsAggregationBucket `json:"buckets"`
}

type EsAggregationBucket

type EsAggregationBucket struct {
	Key       EsAggregationKey `json:"key"`
	DocsCount int              `json:"doc_count"`
}

type EsAggregationByHost

type EsAggregationByHost struct {
	Aggregation EsAggregation `json:"_by_host"`
}

type EsAggregationKey

type EsAggregationKey struct {
	Host      string  `json:"host"`
	HostGroup *string `json:"host_group,omitempty"`
}

type EsAggs

type EsAggs struct {
	Agg EsAggByHost `json:"_by_host"`
}

func BuildAggregationsByHostNameAndHostGroup

func BuildAggregationsByHostNameAndHostGroup(hostNameField string, hostGroupField *string) *EsAggs

type EsClient

type EsClient struct {
	Addresses []string // A list of Elasticsearch nodes to use
	Username  string   // Username for HTTP Basic Authentication
	Password  string   // Password for HTTP Basic Authentication
	// contains filtered or unexported fields
}

func (EsClient) CountHits

func (esClient EsClient) CountHits(hostField string, indexes []string, query *EsQuery) (map[string]int, error)

func (EsClient) CountHitsForHost

func (esClient EsClient) CountHitsForHost(hostName string, hostNameField string, indexes []string, query *EsQuery) (int, error)

func (*EsClient) GetHosts

func (esClient *EsClient) GetHosts(hostField string, hostGroupField *string) ([]EsAggregationKey, error)

func (*EsClient) InitClient

func (esClient *EsClient) InitClient() error

func (EsClient) IsAggregatable

func (esClient EsClient) IsAggregatable(fieldNames []string, indexes []string) (map[string]bool, error)

type EsFieldCapsResponse

type EsFieldCapsResponse struct {
	Fields map[string]interface{} `json:"fields"`
}

type EsHostAggSource

type EsHostAggSource struct {
	HostTerm EsAggTerm `json:"host"`
}

type EsHostGroupAggSource

type EsHostGroupAggSource struct {
	HostGroupTerm EsAggTerm `json:"host_group"`
}

type EsQuery

type EsQuery struct {
	Bool *EsQueryBool `json:"bool,omitempty"`
	Str  *EsQueryStr  `json:"query_string,omitempty"`
}

func BuildEsQuery

func BuildEsQuery(storedQuery KSavedObject) EsQuery

= buildEsQuery method in /kibana/src/plugins/data/common/es_query/es_query/build_es_query.ts

type EsQueryBool

type EsQueryBool struct {
	Must    []interface{} `json:"must"`
	Filter  []interface{} `json:"filter"`
	Should  []interface{} `json:"should"`
	MustNot []interface{} `json:"must_not"`
}

type EsQueryStr

type EsQueryStr struct {
	Query           string `json:"query"`
	AnalyzeWildcard bool   `json:"analyze_wildcard"`
}

type EsSearchBody

type EsSearchBody struct {
	Query *EsQuery `json:"query,omitempty"`
	Aggs  *EsAggs  `json:"aggs,omitempty"`
}

type EsSearchHits

type EsSearchHits struct {
	Total EsSearchHitsTotal `json:"total"`
}

type EsSearchHitsTotal

type EsSearchHitsTotal struct {
	Value int `json:"value"`
}

type EsSearchResponse

type EsSearchResponse struct {
	Hits         EsSearchHits        `json:"hits"`
	Aggregations EsAggregationByHost `json:"aggregations,omitempty"`
}

type KAttributes

type KAttributes struct {
	Title       string       `json:"title"`
	Description string       `json:"description"`
	Filters     []KFilter    `json:"filters,omitempty"`
	TimeFilter  *KTimeFilter `json:"timefilter,omitempty"`

	Query *struct {
		Language string `json:"language"`
		Query    string `json:"query"`
	} `json:"query,omitempty"`
}

type KBulkGetSORequestItem

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

type KBulkGetSOResponse

type KBulkGetSOResponse struct {
	SavedObjects []struct {
		KBulkGetSORequestItem
		Attributes *KAttributes `json:"attributes,omitempty"`
		Error      *KError      `json:"error,omitempty"`
	} `json:"saved_objects"`
}

type KBulkResolveSOResponse

type KBulkResolveSOResponse struct {
	ResolvedObjects []struct {
		SavedObject struct {
			KBulkGetSORequestItem
			Attributes *KAttributes `json:"attributes,omitempty"`
			Error      *KError      `json:"error,omitempty"`
		} `json:"saved_object"`
		Outcome string `json:"outcome"`
	} `json:"resolved_objects"`
}

type KError

type KError struct {
	Error   string `json:"error"`
	Message string `json:"message"`
	Status  int    `json:"statusCode"`
}

type KFilter

type KFilter struct {
	Meta   *KMeta      `json:"meta,omitempty"`
	Query  interface{} `json:"query,omitempty"`
	Exists interface{} `json:"exists,omitempty"`
	Range  interface{} `json:"range,omitempty"`
}

type KMeta

type KMeta struct {
	Index    *string `json:"index,omitempty"`
	Negate   *bool   `json:"negate,omitempty"`
	Disabled *bool   `json:"disabled,omitempty"`
	Type     *string `json:"type,omitempty"`
}

type KSavedObject

type KSavedObject struct {
	Type       string       `json:"type"`
	ID         string       `json:"id"`
	Attributes *KAttributes `json:"attributes,omitempty"`
}

func (*KSavedObject) ExtractIndexIds

func (storedQuery *KSavedObject) ExtractIndexIds() []string

Extracts indexes's ids linked to stored query's filters

type KSavedObjectsResponse

type KSavedObjectsResponse struct {
	Page         int            `json:"page"`
	PerPage      int            `json:"per_page"`
	Total        int            `json:"total"`
	SavedObjects []KSavedObject `json:"saved_objects"`
}

type KTimeFilter

type KTimeFilter struct {
	From     string `json:"from"`
	To       string `json:"to"`
	Override *bool  `json:"override,omitempty"`
}

func (*KTimeFilter) ToTimeInterval

func (timeFilter *KTimeFilter) ToTimeInterval() *transit.TimeInterval

ToTimeInterval converts timeFilter's from/to values to Time in local time zone and returns TimeInterval with appropriate StartTime/EndTime

type KibanaClient

type KibanaClient struct {
	APIRoot  string
	Username string
	Password string
	// contains filtered or unexported fields
}

func (*KibanaClient) BulkGetSO

func (client *KibanaClient) BulkGetSO(savedObjectType KibanaSavedObjectType, ids []string) []KSavedObject

BulkGetSO performs bulk get of saved objects for provided type and ids

func (*KibanaClient) BulkResolveSO

func (client *KibanaClient) BulkResolveSO(savedObjectType KibanaSavedObjectType, ids []string) []KSavedObject

BulkResolveSO performs bulk resolve of saved objects for provided type and ids

func (*KibanaClient) FindSO

func (client *KibanaClient) FindSO(savedObjectType KibanaSavedObjectType, searchField KibanaSavedObjectSearchField, searchValues []string) []KSavedObject

FindSO finds saved objects of provided type and searchField matching searchValues if both searchField and searchValue set

func (*KibanaClient) GetDefaultIndexID

func (client *KibanaClient) GetDefaultIndexID() string

func (*KibanaClient) InitClient

func (client *KibanaClient) InitClient() error

func (*KibanaClient) RetrieveIndexTitles

func (client *KibanaClient) RetrieveIndexTitles(storedQuery KSavedObject) []string

RetrieveIndexTitles extracts index patterns titles associated with provided stored query

func (*KibanaClient) RetrieveStoredQueries

func (client *KibanaClient) RetrieveStoredQueries(titles []string) []KSavedObject

Extracts stored queries with provided titles If no titles provided extracts all stored queries

type KibanaSavedObjectSearchField

type KibanaSavedObjectSearchField string
const (
	Title KibanaSavedObjectSearchField = "title"
)

type KibanaSavedObjectType

type KibanaSavedObjectType string
const (
	StoredQuery  KibanaSavedObjectType = "query"
	IndexPattern KibanaSavedObjectType = "index-pattern"
)

type Timestamp

type Timestamp struct {
	From string `json:"gte"`
	To   string `json:"lt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL