elasticsearch

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse added in v0.1.4

func Parse(queryString string) ([]storage.Query, error)

func ParseQueries added in v0.1.4

func ParseQueries(queries []storage.Query) (map[string]interface{}, error)

Types

type Config added in v0.1.4

type Config struct {
	Addresses []string `env:"ES_ADDRESSES"`
	UserName  string   `env:"ES_USER"`
	Password  string   `env:"ES_PASSWORD"`
}

type ESClient

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

func NewESClient

func NewESClient(cfg elasticsearch.Config) (*ESClient, error)

func (*ESClient) Create

func (s *ESClient) Create(ctx context.Context, cluster string, obj runtime.Object) error

func (*ESClient) Delete

func (s *ESClient) Delete(ctx context.Context, cluster string, obj runtime.Object) error

func (*ESClient) Get

func (s *ESClient) Get(ctx context.Context, cluster string, obj runtime.Object) error

func (*ESClient) Search

func (s *ESClient) Search(ctx context.Context, queryStr string, patternType string) (*storage.SearchResult, error)

func (*ESClient) Update

func (s *ESClient) Update(ctx context.Context, cluster string, obj runtime.Object) error

type ESError

type ESError struct {
	StatusCode int
	Message    string
}

ESError is an error type which represents a single ES error

func (*ESError) Error

func (e *ESError) Error() string

type Hit

type Hit struct {
	Index  string            `json:"_index"`
	ID     string            `json:"_id"`
	Score  float32           `json:"_score"`
	Source *storage.Resource `json:"_source"`
}

type Hits

type Hits struct {
	Total    *Total  `json:"total"`
	MaxScore float32 `json:"max_score"`
	Hits     []*Hit  `json:"hits"`
}

type SearchResponse

type SearchResponse struct {
	ScrollID string `json:"_scroll_id"`
	Took     int    `json:"took"`
	TimeOut  bool   `json:"time_out"`
	Hits     *Hits  `json:"hits"`
}

func (*SearchResponse) GetResources

func (s *SearchResponse) GetResources() []*storage.Resource

type SearchStorageGetter added in v0.1.4

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

func NewSearchStorageGetter added in v0.1.4

func NewSearchStorageGetter(addresses []string, userName, password string) *SearchStorageGetter

func (*SearchStorageGetter) GetSearchStorage added in v0.1.4

func (s *SearchStorageGetter) GetSearchStorage() (storage.SearchStorage, error)

type Total

type Total struct {
	Value    int    `json:"value,omitempty"`
	Relation string `json:"relation,omitempty"`
}

Jump to

Keyboard shortcuts

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