Help us shape the future of Go! Take the 2026 Go Developer Survey

elastic

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 10 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 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"`
	// SubModels: M+M+Y+Submodel name
	SubModels []string `json:"sub_models"`
	ImageURL  string   `json:"image_url"`
}

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 NewElasticSearchService

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

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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