indexers

package
v9.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactIndexer

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

ContactIndexer is an indexer for contacts

func NewContactIndexer

func NewContactIndexer(elasticURL, name string, shards, replicas, batchSize int) *ContactIndexer

NewContactIndexer creates a new contact indexer

func (*ContactIndexer) FindIndexes

func (i *ContactIndexer) FindIndexes() []string

FindIndexes finds all our physical indexes

func (*ContactIndexer) GetDBLastModified added in v9.1.1

func (i *ContactIndexer) GetDBLastModified(ctx context.Context, db *sql.DB) (time.Time, error)

func (*ContactIndexer) GetESLastModified added in v9.1.1

func (i *ContactIndexer) GetESLastModified(index string) (time.Time, error)

GetESLastModified queries a concrete index and finds the last modified document, returning its modified time

func (*ContactIndexer) Index

func (i *ContactIndexer) Index(rt *runtime.Runtime, rebuild, cleanup bool) (string, error)

Index indexes modified contacts and returns the name of the concrete index

func (*ContactIndexer) Name

func (i *ContactIndexer) Name() string

func (*ContactIndexer) Stats

func (i *ContactIndexer) Stats() Stats

type IndexDefinition

type IndexDefinition struct {
	Settings struct {
		Index struct {
			NumberOfShards       int `json:"number_of_shards"`
			NumberOfReplicas     int `json:"number_of_replicas"`
			RoutingPartitionSize int `json:"routing_partition_size"`
		} `json:"index"`
		Analysis json.RawMessage `json:"analysis"`
	} `json:"settings"`
	Mappings json.RawMessage `json:"mappings"`
}

IndexDefinition is what we pass to elastic to create an index, see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

type Indexer

type Indexer interface {
	Name() string
	Index(rt *runtime.Runtime, rebuild, cleanup bool) (string, error)
	Stats() Stats

	GetESLastModified(index string) (time.Time, error)
	GetDBLastModified(ctx context.Context, db *sql.DB) (time.Time, error)
}

Indexer is base interface for indexers

type Stats

type Stats struct {
	Indexed int64         // total number of documents indexed
	Deleted int64         // total number of documents deleted
	Elapsed time.Duration // total time spent actually indexing (excludes poll delay)
}

Jump to

Keyboard shortcuts

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