elasticsearch

package
v0.0.0-...-a2d9e6c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is structure of ES client for XO

func New

func New(options ...Option) (*Client, error)

New would create ES Client

func (*Client) CreateUpdateIndex

func (c *Client) CreateUpdateIndex(object *xov1alpha1.ElasticSearchIndex) (string, error)

CreateUpdateIndex would update index if it exists or create if not

func (*Client) CreateUpdateTemplate

func (c *Client) CreateUpdateTemplate(modified *xov1alpha1.ElasticSearchTemplate) (string, error)

CreateUpdateTemplate is going to update ES template with template user provides or create a new one nolint

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(name string) error

DeleteIndex would delete ES index

func (*Client) DeleteTemplate

func (c *Client) DeleteTemplate(name string) error

DeleteTemplate would delete ES template

func (*Client) IndexExists

func (c *Client) IndexExists(name string) (bool, error)

IndexExists would check if index exists

func (*Client) TemplateExists

func (c *Client) TemplateExists(name string) (bool, error)

type ES

type ES interface {
	// Index
	IndexExists(name string) (bool, error)
	CreateUpdateIndex(index *xov1alpha1.ElasticSearchIndex) (string, error)
	DeleteIndex(indexName string) error
	// Template
	TemplateExists(name string) (bool, error)
	CreateUpdateTemplate(tmpl *xov1alpha1.ElasticSearchTemplate) (string, error)
	DeleteTemplate(tmplName string) error
}

ES is interface for ElasticSearch

type ESAlias

type ESAlias struct {
	Indices       []string    `json:"indices,omitempty"`
	Aliases       []string    `json:"aliases,omitempty"`
	Filter        interface{} `json:"filter,omitempty"`
	IsWriteIndex  bool        `json:"is_write_index,omitempty"`
	Routing       string      `json:"routing,omitempty"`
	IndexRouting  string      `json:"index_routing,omitempty"`
	SearchRouting string      `json:"search_routing,omitempty"`
}

ESAlias has struct same as xov1alpha1.ESAlias, but replaces Filter with interface

type Index

type Index struct {
	Settings Settings               `json:"settings"`
	Mappings map[string]interface{} `json:"mappings"`
}

Index is configuration struct for ES index creation

type Option

type Option func(*Client) error

Option is a type of options for Executor

func ESclient

func ESclient(es *elastic.Client) Option

ESclient is option function to set ES cluster object - mainly for mocking

func URL

func URL(esURL string) Option

URL is option function to set ES URL for Client

type Settings

type Settings struct {
	Index xov1alpha1.ESIndexSettings `json:"index"`
}

Settings is required to create ES Index

type Template

type Template struct {
	IndexPatterns []string           `json:"index_patterns"`
	Aliases       map[string]ESAlias `json:"aliases,omitempty"`
	Mappings      interface{}        `json:"mappings"`
	Settings      Settings           `json:"settings,omitempty"`
	Version       int64              `json:"version,omitempty"`
}

Template is configuration struct for ES Template creation

Jump to

Keyboard shortcuts

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