elastic

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDocsResp

type CreateDocsResp struct {
	ID     string   `json:"id"`
	Errors []string `json:"errors"`
}

type DeviceDefinitionAttributeSearchDoc added in v0.3.4

type DeviceDefinitionAttributeSearchDoc struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type DeviceDefinitionSearchDoc

type DeviceDefinitionSearchDoc struct {
	ID string `json:"id"`
	// SearchDisplay M+M+Y
	SearchDisplay string                               `json:"search_display"`
	Make          string                               `json:"make"`
	Model         string                               `json:"model"`
	Year          int                                  `json:"year"`
	Type          string                               `json:"type"`
	Attributes    []DeviceDefinitionAttributeSearchDoc `json:"device_attributes"`
	// SubModels: M+M+Y+Submodel name
	SubModels []string `json:"sub_models"`
	ImageURL  string   `json:"image_url"`
	MakeSlug  string   `json:"make_slug"`
	ModelSlug string   `json:"model_slug"`
}

DeviceDefinitionSearchDoc used for elastic search document indexing. entirely for searching, source of truth is DB. elastic only supports lowercase letters, number and underscores, ie. snake_case

type EngineDetail

type EngineDetail struct {
	Name          string   `json:"name"`
	Language      *string  `json:"language,omitempty"`
	Type          *string  `json:"type,omitempty"`
	DocumentCount *int     `json:"document_count,omitempty"`
	SourceEngines []string `json:"source_engines,omitempty"`
}

EngineDetail can be used as a response when listing engines, or to create an engine. The minimum parameters are Name. Type and Source can be used when dealing with Meta Engines: https://www.elastic.co/guide/en/app-search/current/meta-engines.html

type GetEnginesResp

type GetEnginesResp struct {
	Meta struct {
		Page struct {
			Current      int `json:"current"`
			TotalPages   int `json:"total_pages"`
			TotalResults int `json:"total_results"`
			Size         int `json:"size"`
		} `json:"page"`
	} `json:"meta"`
	Results []EngineDetail `json:"results"`
}

type SearchService

type SearchService interface {
	LoadDeviceDefinitions() error
	GetEngines() (*GetEnginesResp, error)
	CreateEngine(name string, metaSource *string) (*EngineDetail, error)
	AddSourceEngineToMetaEngine(sourceName, metaName string) (*EngineDetail, error)
	RemoveSourceEngine(sourceName, metaName string) (*EngineDetail, error)
	DeleteEngine(name string) error
	CreateDocuments(docs []DeviceDefinitionSearchDoc, engineName string) ([]CreateDocsResp, error)
	CreateDocumentsBatched(docs []DeviceDefinitionSearchDoc, engineName string) error
	UpdateSearchSettingsForDeviceDefs(engineName string) error
	GetMetaEngineName() string
}

func NewElasticAppSearchService

func NewElasticAppSearchService(settings *config.Settings, logger zerolog.Logger) (SearchService, error)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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