elastic

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	Filter   Filter                      `json:"filter,omitempty"`
	Analyzer map[string]AnalyzerSettings `json:"analyzer,omitempty"`
}

type AnalyzerSettings

type AnalyzerSettings struct {
	Type      string   `json:"type,omitempty"`
	Tokenizer string   `json:"tokenizer,omitempty"`
	Filter    []string `json:"filter,omitempty"`
}

type Config

type Config struct {
	IndexName           string        `` /* 131-byte string literal not displayed */
	FlushBytes          int           `` /* 137-byte string literal not displayed */
	FlushInterval       time.Duration `` /* 140-byte string literal not displayed */
	NumWorkers          int           `` /* 133-byte string literal not displayed */
	Password            string        `` /* 162-byte string literal not displayed */
	Username            string        `` /* 162-byte string literal not displayed */
	Addresses           []string      `` /* 131-byte string literal not displayed */
	CACert              []byte        `` /* 162-byte string literal not displayed */
	DisableRetry        bool          `` /* 134-byte string literal not displayed */
	MaxRetries          int           `` /* 137-byte string literal not displayed */
	CompressRequestBody bool          `` /* 134-byte string literal not displayed */
}

type ElasticError

type ElasticError struct {
	Data   map[string]any
	Err    error
	Status int
	Reason string
}

func (*ElasticError) Error

func (j *ElasticError) Error() string

func (*ElasticError) Unwrap

func (j *ElasticError) Unwrap() error

type FieldSetting

type FieldSetting struct {
	Type     string `json:"type,omitempty"`
	Analyzer string `json:"analyzer,omitempty"`
}

type Filter

type Filter struct {
	MyStop Stop `json:"my_stop,omitempty"`
}

type Index

type Index struct {
	NumberOfReplicas int    `json:"number_of_replicas,omitempty"`
	RefreshInterval  int    `json:"refresh_interval,omitempty"`
	Codec            string `json:"codec,omitempty"`
}

type IndexSettings

type IndexSettings struct {
	Settings Settings `json:"settings,omitempty"`
	Mappings Mappings `json:"mappings,omitempty"`
}

func DefaultSettings

func DefaultSettings(modifiers ...func(*IndexSettings)) IndexSettings

type Indexer

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

func New

func New(config Config, log *zap.SugaredLogger, options ...Option) (*Indexer, error)

func (*Indexer) CreateIndex

func (i *Indexer) CreateIndex(ctx context.Context, indexName string, settings IndexSettings) error

func (*Indexer) DeleteIndex

func (i *Indexer) DeleteIndex(ctx context.Context, indexName string) error

func (*Indexer) IndexPublications

func (i *Indexer) IndexPublications(
	ctx context.Context,
	data chan crossrefindexer.SimplifiedPublication,
) error

IndexPublications is responsible for consuming all the publications sent on `data` and then close the indexer when the channel is closed

type Mappings

type Mappings struct {
	Properties map[string]FieldSetting `json:"properties,omitempty"`
}

type Option

type Option func(*Indexer)

func WithTransport

func WithTransport(rt http.RoundTripper) Option

Add custom transport. TODO: Maybe move this to config?

type Settings

type Settings struct {
	Index    Index    `json:"index,omitempty"`
	Analysis Analysis `json:"analysis,omitempty"`
}

type Stop

type Stop struct {
	Type      string `json:"type,omitempty"`
	Stopwords string `json:"stopwords,omitempty"`
}

Jump to

Keyboard shortcuts

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