Documentation
ΒΆ
Overview ΒΆ
Package meilisearch is the official Meilisearch SDK for the Go programming language.
The meilisearch-go SDK for Go provides APIs and utilities that developers can use to build Go applications that use meilisearch service.
See the meilisearch package documentation for more information. https://www.meilisearch.com/docs/reference
Example: meili := New("http://localhost:7700", WithAPIKey("foobar")) idx := meili.Index("movies") documents := []map[string]interface{}{ {"id": 1, "title": "Carol", "genres": []string{"Romance", "Drama"}}, {"id": 2, "title": "Wonder Woman", "genres": []string{"Action", "Adventure"}}, {"id": 3, "title": "Life of Pi", "genres": []string{"Adventure", "Drama"}}, {"id": 4, "title": "Mad Max: Fury Road", "genres": []string{"Adventure", "Science Fiction"}}, {"id": 5, "title": "Moana", "genres": []string{"Fantasy", "Action"}}, {"id": 6, "title": "Philadelphia", "genres": []string{"Drama"}}, } task, err := idx.AddDocuments(documents, nil) if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(task.TaskUID)
Index ΒΆ
- Constants
- Variables
- func BoolPtr(v bool) *bool
- func FloatPtr(v float64) *float64
- func GetQualifiedVersion() (qualifiedVersion string)
- func Int64Ptr(v int64) *int64
- func IntPtr(v int) *int
- func IsValidUUID(uuid string) bool
- func RegisterDecoder(contentType string, decoder func(io.ReadCloser) Decoder)
- func StringPtr(v string) *string
- func TimePtr(v time.Time) *time.Time
- func VersionErrorHintMessage(err error, req *internalRequest) error
- type AddWebhookRequest
- type AttributeFeatures
- type AttributeRule
- type Batch
- type BatchProgress
- type BatchProgressStep
- type BatchStats
- type BatchStatsInternalDatabaseSize
- type BatchStatsWriteChannelCongestion
- type BatchesQuery
- type BatchesResults
- type CancelTasksQuery
- type Chat
- type ChatCompletionChoice
- type ChatCompletionChoiceDelta
- type ChatCompletionMessage
- type ChatCompletionQuery
- type ChatCompletionStreamChunk
- type ChatManager
- type ChatReader
- type ChatRole
- type ChatSource
- type ChatWorkspace
- type ChatWorkspaceSettings
- type ChatWorkspaceSettingsPrompts
- type ContentEncoding
- type CreateIndexRequest
- type CsvDocumentsQuery
- type Decoder
- type DeleteTasksQuery
- type Details
- type Distribution
- type DocumentManager
- type DocumentQuery
- type DocumentReader
- type DocumentsQuery
- type DocumentsResult
- type Embedder
- type EmbedderPooling
- type EmbedderSource
- type EncodingCompressionLevel
- type ErrCode
- type Error
- type Event
- type ExperimentalFeatures
- func (ef *ExperimentalFeatures) Get() (*ExperimentalFeaturesResult, error)
- func (ef *ExperimentalFeatures) GetWithContext(ctx context.Context) (*ExperimentalFeaturesResult, error)
- func (ef *ExperimentalFeatures) SetChatCompletions(enable bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetCompositeEmbedders(enable bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetContainsFilter(containsFilter bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetEditDocumentsByFunction(editDocumentsByFunction bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetLogsRoute(logsRoute bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetMetrics(metrics bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetMultiModal(enable bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) SetNetwork(enable bool) *ExperimentalFeatures
- func (ef *ExperimentalFeatures) Update() (*ExperimentalFeaturesResult, error)
- func (ef *ExperimentalFeatures) UpdateWithContext(ctx context.Context) (*ExperimentalFeaturesResult, error)
- type ExperimentalFeaturesBase
- type ExperimentalFeaturesResult
- type ExportParams
- type FacetSearchRequest
- type FacetSearchResponse
- type Faceting
- type FilterFeatures
- type Fragment
- type Health
- type Hit
- type Hits
- type IndexConfig
- type IndexExportOptions
- type IndexManager
- type IndexReader
- type IndexResult
- type IndexesQuery
- type IndexesResults
- type JSONMarshal
- type JSONUnmarshal
- type Key
- type KeyManager
- type KeyParsed
- type KeyReader
- type KeyUpdate
- type KeysQuery
- type KeysResults
- type ListChatWorkSpaceQuery
- type ListChatWorkspace
- type LocalizedAttributes
- type MatchingStrategy
- type MinWordSizeForTypos
- type MultiSearchFederation
- type MultiSearchFederationMergeFacets
- type MultiSearchRequest
- type MultiSearchResponse
- type Network
- type Opt
- type Option
- func DisableRetries() Option
- func WithAPIKey(key string) Option
- func WithContentEncoding(encodingType ContentEncoding, level EncodingCompressionLevel) Option
- func WithCustomClient(client *http.Client) Option
- func WithCustomClientWithTLS(tlsConfig *tls.Config) Option
- func WithCustomDialContext(dial func(ctx context.Context, network, addr string) (net.Conn, error)) Option
- func WithCustomExpectContinueTimeout(timeout time.Duration) Option
- func WithCustomIdleConnTimeout(timeout time.Duration) Option
- func WithCustomJsonMarshaler(marshal JSONMarshal) Option
- func WithCustomJsonUnmarshaler(unmarshal JSONUnmarshal) Option
- func WithCustomMaxIdleConns(maxIdleConns int) Option
- func WithCustomMaxIdleConnsPerHost(maxIdleConnsPerHost int) Option
- func WithCustomProxy(proxy func(*http.Request) (*url.URL, error)) Option
- func WithCustomRetries(retryOnStatus []int, maxRetries uint8) Option
- func WithCustomTLSHandshakeTimeout(timeout time.Duration) Option
- type Origin
- type Pagination
- type ProximityPrecisionType
- type Remote
- type RemoteError
- type SearchFederationOptions
- type SearchParameters
- type SearchReader
- type SearchRequest
- type SearchRequestHybrid
- type SearchResponse
- type ServiceManager
- type ServiceReader
- type Settings
- type SettingsManager
- type SettingsReader
- type SimilarDocumentQuery
- type SimilarDocumentResult
- type SortFacetType
- type Stats
- type StatsIndex
- type Stream
- type SwapIndexesParams
- type Task
- type TaskInfo
- type TaskManager
- type TaskNetwork
- type TaskReader
- type TaskRemote
- type TaskResult
- type TaskStatus
- type TaskType
- type TasksQuery
- type TenantTokenClaims
- type TenantTokenOptions
- type Timestampz
- type TypoTolerance
- type UpdateDocumentByFunctionRequest
- type UpdateIndexRequestParams
- type UpdateWebhookRequest
- type Version
- type Webhook
- type WebhookManager
- type WebhookReader
- type WebhookResults
Examples ΒΆ
Constants ΒΆ
const ( GzipEncoding ContentEncoding = "gzip" DeflateEncoding ContentEncoding = "deflate" BrotliEncoding ContentEncoding = "br" NoCompression EncodingCompressionLevel = 0 BestSpeed EncodingCompressionLevel = 1 BestCompression EncodingCompressionLevel = 9 DefaultCompression EncodingCompressionLevel = -1 HuffmanOnlyCompression EncodingCompressionLevel = -2 ConstantCompression EncodingCompressionLevel = -2 StatelessCompression EncodingCompressionLevel = -3 )
const VERSION = "0.34.0"
Variables ΒΆ
var ( ErrInvalidRequestMethod = errors.New("request body is not expected for GET and HEAD requests") ErrRequestBodyWithoutContentType = errors.New("request body without Content-Type is not allowed") ErrNoSearchRequest = errors.New("no search request provided") ErrNoFacetSearchRequest = errors.New("no search facet request provided") ErrConnectingFailed = errors.New("meilisearch is not connected") ErrMeilisearchNotAvailable = errors.New("meilisearch service is not available") )
General errors
Functions ΒΆ
func GetQualifiedVersion ΒΆ added in v0.19.1
func GetQualifiedVersion() (qualifiedVersion string)
func IsValidUUID ΒΆ added in v0.20.0
func RegisterDecoder ΒΆ added in v0.33.1
func RegisterDecoder(contentType string, decoder func(io.ReadCloser) Decoder)
func VersionErrorHintMessage ΒΆ added in v0.25.0
VersionErrorHintMessage a hint to the error message if it may come from a version incompatibility with meilisearch
Types ΒΆ
type AddWebhookRequest ΒΆ added in v0.33.1
type AttributeFeatures ΒΆ added in v0.33.0
type AttributeFeatures struct { FacetSearch bool `json:"facetSearch"` Filter FilterFeatures `json:"filter"` }
type AttributeRule ΒΆ added in v0.33.0
type AttributeRule struct { AttributePatterns []string `json:"attributePatterns"` Features AttributeFeatures `json:"features"` }
type Batch ΒΆ added in v0.33.0
type Batch struct { UID int `json:"uid"` Progress *BatchProgress `json:"progress,omitempty"` Details map[string]interface{} `json:"details,omitempty"` Stats *BatchStats `json:"stats,omitempty"` Duration string `json:"duration,omitempty"` StartedAt time.Time `json:"startedAt,omitempty"` FinishedAt time.Time `json:"finishedAt,omitempty"` BatchStrategy string `json:"batchStrategy,omitempty"` }
Batch gives information about the progress of batch of asynchronous operations.
type BatchProgress ΒΆ added in v0.33.0
type BatchProgress struct { Steps []*BatchProgressStep `json:"steps"` Percentage float64 `json:"percentage"` }
type BatchProgressStep ΒΆ added in v0.33.0
type BatchStats ΒΆ added in v0.33.0
type BatchStats struct { TotalNbTasks int `json:"totalNbTasks"` Status map[string]int `json:"status"` Types map[string]int `json:"types"` IndexedUIDs map[string]int `json:"indexUids"` ProgressTrace map[string]string `json:"progressTrace"` WriteChannelCongestion *BatchStatsWriteChannelCongestion `json:"writeChannelCongestion"` InternalDatabaseSizes *BatchStatsInternalDatabaseSize `json:"internalDatabaseSizes"` }
type BatchStatsInternalDatabaseSize ΒΆ added in v0.33.0
type BatchStatsInternalDatabaseSize struct { ExternalDocumentsIDs string `json:"externalDocumentsIds"` WordDocIDs string `json:"wordDocids"` WordPairProximityDocIDs string `json:"wordPairProximityDocids"` WordPositionDocIDs string `json:"wordPositionDocids"` WordFidDocIDs string `json:"wordFidDocids"` FieldIdWordCountDocIDs string `json:"fieldIdWordCountDocids"` Documents string `json:"documents"` }
type BatchStatsWriteChannelCongestion ΒΆ added in v0.33.0
type BatchesQuery ΒΆ added in v0.33.0
type BatchesQuery struct { UIDs []int64 BatchUIDs []int64 IndexUIDs []string Statuses []string Types []string Limit int64 From int64 Reverse bool BeforeEnqueuedAt time.Time BeforeStartedAt time.Time BeforeFinishedAt time.Time AfterEnqueuedAt time.Time AfterStartedAt time.Time AfterFinishedAt time.Time }
BatchesQuery represents the query parameters for listing batches.
type BatchesResults ΒΆ added in v0.33.0
type CancelTasksQuery ΒΆ added in v0.22.0
type CancelTasksQuery struct { UIDS []int64 IndexUIDS []string Statuses []TaskStatus Types []TaskType BeforeEnqueuedAt time.Time AfterEnqueuedAt time.Time BeforeStartedAt time.Time AfterStartedAt time.Time }
CancelTasksQuery is a list of filter available to send as query parameters
type Chat ΒΆ added in v0.33.1
type Chat struct { Description string `json:"description,omitempty"` DocumentTemplate string `json:"documentTemplate,omitempty"` DocumentTemplateMaxBytes int `json:"documentTemplateMaxBytes,omitempty"` SearchParameters *SearchParameters `json:"searchParameters,omitempty"` }
type ChatCompletionChoice ΒΆ added in v0.33.1
type ChatCompletionChoice struct { Index int64 `json:"index"` Delta *ChatCompletionChoiceDelta `json:"delta"` FinishReason *string `json:"finish_reason,omitempty"` Logprobs any `json:"logprobs"` }
type ChatCompletionChoiceDelta ΒΆ added in v0.33.1
type ChatCompletionMessage ΒΆ added in v0.33.1
type ChatCompletionQuery ΒΆ added in v0.33.1
type ChatCompletionQuery struct { Model string `json:"model"` Messages []*ChatCompletionMessage `json:"messages"` Stream bool `json:"stream"` }
type ChatCompletionStreamChunk ΒΆ added in v0.33.1
type ChatCompletionStreamChunk struct { ID string `json:"id"` Object *string `json:"object,omitempty"` Created Timestampz `json:"created,omitempty"` Model string `json:"model,omitempty"` Choices []*ChatCompletionChoice `json:"choices"` ServiceTier *string `json:"service_tier,omitempty"` SystemFingerprint *string `json:"system_fingerprint,omitempty"` Usage any `json:"usage,omitempty"` }
type ChatManager ΒΆ added in v0.33.1
type ChatManager interface { ChatReader // UpdateChatWorkspace updates a chat workspace by its ID. UpdateChatWorkspace(uid string, settings *ChatWorkspaceSettings) (*ChatWorkspaceSettings, error) // UpdateChatWorkspaceWithContext updates a chat workspace by its ID with a context. UpdateChatWorkspaceWithContext(ctx context.Context, uid string, settings *ChatWorkspaceSettings) (*ChatWorkspaceSettings, error) // ResetChatWorkspace resets a chat workspace by its ID. ResetChatWorkspace(uid string) (*ChatWorkspaceSettings, error) // ResetChatWorkspaceWithContext resets a chat workspace by its ID with a context. ResetChatWorkspaceWithContext(ctx context.Context, uid string) (*ChatWorkspaceSettings, error) }
type ChatReader ΒΆ added in v0.33.1
type ChatReader interface { // ChatCompletionStream retrieves a stream of chat completions for a given workspace and query. ChatCompletionStream(workspace string, query *ChatCompletionQuery) (*Stream[*ChatCompletionStreamChunk], error) // ChatCompletionStreamWithContext retrieves a stream of chat completions for a given workspace and query with a context. ChatCompletionStreamWithContext(ctx context.Context, workspace string, query *ChatCompletionQuery) (*Stream[*ChatCompletionStreamChunk], error) // ListChatWorkspaces retrieves all chat workspaces. ListChatWorkspaces(query *ListChatWorkSpaceQuery) (*ListChatWorkspace, error) // ListChatWorkspacesWithContext retrieves all chat workspaces with a context. ListChatWorkspacesWithContext(ctx context.Context, query *ListChatWorkSpaceQuery) (*ListChatWorkspace, error) // GetChatWorkspace retrieves a chat workspace by its ID. GetChatWorkspace(uid string) (*ChatWorkspace, error) // GetChatWorkspaceWithContext retrieves a chat workspace by its ID with a context. GetChatWorkspaceWithContext(ctx context.Context, uid string) (*ChatWorkspace, error) // GetChatWorkspaceSettings retrieves chat workspace settings by its ID. GetChatWorkspaceSettings(uid string) (*ChatWorkspaceSettings, error) // GetChatWorkspaceSettingsWithContext retrieves chat workspace settings by its ID with a context. GetChatWorkspaceSettingsWithContext(ctx context.Context, uid string) (*ChatWorkspaceSettings, error) }
type ChatRole ΒΆ added in v0.33.1
type ChatRole string
ChatRole The role of a message in a chat conversation.
type ChatSource ΒΆ added in v0.33.1
type ChatSource string
ChatSource The source corresponds to a service that generates chat completions from your messages.
const ( OpenaiChatSource ChatSource = "openAi" AzureOpenAiChatSource ChatSource = "azureOpenAi" MistralChatSource ChatSource = "mistral" GeminiChatSource ChatSource = "gemini" VLlmChatSource ChatSource = "vLlm" )
type ChatWorkspace ΒΆ added in v0.33.1
type ChatWorkspace struct {
UID string `json:"uid"`
}
type ChatWorkspaceSettings ΒΆ added in v0.33.1
type ChatWorkspaceSettings struct { Source ChatSource `json:"source"` OrgId string `json:"orgId"` ProjectId string `json:"projectId"` ApiVersion string `json:"apiVersion"` DeploymentId string `json:"deploymentId"` BaseUrl string `json:"baseUrl"` ApiKey string `json:"apiKey,omitempty"` Prompts *ChatWorkspaceSettingsPrompts `json:"prompts"` }
type ChatWorkspaceSettingsPrompts ΒΆ added in v0.33.1
type ContentEncoding ΒΆ added in v0.29.0
type ContentEncoding string
func (ContentEncoding) IsZero ΒΆ added in v0.29.0
func (c ContentEncoding) IsZero() bool
func (ContentEncoding) String ΒΆ added in v0.29.0
func (c ContentEncoding) String() string
type CreateIndexRequest ΒΆ
type CreateIndexRequest struct { UID string `json:"uid,omitempty"` PrimaryKey string `json:"primaryKey,omitempty"` }
CreateIndexRequest is the request body for create index method
type CsvDocumentsQuery ΒΆ added in v0.24.0
type Decoder ΒΆ added in v0.33.1
type Decoder interface { Next() bool // advances to next event; false on EOF or error Event() Event // returns the current event Err() error // returns the terminal error (if any) Close() error // closes the underlying stream }
func NewDecoder ΒΆ added in v0.33.1
type DeleteTasksQuery ΒΆ added in v0.22.0
type DeleteTasksQuery struct { UIDS []int64 IndexUIDS []string Statuses []TaskStatus Types []TaskType CanceledBy []int64 BeforeEnqueuedAt time.Time AfterEnqueuedAt time.Time BeforeStartedAt time.Time AfterStartedAt time.Time BeforeFinishedAt time.Time AfterFinishedAt time.Time }
DeleteTasksQuery is a list of filter available to send as query parameters
type Details ΒΆ added in v0.18.0
type Details struct { ReceivedDocuments int64 `json:"receivedDocuments,omitempty"` IndexedDocuments int64 `json:"indexedDocuments,omitempty"` DeletedDocuments int64 `json:"deletedDocuments,omitempty"` PrimaryKey string `json:"primaryKey,omitempty"` ProvidedIds int64 `json:"providedIds,omitempty"` RankingRules []string `json:"rankingRules,omitempty"` DistinctAttribute *string `json:"distinctAttribute,omitempty"` SearchableAttributes []string `json:"searchableAttributes,omitempty"` DisplayedAttributes []string `json:"displayedAttributes,omitempty"` StopWords []string `json:"stopWords,omitempty"` Synonyms map[string][]string `json:"synonyms,omitempty"` FilterableAttributes []interface{} `json:"filterableAttributes,omitempty"` SortableAttributes []string `json:"sortableAttributes,omitempty"` TypoTolerance *TypoTolerance `json:"typoTolerance,omitempty"` Pagination *Pagination `json:"pagination,omitempty"` Faceting *Faceting `json:"faceting,omitempty"` MatchedTasks int64 `json:"matchedTasks,omitempty"` CanceledTasks int64 `json:"canceledTasks,omitempty"` DeletedTasks int64 `json:"deletedTasks,omitempty"` OriginalFilter string `json:"originalFilter,omitempty"` Swaps []SwapIndexesParams `json:"swaps,omitempty"` DumpUid string `json:"dumpUid,omitempty"` }
type Distribution ΒΆ added in v0.30.0
type Distribution struct { Mean float64 `json:"mean"` // Mean of the distribution Sigma float64 `json:"sigma"` // Sigma (standard deviation) of the distribution }
Distribution represents a statistical distribution with mean and standard deviation (sigma).
type DocumentManager ΒΆ added in v0.30.0
type DocumentManager interface { DocumentReader // AddDocuments adds multiple documents to the index. AddDocuments(documentsPtr interface{}, primaryKey *string) (*TaskInfo, error) // AddDocumentsWithContext adds multiple documents to the index using the provided context for cancellation. AddDocumentsWithContext(ctx context.Context, documentsPtr interface{}, primaryKey *string) (*TaskInfo, error) // AddDocumentsInBatches adds documents to the index in batches of specified size. AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey *string) ([]TaskInfo, error) // AddDocumentsInBatchesWithContext adds documents to the index in batches of specified size using the provided context for cancellation. AddDocumentsInBatchesWithContext(ctx context.Context, documentsPtr interface{}, batchSize int, primaryKey *string) ([]TaskInfo, error) // AddDocumentsCsv adds documents from a CSV byte array to the index. AddDocumentsCsv(documents []byte, options *CsvDocumentsQuery) (*TaskInfo, error) // AddDocumentsCsvWithContext adds documents from a CSV byte array to the index using the provided context for cancellation. AddDocumentsCsvWithContext(ctx context.Context, documents []byte, options *CsvDocumentsQuery) (*TaskInfo, error) // AddDocumentsCsvInBatches adds documents from a CSV byte array to the index in batches of specified size. AddDocumentsCsvInBatches(documents []byte, batchSize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // AddDocumentsCsvInBatchesWithContext adds documents from a CSV byte array to the index in batches of specified size using the provided context for cancellation. AddDocumentsCsvInBatchesWithContext(ctx context.Context, documents []byte, batchSize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // AddDocumentsCsvFromReaderInBatches adds documents from a CSV reader to the index in batches of specified size. AddDocumentsCsvFromReaderInBatches(documents io.Reader, batchSize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // AddDocumentsCsvFromReaderInBatchesWithContext adds documents from a CSV reader to the index in batches of specified size using the provided context for cancellation. AddDocumentsCsvFromReaderInBatchesWithContext(ctx context.Context, documents io.Reader, batchSize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // AddDocumentsCsvFromReader adds documents from a CSV reader to the index. AddDocumentsCsvFromReader(documents io.Reader, options *CsvDocumentsQuery) (*TaskInfo, error) // AddDocumentsCsvFromReaderWithContext adds documents from a CSV reader to the index using the provided context for cancellation. AddDocumentsCsvFromReaderWithContext(ctx context.Context, documents io.Reader, options *CsvDocumentsQuery) (*TaskInfo, error) // AddDocumentsNdjson adds documents from a NDJSON byte array to the index. AddDocumentsNdjson(documents []byte, primaryKey *string) (*TaskInfo, error) // AddDocumentsNdjsonWithContext adds documents from a NDJSON byte array to the index using the provided context for cancellation. AddDocumentsNdjsonWithContext(ctx context.Context, documents []byte, primaryKey *string) (*TaskInfo, error) // AddDocumentsNdjsonInBatches adds documents from a NDJSON byte array to the index in batches of specified size. AddDocumentsNdjsonInBatches(documents []byte, batchSize int, primaryKey *string) ([]TaskInfo, error) // AddDocumentsNdjsonInBatchesWithContext adds documents from a NDJSON byte array to the index in batches of specified size using the provided context for cancellation. AddDocumentsNdjsonInBatchesWithContext(ctx context.Context, documents []byte, batchSize int, primaryKey *string) ([]TaskInfo, error) // AddDocumentsNdjsonFromReader adds documents from a NDJSON reader to the index. AddDocumentsNdjsonFromReader(documents io.Reader, primaryKey *string) (*TaskInfo, error) // AddDocumentsNdjsonFromReaderWithContext adds documents from a NDJSON reader to the index using the provided context for cancellation. AddDocumentsNdjsonFromReaderWithContext(ctx context.Context, documents io.Reader, primaryKey *string) (*TaskInfo, error) // AddDocumentsNdjsonFromReaderInBatches adds documents from a NDJSON reader to the index in batches of specified size. AddDocumentsNdjsonFromReaderInBatches(documents io.Reader, batchSize int, primaryKey *string) ([]TaskInfo, error) // AddDocumentsNdjsonFromReaderInBatchesWithContext adds documents from a NDJSON reader to the index in batches of specified size using the provided context for cancellation. AddDocumentsNdjsonFromReaderInBatchesWithContext(ctx context.Context, documents io.Reader, batchSize int, primaryKey *string) ([]TaskInfo, error) // UpdateDocuments updates multiple documents in the index. UpdateDocuments(documentsPtr interface{}, primaryKey *string) (*TaskInfo, error) // UpdateDocumentsWithContext updates multiple documents in the index using the provided context for cancellation. UpdateDocumentsWithContext(ctx context.Context, documentsPtr interface{}, primaryKey *string) (*TaskInfo, error) // UpdateDocumentsInBatches updates documents in the index in batches of specified size. UpdateDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey *string) ([]TaskInfo, error) // UpdateDocumentsInBatchesWithContext updates documents in the index in batches of specified size using the provided context for cancellation. UpdateDocumentsInBatchesWithContext(ctx context.Context, documentsPtr interface{}, batchSize int, primaryKey *string) ([]TaskInfo, error) // UpdateDocumentsCsv updates documents in the index from a CSV byte array. UpdateDocumentsCsv(documents []byte, options *CsvDocumentsQuery) (*TaskInfo, error) // UpdateDocumentsCsvWithContext updates documents in the index from a CSV byte array using the provided context for cancellation. UpdateDocumentsCsvWithContext(ctx context.Context, documents []byte, options *CsvDocumentsQuery) (*TaskInfo, error) // UpdateDocumentsCsvInBatches updates documents in the index from a CSV byte array in batches of specified size. UpdateDocumentsCsvInBatches(documents []byte, batchsize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // UpdateDocumentsCsvInBatchesWithContext updates documents in the index from a CSV byte array in batches of specified size using the provided context for cancellation. UpdateDocumentsCsvInBatchesWithContext(ctx context.Context, documents []byte, batchsize int, options *CsvDocumentsQuery) ([]TaskInfo, error) // UpdateDocumentsNdjson updates documents in the index from a NDJSON byte array. UpdateDocumentsNdjson(documents []byte, primaryKey *string) (*TaskInfo, error) // UpdateDocumentsNdjsonWithContext updates documents in the index from a NDJSON byte array using the provided context for cancellation. UpdateDocumentsNdjsonWithContext(ctx context.Context, documents []byte, primaryKey *string) (*TaskInfo, error) // UpdateDocumentsNdjsonInBatches updates documents in the index from a NDJSON byte array in batches of specified size. UpdateDocumentsNdjsonInBatches(documents []byte, batchsize int, primaryKey *string) ([]TaskInfo, error) // UpdateDocumentsNdjsonInBatchesWithContext updates documents in the index from a NDJSON byte array in batches of specified size using the provided context for cancellation. UpdateDocumentsNdjsonInBatchesWithContext(ctx context.Context, documents []byte, batchsize int, primaryKey *string) ([]TaskInfo, error) // UpdateDocumentsByFunction update documents by using function UpdateDocumentsByFunction(req *UpdateDocumentByFunctionRequest) (*TaskInfo, error) // UpdateDocumentsByFunctionWithContext update documents by using function then provided context for cancellation. UpdateDocumentsByFunctionWithContext(ctx context.Context, req *UpdateDocumentByFunctionRequest) (*TaskInfo, error) // DeleteDocument deletes a single document from the index by identifier. DeleteDocument(identifier string) (*TaskInfo, error) // DeleteDocumentWithContext deletes a single document from the index by identifier using the provided context for cancellation. DeleteDocumentWithContext(ctx context.Context, identifier string) (*TaskInfo, error) // DeleteDocuments deletes multiple documents from the index by identifiers. DeleteDocuments(identifiers []string) (*TaskInfo, error) // DeleteDocumentsWithContext deletes multiple documents from the index by identifiers using the provided context for cancellation. DeleteDocumentsWithContext(ctx context.Context, identifiers []string) (*TaskInfo, error) // DeleteDocumentsByFilter deletes documents from the index by filter. DeleteDocumentsByFilter(filter interface{}) (*TaskInfo, error) // DeleteDocumentsByFilterWithContext deletes documents from the index by filter using the provided context for cancellation. DeleteDocumentsByFilterWithContext(ctx context.Context, filter interface{}) (*TaskInfo, error) // DeleteAllDocuments deletes all documents from the index. DeleteAllDocuments() (*TaskInfo, error) // DeleteAllDocumentsWithContext deletes all documents from the index using the provided context for cancellation. DeleteAllDocumentsWithContext(ctx context.Context) (*TaskInfo, error) }
type DocumentQuery ΒΆ added in v0.20.0
type DocumentQuery struct { Fields []string `json:"fields,omitempty"` RetrieveVectors bool `json:"retrieveVectors,omitempty"` }
DocumentQuery is the request body get one documents method
type DocumentReader ΒΆ added in v0.30.0
type DocumentReader interface { // GetDocument retrieves a single document from the index by identifier. GetDocument(identifier string, request *DocumentQuery, documentPtr interface{}) error // GetDocumentWithContext retrieves a single document from the index by identifier using the provided context for cancellation. GetDocumentWithContext(ctx context.Context, identifier string, request *DocumentQuery, documentPtr interface{}) error // GetDocuments retrieves multiple documents from the index. GetDocuments(param *DocumentsQuery, resp *DocumentsResult) error // GetDocumentsWithContext retrieves multiple documents from the index using the provided context for cancellation. GetDocumentsWithContext(ctx context.Context, param *DocumentsQuery, resp *DocumentsResult) error }
type DocumentsQuery ΒΆ added in v0.20.0
type DocumentsQuery struct { Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` Fields []string `json:"fields,omitempty"` Filter interface{} `json:"filter,omitempty"` RetrieveVectors bool `json:"retrieveVectors,omitempty"` Ids []string `json:"ids,omitempty"` Sort []string `json:"sort,omitempty"` }
DocumentsQuery is the request body for list documents method
type DocumentsResult ΒΆ added in v0.20.0
type Embedder ΒΆ added in v0.26.3
type Embedder struct { Source EmbedderSource `json:"source"` // The type of embedder: "openAi", "huggingFace", "userProvided", "rest", "ollama" // URL Meilisearch queries url to generate vector embeddings for queries and documents. // url must point to a REST-compatible embedder. You may also use url to work with proxies, such as when targeting openAi from behind a proxy. URL string `json:"url,omitempty"` // Optional for "openAi", "rest", "ollama" APIKey string `json:"apiKey,omitempty"` // Optional for "openAi", "rest", "ollama" // Model The model your embedder uses when generating vectors. // These are the officially supported models Meilisearch supports: // // - openAi: text-embedding-3-small, text-embedding-3-large, openai-text-embedding-ada-002 // // - huggingFace: BAAI/bge-base-en-v1.5 // // Other models, such as HuggingFaceβs BERT models or those provided by Ollama and REST embedders // may also be compatible with Meilisearch. // // HuggingFaceβs BERT models: https://huggingface.co/models?other=bert Model string `json:"model,omitempty"` // Optional for "openAi", "huggingFace", "ollama" // DocumentTemplate is a string containing a Liquid template. Meillisearch interpolates the template for each // document and sends the resulting text to the embedder. The embedder then generates document vectors based on this text. DocumentTemplate string `json:"documentTemplate,omitempty"` // Optional for most embedders // DocumentTemplateMaxBytes The maximum size of a rendered document template. //Longer texts are truncated to fit the configured limit. // // documentTemplateMaxBytes must be an integer. It defaults to 400. DocumentTemplateMaxBytes int `json:"documentTemplateMaxBytes,omitempty"` Dimensions int `json:"dimensions,omitempty"` // Optional for "openAi", "rest", "userProvided", "ollama" Revision string `json:"revision,omitempty"` // Optional for "huggingFace" Distribution *Distribution `json:"distribution,omitempty"` // Optional for all embedders Request map[string]interface{} `json:"request,omitempty"` // Optional for "rest" Response map[string]interface{} `json:"response,omitempty"` // Optional for "rest" Headers map[string]string `json:"headers,omitempty"` // Optional for "rest" BinaryQuantized bool `json:"binaryQuantized,omitempty"` Pooling EmbedderPooling `json:"pooling,omitempty"` IndexingEmbedder *Embedder `json:"indexingEmbedder,omitempty"` // For Composite SearchEmbedder *Embedder `json:"searchEmbedder,omitempty"` // For Composite IndexingFragments map[string]Fragment `json:"indexingFragments,omitempty"` SearchFragments map[string]Fragment `json:"searchFragments,omitempty"` }
Embedder represents a unified configuration for various embedder types.
Specs: https://www.meilisearch.com/docs/reference/api/settings#body-21
type EmbedderPooling ΒΆ added in v0.33.0
type EmbedderPooling string
EmbedderPooling Configure how Meilisearch should merge individual tokens into a single embedding.
pooling is optional for embedders with the huggingFace source.
const ( // UseModelEmbedderPooling Meilisearch will fetch the pooling method from the model configuration. Default value for new embedders UseModelEmbedderPooling EmbedderPooling = "useModel" // ForceMeanEmbedderPooling always use mean pooling. Default value for embedders created in Meilisearch <=v1.13 ForceMeanEmbedderPooling EmbedderPooling = "forceMean" // ForceClsEmbedderPooling always use CLS pooling ForceClsEmbedderPooling EmbedderPooling = "forceCls" )
type EmbedderSource ΒΆ added in v0.33.0
type EmbedderSource string
EmbedderSource The source corresponds to a service that generates embeddings from your documents.
const ( OpenaiEmbedderSource EmbedderSource = "openAi" HuggingFaceEmbedderSource EmbedderSource = "huggingFace" // RestEmbedderSource rest is a generic source compatible with any embeddings provider offering a REST API. RestEmbedderSource EmbedderSource = "rest" OllamaEmbedderSource EmbedderSource = "ollama" // UserProvidedEmbedderSource Use userProvided when you want to generate embeddings manually. In this case, // you must include vector data in your documentsβ _vectors field. You must also generate //vectors for search queries. UserProvidedEmbedderSource EmbedderSource = "userProvided" // CompositeEmbedderSource Choose composite to use one embedder during indexing time, and another embedder at search time. //Must be used together with indexingEmbedder and searchEmbedder. CompositeEmbedderSource EmbedderSource = "composite" )
type EncodingCompressionLevel ΒΆ added in v0.29.0
type EncodingCompressionLevel int
func (EncodingCompressionLevel) Int ΒΆ added in v0.29.0
func (c EncodingCompressionLevel) Int() int
type ErrCode ΒΆ
type ErrCode int
ErrCode are all possible errors found during requests
const ( // ErrCodeUnknown default error code, undefined ErrCodeUnknown ErrCode = 0 // ErrCodeMarshalRequest impossible to serialize request body ErrCodeMarshalRequest ErrCode = iota + 1 // ErrCodeResponseUnmarshalBody impossible deserialize the response body ErrCodeResponseUnmarshalBody // MeilisearchApiError send by the meilisearch api MeilisearchApiError // MeilisearchApiErrorWithoutMessage MeilisearchApiError send by the meilisearch api MeilisearchApiErrorWithoutMessage // MeilisearchTimeoutError MeilisearchTimeoutError // MeilisearchCommunicationError impossible execute a request MeilisearchCommunicationError // MeilisearchMaxRetriesExceeded used max retries and exceeded MeilisearchMaxRetriesExceeded )
type Error ΒΆ
type Error struct { // Endpoint is the path of the request (host is not in) Endpoint string // Method is the HTTP verb of the request Method string // Function name used Function string // RequestToString is the raw request into string ('empty request' if not present) RequestToString string // RequestToString is the raw request into string ('empty response' if not present) ResponseToString string // Error info from meilisearch api // Message is the raw request into string ('empty meilisearch message' if not present) MeilisearchApiError meilisearchApiError // StatusCode of the request StatusCode int // StatusCode expected by the endpoint to be considered as a success StatusCodeExpected []int // OriginError is the origin error that produce the current Error. It can be nil in case of a bad status code. OriginError error // ErrCode is the internal error code that represent the different step when executing a request that can produce // an error. ErrCode ErrCode // contains filtered or unexported fields }
Error is the internal error structure that all exposed method use. So ALL errors returned by this library can be cast to this struct (as a pointer)
type ExperimentalFeatures ΒΆ added in v0.29.0
type ExperimentalFeatures struct { ExperimentalFeaturesBase // contains filtered or unexported fields }
func (*ExperimentalFeatures) Get ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) Get() (*ExperimentalFeaturesResult, error)
func (*ExperimentalFeatures) GetWithContext ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) GetWithContext(ctx context.Context) (*ExperimentalFeaturesResult, error)
func (*ExperimentalFeatures) SetChatCompletions ΒΆ added in v0.33.1
func (ef *ExperimentalFeatures) SetChatCompletions(enable bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetCompositeEmbedders ΒΆ added in v0.33.0
func (ef *ExperimentalFeatures) SetCompositeEmbedders(enable bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetContainsFilter ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) SetContainsFilter(containsFilter bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetEditDocumentsByFunction ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) SetEditDocumentsByFunction(editDocumentsByFunction bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetLogsRoute ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) SetLogsRoute(logsRoute bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetMetrics ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) SetMetrics(metrics bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetMultiModal ΒΆ added in v0.33.1
func (ef *ExperimentalFeatures) SetMultiModal(enable bool) *ExperimentalFeatures
func (*ExperimentalFeatures) SetNetwork ΒΆ added in v0.33.0
func (ef *ExperimentalFeatures) SetNetwork(enable bool) *ExperimentalFeatures
func (*ExperimentalFeatures) Update ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) Update() (*ExperimentalFeaturesResult, error)
func (*ExperimentalFeatures) UpdateWithContext ΒΆ added in v0.29.0
func (ef *ExperimentalFeatures) UpdateWithContext(ctx context.Context) (*ExperimentalFeaturesResult, error)
type ExperimentalFeaturesBase ΒΆ added in v0.29.0
type ExperimentalFeaturesBase struct { LogsRoute *bool `json:"logsRoute,omitempty"` Metrics *bool `json:"metrics,omitempty"` EditDocumentsByFunction *bool `json:"editDocumentsByFunction,omitempty"` ContainsFilter *bool `json:"containsFilter,omitempty"` Network *bool `json:"network,omitempty"` CompositeEmbedders *bool `json:"compositeEmbedders,omitempty"` ChatCompletions *bool `json:"chatCompletions,omitempty"` MultiModal *bool `json:"multimodal,omitempty"` }
ExperimentalFeaturesResult represents the experimental features result from the API.
type ExperimentalFeaturesResult ΒΆ added in v0.29.0
type ExperimentalFeaturesResult struct { LogsRoute bool `json:"logsRoute"` Metrics bool `json:"metrics"` EditDocumentsByFunction bool `json:"editDocumentsByFunction"` ContainsFilter bool `json:"containsFilter"` Network bool `json:"network"` CompositeEmbedders bool `json:"compositeEmbedders"` ChatCompletions bool `json:"chatCompletions"` MultiModal bool `json:"multimodal,omitempty"` }
type ExportParams ΒΆ added in v0.33.1
type ExportParams struct { URL string `json:"url,omitempty"` APIKey string `json:"apiKey,omitempty"` PayloadSize string `json:"payloadSize,omitempty"` Indexes map[string]IndexExportOptions `json:"indexes,omitempty"` }
type FacetSearchRequest ΒΆ added in v0.27.1
type FacetSearchRequest struct { FacetName string `json:"facetName,omitempty"` FacetQuery string `json:"facetQuery,omitempty"` Q string `json:"q,omitempty"` Filter string `json:"filter,omitempty"` MatchingStrategy string `json:"matchingStrategy,omitempty"` AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"` ExhaustiveFacetCount bool `json:"exhaustiveFacetCount,omitempty"` }
type FacetSearchResponse ΒΆ added in v0.27.1
type Faceting ΒΆ added in v0.20.1
type Faceting struct { MaxValuesPerFacet int64 `json:"maxValuesPerFacet"` // SortFacetValuesBy index_name: alpha|count SortFacetValuesBy map[string]SortFacetType `json:"sortFacetValuesBy"` }
Faceting is the type that represents the faceting setting in meilisearch
type FilterFeatures ΒΆ added in v0.33.0
type Health ΒΆ added in v0.13.1
type Health struct {
Status string `json:"status"`
}
Health is the request body for set meilisearch health
type Hit ΒΆ added in v0.33.0
type Hit map[string]json.RawMessage // Hit is a map of key and value raw buffer
func (Hit) DecodeInto ΒΆ added in v0.34.0
DecodeInto decodes a single Hit into the provided struct without intermediate marshaling.
func (Hit) DecodeWith ΒΆ added in v0.33.0
func (h Hit) DecodeWith(vPtr interface{}, marshal JSONMarshal, unmarshal JSONUnmarshal) error
DecodeWith decodes a Hit into the provided struct using the provided marshal and unmarshal functions.
type Hits ΒΆ added in v0.33.0
type Hits []Hit // Hits is an alias for a slice of Hit.
func (Hits) DecodeInto ΒΆ added in v0.34.0
DecodeInto decodes hs into the provided slice pointer without re-marshal. vSlicePtr must be a non-nil pointer to a slice whose element type is a struct or *struct. Example:
var out []exampleBookForTest if err := hits.DecodeInto(&out); err != nil { ... } var outPtr []*exampleBookForTest if err := hits.DecodeInto(&outPtr); err != nil { ... }
func (Hits) DecodeWith ΒΆ added in v0.33.0
func (h Hits) DecodeWith(vSlicePtr interface{}, marshal JSONMarshal, unmarshal JSONUnmarshal) error
DecodeWith decodes a Hits into the provided struct using the provided marshal and unmarshal functions.
type IndexConfig ΒΆ added in v0.15.0
type IndexExportOptions ΒΆ added in v0.33.1
type IndexManager ΒΆ added in v0.28.0
type IndexManager interface { IndexReader TaskReader DocumentManager SettingsManager SearchReader GetIndexReader() IndexReader GetTaskReader() TaskReader GetDocumentManager() DocumentManager GetDocumentReader() DocumentReader GetSettingsManager() SettingsManager GetSettingsReader() SettingsReader GetSearch() SearchReader // UpdateIndex updates the primary key of the index. UpdateIndex(params *UpdateIndexRequestParams) (*TaskInfo, error) // UpdateIndexWithContext updates the primary key of the index using the provided context for cancellation. UpdateIndexWithContext(ctx context.Context, params *UpdateIndexRequestParams) (*TaskInfo, error) // Delete removes the index identified by the given UID. Delete(uid string) (bool, error) // DeleteWithContext removes the index identified by the given UID using the provided context for cancellation. DeleteWithContext(ctx context.Context, uid string) (bool, error) }
type IndexReader ΒΆ added in v0.30.0
type IndexReader interface { // FetchInfo retrieves information about the index. FetchInfo() (*IndexResult, error) // FetchInfoWithContext retrieves information about the index using the provided context for cancellation. FetchInfoWithContext(ctx context.Context) (*IndexResult, error) // FetchPrimaryKey retrieves the primary key of the index. FetchPrimaryKey() (*string, error) // FetchPrimaryKeyWithContext retrieves the primary key of the index using the provided context for cancellation. FetchPrimaryKeyWithContext(ctx context.Context) (*string, error) // GetStats retrieves statistical information about the index. GetStats() (*StatsIndex, error) // GetStatsWithContext retrieves statistical information about the index using the provided context for cancellation. GetStatsWithContext(ctx context.Context) (*StatsIndex, error) }
type IndexResult ΒΆ added in v0.28.0
type IndexesQuery ΒΆ added in v0.20.0
type IndexesResults ΒΆ added in v0.20.0
type IndexesResults struct { Results []*IndexResult `json:"results"` Offset int64 `json:"offset"` Limit int64 `json:"limit"` Total int64 `json:"total"` }
IndexesResults return of multiple indexes is wrap in a IndexesResults
type JSONMarshal ΒΆ added in v0.33.0
JSONMarshal returns the JSON encoding of v.
type JSONUnmarshal ΒΆ added in v0.33.0
JSONUnmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.
type Key ΒΆ added in v0.18.0
type Key struct { Name string `json:"name"` Description string `json:"description"` Key string `json:"key,omitempty"` UID string `json:"uid,omitempty"` Actions []string `json:"actions,omitempty"` Indexes []string `json:"indexes,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` ExpiresAt time.Time `json:"expiresAt"` }
Key allow the user to connect to the meilisearch instance
Documentation: https://www.meilisearch.com/docs/learn/security/master_api_keys#protecting-a-meilisearch-instance
type KeyManager ΒΆ added in v0.30.0
type KeyManager interface { KeyReader // CreateKey creates a new API key. CreateKey(request *Key) (*Key, error) // CreateKeyWithContext creates a new API key with a context for cancellation. CreateKeyWithContext(ctx context.Context, request *Key) (*Key, error) // UpdateKey updates a specific API key. UpdateKey(keyOrUID string, request *Key) (*Key, error) // UpdateKeyWithContext updates a specific API key with a context for cancellation. UpdateKeyWithContext(ctx context.Context, keyOrUID string, request *Key) (*Key, error) // DeleteKey deletes a specific API key. DeleteKey(keyOrUID string) (bool, error) // DeleteKeyWithContext deletes a specific API key with a context for cancellation. DeleteKeyWithContext(ctx context.Context, keyOrUID string) (bool, error) }
type KeyParsed ΒΆ added in v0.18.0
type KeyParsed struct { Name string `json:"name"` Description string `json:"description"` UID string `json:"uid,omitempty"` Actions []string `json:"actions,omitempty"` Indexes []string `json:"indexes,omitempty"` ExpiresAt *string `json:"expiresAt"` }
KeyParsed this structure is used to send the exact ISO-8601 time format managed by meilisearch
type KeyReader ΒΆ added in v0.30.0
type KeyReader interface { // GetKey fetches the details of a specific API key. GetKey(identifier string) (*Key, error) // GetKeyWithContext fetches the details of a specific API key with a context for cancellation. GetKeyWithContext(ctx context.Context, identifier string) (*Key, error) // GetKeys lists all API keys. GetKeys(param *KeysQuery) (*KeysResults, error) // GetKeysWithContext lists all API keys with a context for cancellation. GetKeysWithContext(ctx context.Context, param *KeysQuery) (*KeysResults, error) }
type KeyUpdate ΒΆ added in v0.20.0
type KeyUpdate struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` }
KeyUpdate this structure is used to update a Key
type KeysResults ΒΆ added in v0.20.0
type KeysResults struct { Results []Key `json:"results"` Offset int64 `json:"offset"` Limit int64 `json:"limit"` Total int64 `json:"total"` }
KeysResults return of multiple keys is wrap in a KeysResults
type ListChatWorkSpaceQuery ΒΆ added in v0.33.1
type ListChatWorkspace ΒΆ added in v0.33.1
type ListChatWorkspace struct { Results []*ChatWorkspace `json:"results"` Offset int64 `json:"offset"` Limit int64 `json:"limit"` Total int64 `json:"total"` }
type LocalizedAttributes ΒΆ added in v0.29.0
type MatchingStrategy ΒΆ added in v0.28.0
type MatchingStrategy string // MatchingStrategy one of the Last, All, Frequency
const ( // Last returns documents containing all the query terms first. If there are not enough results containing all // query terms to meet the requested limit, Meilisearch will remove one query term at a time, // starting from the end of the query. Last MatchingStrategy = "last" // All only returns documents that contain all query terms. Meilisearch will not match any more documents even // if there aren't enough to meet the requested limit. All MatchingStrategy = "all" // Frequency returns documents containing all the query terms first. If there are not enough results containing //all query terms to meet the requested limit, Meilisearch will remove one query term at a time, starting //with the word that is the most frequent in the dataset. frequency effectively gives more weight to terms //that appear less frequently in a set of results. Frequency MatchingStrategy = "frequency" )
type MinWordSizeForTypos ΒΆ added in v0.19.1
type MinWordSizeForTypos struct { OneTypo int64 `json:"oneTypo,omitempty"` TwoTypos int64 `json:"twoTypos,omitempty"` }
MinWordSizeForTypos is the type that represents the minWordSizeForTypos setting in the typo tolerance setting in meilisearch
type MultiSearchFederation ΒΆ added in v0.29.0
type MultiSearchFederation struct { Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` FacetsByIndex map[string][]string `json:"facetsByIndex,omitempty"` MergeFacets *MultiSearchFederationMergeFacets `json:"mergeFacets,omitempty"` }
type MultiSearchFederationMergeFacets ΒΆ added in v0.33.0
type MultiSearchFederationMergeFacets struct {
MaxValuesPerFacet int `json:"maxValuesPerFacet,omitempty"`
}
type MultiSearchRequest ΒΆ added in v0.24.0
type MultiSearchRequest struct { Federation *MultiSearchFederation `json:"federation,omitempty"` Queries []*SearchRequest `json:"queries"` }
type MultiSearchResponse ΒΆ added in v0.24.0
type MultiSearchResponse struct { Results []SearchResponse `json:"results,omitempty"` Hits Hits `json:"hits,omitempty"` ProcessingTimeMs int64 `json:"processingTimeMs,omitempty"` Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` EstimatedTotalHits int64 `json:"estimatedTotalHits,omitempty"` SemanticHitCount int64 `json:"semanticHitCount,omitempty"` FacetDistribution map[string]json.RawMessage `json:"facetDistribution,omitempty"` FacetStats map[string]json.RawMessage `json:"facetStats,omitempty"` RemoteErrors map[string]*RemoteError `json:"remoteErrors,omitempty"` }
type Network ΒΆ added in v0.33.2
type Network struct { Self Opt[string] `json:"self,omitempty"` Remotes Opt[map[string]Opt[Remote]] `json:"remotes,omitempty"` Sharding Opt[bool] `json:"sharding,omitempty"` }
Network represents the Meilisearch network configuration. Each field is wrapped in an Opt so it can be explicitly included, set to JSON null, or omitted entirely.
func (Network) MarshalJSON ΒΆ added in v0.33.2
type Opt ΒΆ added in v0.33.2
type Opt[T any] struct { Value T // contains filtered or unexported fields }
func Bool ΒΆ added in v0.33.2
Bool creates an Opt[bool] with the given bool value and sets its status to included.
func Float ΒΆ added in v0.33.2
Float creates an Opt[float64] with the given float64 value and sets its status to included.
func Int ΒΆ added in v0.33.2
Int creates an Opt[int] with the given int value and sets its status to included.
func Int64 ΒΆ added in v0.33.2
Int64 creates an Opt[int64] with the given int64 value and sets its status to included.
func NewOpt ΒΆ added in v0.33.2
NewOpt creates an Opt[T] with the given value and sets its status to included.
func String ΒΆ added in v0.33.2
String creates an Opt[string] with the given string value and sets its status to included.
func (Opt[T]) MarshalJSON ΒΆ added in v0.33.2
func (*Opt[T]) UnmarshalJSON ΒΆ added in v0.33.2
type Option ΒΆ added in v0.28.0
type Option func(*meiliOpt)
func DisableRetries ΒΆ added in v0.29.0
func DisableRetries() Option
DisableRetries disable retry logic in client
func WithAPIKey ΒΆ added in v0.28.0
WithAPIKey is API key or master key.
func WithContentEncoding ΒΆ added in v0.29.0
func WithContentEncoding(encodingType ContentEncoding, level EncodingCompressionLevel) Option
WithContentEncoding support the Content-Encoding header indicates the media type is compressed by a given algorithm. compression improves transfer speed and reduces bandwidth consumption by sending and receiving smaller payloads. the Accept-Encoding header, instead, indicates the compression algorithm the client understands.
more: https://www.meilisearch.com/docs/reference/api/overview#content-encoding
func WithCustomClient ΒΆ added in v0.28.0
WithCustomClient set custom http.Client
func WithCustomClientWithTLS ΒΆ added in v0.28.0
WithCustomClientWithTLS client support tls configuration
func WithCustomDialContext ΒΆ added in v0.33.0
func WithCustomDialContext(dial func(ctx context.Context, network, addr string) (net.Conn, error)) Option
WithCustomDialContext sets a custom dial context
func WithCustomExpectContinueTimeout ΒΆ added in v0.33.0
WithCustomExpectContinueTimeout sets the Expect-Continue timeout
func WithCustomIdleConnTimeout ΒΆ added in v0.33.0
WithCustomIdleConnTimeout sets the idle connection timeout
func WithCustomJsonMarshaler ΒΆ added in v0.33.0
func WithCustomJsonMarshaler(marshal JSONMarshal) Option
WithCustomJsonMarshaler set custom marshal from external packages instead encoding/json. we use encoding/json as default json library due to stability and producibility. However, the standard library is a bit slow compared to 3rd party libraries. If you're not happy with the performance of encoding/json.
supported package: goccy/go-json, bytedance/sonic, segmentio/encoding, minio/simdjson-go, wI2L/jettison, mailru/easyjson.
default is encoding/json
func WithCustomJsonUnmarshaler ΒΆ added in v0.33.0
func WithCustomJsonUnmarshaler(unmarshal JSONUnmarshal) Option
WithCustomJsonUnmarshaler set custom unmarshal from external packages instead encoding/json. we use encoding/json as default json library due to stability and producibility. However, the standard library is a bit slow compared to 3rd party libraries. If you're not happy with the performance of encoding/json.
supported package: goccy/go-json, bytedance/sonic, segmentio/encoding, minio/simdjson-go, wI2L/jettison, mailru/easyjson.
default is encoding/json
func WithCustomMaxIdleConns ΒΆ added in v0.33.0
WithCustomMaxIdleConns sets the max number of idle connections
func WithCustomMaxIdleConnsPerHost ΒΆ added in v0.33.0
WithCustomMaxIdleConnsPerHost sets max idle connections per host
func WithCustomProxy ΒΆ added in v0.33.0
WithCustomProxy sets a custom proxy function
func WithCustomRetries ΒΆ added in v0.29.0
WithCustomRetries set retry on specific http error code and max retries (min: 1, max: 255)
func WithCustomTLSHandshakeTimeout ΒΆ added in v0.33.0
WithCustomTLSHandshakeTimeout sets the TLS handshake timeout
type Pagination ΒΆ added in v0.20.1
type Pagination struct {
MaxTotalHits int64 `json:"maxTotalHits"`
}
Pagination is the type that represents the pagination setting in meilisearch
type ProximityPrecisionType ΒΆ added in v0.28.0
type ProximityPrecisionType string // ProximityPrecisionType accepts one of the ByWord or ByAttribute
const ( // ByWord calculate the precise distance between query terms. Higher precision, but may lead to longer // indexing time. This is the default setting ByWord ProximityPrecisionType = "byWord" // ByAttribute determine if multiple query terms are present in the same attribute. // Lower precision, but shorter indexing time ByAttribute ProximityPrecisionType = "byAttribute" )
type Remote ΒΆ added in v0.33.2
type Remote struct { URL Opt[string] `json:"url"` SearchAPIKey Opt[string] `json:"searchApiKey,omitempty"` WriteAPIKey Opt[string] `json:"writeApiKey,omitempty"` }
Remote describes a single remote Meilisearch node. Each field is wrapped in an Opt so it can be explicitly included, set to JSON null, or omitted entirely.
func (Remote) MarshalJSON ΒΆ added in v0.33.2
type RemoteError ΒΆ added in v0.33.2
type SearchFederationOptions ΒΆ added in v0.29.0
type SearchParameters ΒΆ added in v0.33.1
type SearchParameters struct { Limit int64 `json:"limit,omitempty"` AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"` MatchingStrategy MatchingStrategy `json:"matchingStrategy,omitempty"` Sort []string `json:"sort,omitempty"` Distinct string `json:"distinct,omitempty"` Hybrid *SearchRequestHybrid `json:"hybrid,omitempty"` RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"` }
type SearchReader ΒΆ added in v0.30.0
type SearchReader interface { // Search performs a search query on the index. Search(query string, request *SearchRequest) (*SearchResponse, error) // SearchWithContext performs a search query on the index using the provided context for cancellation. SearchWithContext(ctx context.Context, query string, request *SearchRequest) (*SearchResponse, error) // SearchRaw performs a raw search query on the index, returning a JSON response. SearchRaw(query string, request *SearchRequest) (*json.RawMessage, error) // SearchRawWithContext performs a raw search query on the index using the provided context for cancellation, returning a JSON response. SearchRawWithContext(ctx context.Context, query string, request *SearchRequest) (*json.RawMessage, error) // FacetSearch performs a facet search query on the index. FacetSearch(request *FacetSearchRequest) (*json.RawMessage, error) // FacetSearchWithContext performs a facet search query on the index using the provided context for cancellation. FacetSearchWithContext(ctx context.Context, request *FacetSearchRequest) (*json.RawMessage, error) // SearchSimilarDocuments performs a search for similar documents. SearchSimilarDocuments(param *SimilarDocumentQuery, resp *SimilarDocumentResult) error // SearchSimilarDocumentsWithContext performs a search for similar documents using the provided context for cancellation. SearchSimilarDocumentsWithContext(ctx context.Context, param *SimilarDocumentQuery, resp *SimilarDocumentResult) error }
type SearchRequest ΒΆ
type SearchRequest struct { Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"` AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"` AttributesToCrop []string `json:"attributesToCrop,omitempty"` CropLength int64 `json:"cropLength,omitempty"` CropMarker string `json:"cropMarker,omitempty"` AttributesToHighlight []string `json:"attributesToHighlight,omitempty"` HighlightPreTag string `json:"highlightPreTag,omitempty"` HighlightPostTag string `json:"highlightPostTag,omitempty"` MatchingStrategy MatchingStrategy `json:"matchingStrategy,omitempty"` Filter interface{} `json:"filter,omitempty"` ShowMatchesPosition bool `json:"showMatchesPosition,omitempty"` ShowRankingScore bool `json:"showRankingScore,omitempty"` ShowRankingScoreDetails bool `json:"showRankingScoreDetails,omitempty"` Facets []string `json:"facets,omitempty"` Sort []string `json:"sort,omitempty"` Vector []float32 `json:"vector,omitempty"` HitsPerPage int64 `json:"hitsPerPage,omitempty"` Page int64 `json:"page,omitempty"` IndexUID string `json:"indexUid,omitempty"` Query string `json:"q"` Distinct string `json:"distinct,omitempty"` Hybrid *SearchRequestHybrid `json:"hybrid"` RetrieveVectors bool `json:"retrieveVectors,omitempty"` RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"` FederationOptions *SearchFederationOptions `json:"federationOptions,omitempty"` Locales []string `json:"locales,omitempty"` Media map[string]any `json:"media,omitempty"` }
SearchRequest is the request url param needed for a search query. This struct will be converted to url param before sent.
Documentation: https://www.meilisearch.com/docs/reference/api/search#search-parameters
type SearchRequestHybrid ΒΆ added in v0.26.3
type SearchResponse ΒΆ
type SearchResponse struct { Hits Hits `json:"hits"` EstimatedTotalHits int64 `json:"estimatedTotalHits,omitempty"` Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` ProcessingTimeMs int64 `json:"processingTimeMs"` Query string `json:"query"` FacetDistribution json.RawMessage `json:"facetDistribution,omitempty"` TotalHits int64 `json:"totalHits,omitempty"` HitsPerPage int64 `json:"hitsPerPage,omitempty"` Page int64 `json:"page,omitempty"` TotalPages int64 `json:"totalPages,omitempty"` FacetStats json.RawMessage `json:"facetStats,omitempty"` IndexUID string `json:"indexUid,omitempty"` QueryVector *[]float32 `json:"queryVector,omitempty"` }
SearchResponse is the response body for search method
type ServiceManager ΒΆ added in v0.28.0
type ServiceManager interface { ServiceReader KeyManager TaskManager ChatManager ChatReader WebhookManager ServiceReader() ServiceReader TaskManager() TaskManager TaskReader() TaskReader KeyManager() KeyManager KeyReader() KeyReader ChatManager() ChatManager ChatReader() ChatReader WebhookManager() WebhookManager WebhookReader() WebhookReader // CreateIndex creates a new index. CreateIndex(config *IndexConfig) (*TaskInfo, error) // CreateIndexWithContext creates a new index with a context for cancellation. CreateIndexWithContext(ctx context.Context, config *IndexConfig) (*TaskInfo, error) // DeleteIndex deletes a specific index. DeleteIndex(uid string) (*TaskInfo, error) // DeleteIndexWithContext deletes a specific index with a context for cancellation. DeleteIndexWithContext(ctx context.Context, uid string) (*TaskInfo, error) // SwapIndexes swaps two existing indexes if rename is false; use rename: true if the second index does not exist. SwapIndexes(param []*SwapIndexesParams) (*TaskInfo, error) // SwapIndexesWithContext swaps two existing indexes with a context if rename is false; use rename: true if the second index does not exist. SwapIndexesWithContext(ctx context.Context, param []*SwapIndexesParams) (*TaskInfo, error) // GenerateTenantToken generates a tenant token for multi-tenancy. GenerateTenantToken(apiKeyUID string, searchRules map[string]interface{}, options *TenantTokenOptions) (string, error) // CreateDump creates a database dump. CreateDump() (*TaskInfo, error) // CreateDumpWithContext creates a database dump with a context for cancellation. CreateDumpWithContext(ctx context.Context) (*TaskInfo, error) // CreateSnapshot create database snapshot from meilisearch CreateSnapshot() (*TaskInfo, error) // CreateSnapshotWithContext create database snapshot from meilisearch and support parent context CreateSnapshotWithContext(ctx context.Context) (*TaskInfo, error) // ExperimentalFeatures returns the experimental features manager. ExperimentalFeatures() *ExperimentalFeatures // Export transfers data from your origin instance to a remote target instance. Export(params *ExportParams) (*TaskInfo, error) // ExportWithContext transfers data from your origin instance to a remote target instance with a context for cancellation. ExportWithContext(ctx context.Context, params *ExportParams) (*TaskInfo, error) // UpdateNetwork updates the network object. // Updates are partial; only the provided fields are updated. UpdateNetwork(params *Network) (*Network, error) // UpdateNetworkWithContext updates the network object with a context. // Updates are partial; only the provided fields are updated. UpdateNetworkWithContext(ctx context.Context, params *Network) (*Network, error) // Close closes the connection to the Meilisearch server. Close() }
func Connect ΒΆ added in v0.28.0
func Connect(host string, options ...Option) (ServiceManager, error)
Connect create service manager and check connection with meilisearch
Example ΒΆ
meili, err := Connect("http://localhost:7700", WithAPIKey("foobar")) if err != nil { fmt.Println(err) return } ver, err := meili.Version() if err != nil { fmt.Println(err) return } fmt.Println(ver.PkgVersion)
func New ΒΆ added in v0.28.0
func New(host string, options ...Option) ServiceManager
New create new service manager for operating on meilisearch
Example ΒΆ
// WithAPIKey is optional meili := New("http://localhost:7700", WithAPIKey("foobar")) // An index is where the documents are stored. idx := meili.Index("movies") // If the index 'movies' does not exist, Meilisearch creates it when you first add the documents. documents := []map[string]interface{}{ {"id": 1, "title": "Carol", "genres": []string{"Romance", "Drama"}}, {"id": 2, "title": "Wonder Woman", "genres": []string{"Action", "Adventure"}}, {"id": 3, "title": "Life of Pi", "genres": []string{"Adventure", "Drama"}}, {"id": 4, "title": "Mad Max: Fury Road", "genres": []string{"Adventure", "Science Fiction"}}, {"id": 5, "title": "Moana", "genres": []string{"Fantasy", "Action"}}, {"id": 6, "title": "Philadelphia", "genres": []string{"Drama"}}, } task, err := idx.AddDocuments(documents, nil) if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(task.TaskUID)
type ServiceReader ΒΆ added in v0.30.0
type ServiceReader interface { // Index retrieves an IndexManager for a specific index. Index(uid string) IndexManager // GetIndex fetches the details of a specific index. GetIndex(indexID string) (*IndexResult, error) // GetIndexWithContext fetches the details of a specific index with a context for cancellation. GetIndexWithContext(ctx context.Context, indexID string) (*IndexResult, error) // GetRawIndex fetches the raw JSON representation of a specific index. GetRawIndex(uid string) (map[string]interface{}, error) // GetRawIndexWithContext fetches the raw JSON representation of a specific index with a context for cancellation. GetRawIndexWithContext(ctx context.Context, uid string) (map[string]interface{}, error) // ListIndexes lists all indexes. ListIndexes(param *IndexesQuery) (*IndexesResults, error) // ListIndexesWithContext lists all indexes with a context for cancellation. ListIndexesWithContext(ctx context.Context, param *IndexesQuery) (*IndexesResults, error) // GetRawIndexes fetches the raw JSON representation of all indexes. GetRawIndexes(param *IndexesQuery) (map[string]interface{}, error) // GetRawIndexesWithContext fetches the raw JSON representation of all indexes with a context for cancellation. GetRawIndexesWithContext(ctx context.Context, param *IndexesQuery) (map[string]interface{}, error) // MultiSearch performs a multi-index search. MultiSearch(queries *MultiSearchRequest) (*MultiSearchResponse, error) // MultiSearchWithContext performs a multi-index search with a context for cancellation. MultiSearchWithContext(ctx context.Context, queries *MultiSearchRequest) (*MultiSearchResponse, error) // GetStats fetches global stats. GetStats() (*Stats, error) // GetStatsWithContext fetches global stats with a context for cancellation. GetStatsWithContext(ctx context.Context) (*Stats, error) // Version fetches the version of the Meilisearch server. Version() (*Version, error) // VersionWithContext fetches the version of the Meilisearch server with a context for cancellation. VersionWithContext(ctx context.Context) (*Version, error) // Health checks the health of the Meilisearch server. Health() (*Health, error) // HealthWithContext checks the health of the Meilisearch server with a context for cancellation. HealthWithContext(ctx context.Context) (*Health, error) // IsHealthy checks if the Meilisearch server is healthy. IsHealthy() bool // GetBatches allows you to monitor how Meilisearch is grouping and processing asynchronous operations. GetBatches(param *BatchesQuery) (*BatchesResults, error) // GetBatchesWithContext allows you to monitor how Meilisearch is grouping and processing asynchronous operations with a context for cancellation. GetBatchesWithContext(ctx context.Context, param *BatchesQuery) (*BatchesResults, error) // GetBatch retrieves a specific batch by its UID. GetBatch(batchUID int) (*Batch, error) // GetBatchWithContext retrieves a specific batch by its UID with a context for cancellation. GetBatchWithContext(ctx context.Context, batchUID int) (*Batch, error) // GetNetwork gets the current value of the instanceβs network object. GetNetwork() (*Network, error) // GetNetworkWithContext gets the current value of the instanceβs network object with a context. GetNetworkWithContext(ctx context.Context) (*Network, error) }
type Settings ΒΆ
type Settings struct { RankingRules []string `json:"rankingRules,omitempty"` DistinctAttribute *string `json:"distinctAttribute,omitempty"` SearchableAttributes []string `json:"searchableAttributes,omitempty"` Dictionary []string `json:"dictionary,omitempty"` SearchCutoffMs int64 `json:"searchCutoffMs,omitempty"` ProximityPrecision ProximityPrecisionType `json:"proximityPrecision,omitempty"` SeparatorTokens []string `json:"separatorTokens,omitempty"` NonSeparatorTokens []string `json:"nonSeparatorTokens,omitempty"` DisplayedAttributes []string `json:"displayedAttributes,omitempty"` StopWords []string `json:"stopWords,omitempty"` Synonyms map[string][]string `json:"synonyms,omitempty"` FilterableAttributes []string `json:"filterableAttributes,omitempty"` SortableAttributes []string `json:"sortableAttributes,omitempty"` LocalizedAttributes []*LocalizedAttributes `json:"localizedAttributes,omitempty"` TypoTolerance *TypoTolerance `json:"typoTolerance,omitempty"` Pagination *Pagination `json:"pagination,omitempty"` Faceting *Faceting `json:"faceting,omitempty"` Embedders map[string]Embedder `json:"embedders,omitempty"` PrefixSearch *string `json:"prefixSearch,omitempty"` FacetSearch bool `json:"facetSearch,omitempty"` Chat *Chat `json:"chat,omitempty"` }
Settings is the type that represents the settings in meilisearch
type SettingsManager ΒΆ added in v0.30.0
type SettingsManager interface { SettingsReader // UpdateSettings updates the settings of the index. UpdateSettings(request *Settings) (*TaskInfo, error) // UpdateSettingsWithContext updates the settings of the index using the provided context for cancellation. UpdateSettingsWithContext(ctx context.Context, request *Settings) (*TaskInfo, error) // ResetSettings resets the settings of the index to default values. ResetSettings() (*TaskInfo, error) // ResetSettingsWithContext resets the settings of the index to default values using the provided context for cancellation. ResetSettingsWithContext(ctx context.Context) (*TaskInfo, error) // UpdateRankingRules updates the ranking rules of the index. UpdateRankingRules(request *[]string) (*TaskInfo, error) // UpdateRankingRulesWithContext updates the ranking rules of the index using the provided context for cancellation. UpdateRankingRulesWithContext(ctx context.Context, request *[]string) (*TaskInfo, error) // ResetRankingRules resets the ranking rules of the index to default values. ResetRankingRules() (*TaskInfo, error) // ResetRankingRulesWithContext resets the ranking rules of the index to default values using the provided context for cancellation. ResetRankingRulesWithContext(ctx context.Context) (*TaskInfo, error) // UpdateDistinctAttribute updates the distinct attribute of the index. UpdateDistinctAttribute(request string) (*TaskInfo, error) // UpdateDistinctAttributeWithContext updates the distinct attribute of the index using the provided context for cancellation. UpdateDistinctAttributeWithContext(ctx context.Context, request string) (*TaskInfo, error) // ResetDistinctAttribute resets the distinct attribute of the index to default value. ResetDistinctAttribute() (*TaskInfo, error) // ResetDistinctAttributeWithContext resets the distinct attribute of the index to default value using the provided context for cancellation. ResetDistinctAttributeWithContext(ctx context.Context) (*TaskInfo, error) // UpdateSearchableAttributes updates the searchable attributes of the index. UpdateSearchableAttributes(request *[]string) (*TaskInfo, error) // UpdateSearchableAttributesWithContext updates the searchable attributes of the index using the provided context for cancellation. UpdateSearchableAttributesWithContext(ctx context.Context, request *[]string) (*TaskInfo, error) // ResetSearchableAttributes resets the searchable attributes of the index to default values. ResetSearchableAttributes() (*TaskInfo, error) // ResetSearchableAttributesWithContext resets the searchable attributes of the index to default values using the provided context for cancellation. ResetSearchableAttributesWithContext(ctx context.Context) (*TaskInfo, error) // UpdateDisplayedAttributes updates the displayed attributes of the index. UpdateDisplayedAttributes(request *[]string) (*TaskInfo, error) // UpdateDisplayedAttributesWithContext updates the displayed attributes of the index using the provided context for cancellation. UpdateDisplayedAttributesWithContext(ctx context.Context, request *[]string) (*TaskInfo, error) // ResetDisplayedAttributes resets the displayed attributes of the index to default values. ResetDisplayedAttributes() (*TaskInfo, error) // ResetDisplayedAttributesWithContext resets the displayed attributes of the index to default values using the provided context for cancellation. ResetDisplayedAttributesWithContext(ctx context.Context) (*TaskInfo, error) // UpdateStopWords updates the stop words of the index. UpdateStopWords(request *[]string) (*TaskInfo, error) // UpdateStopWordsWithContext updates the stop words of the index using the provided context for cancellation. UpdateStopWordsWithContext(ctx context.Context, request *[]string) (*TaskInfo, error) // ResetStopWords resets the stop words of the index to default values. ResetStopWords() (*TaskInfo, error) // ResetStopWordsWithContext resets the stop words of the index to default values using the provided context for cancellation. ResetStopWordsWithContext(ctx context.Context) (*TaskInfo, error) // UpdateSynonyms updates the synonyms of the index. UpdateSynonyms(request *map[string][]string) (*TaskInfo, error) // UpdateSynonymsWithContext updates the synonyms of the index using the provided context for cancellation. UpdateSynonymsWithContext(ctx context.Context, request *map[string][]string) (*TaskInfo, error) // ResetSynonyms resets the synonyms of the index to default values. ResetSynonyms() (*TaskInfo, error) // ResetSynonymsWithContext resets the synonyms of the index to default values using the provided context for cancellation. ResetSynonymsWithContext(ctx context.Context) (*TaskInfo, error) // UpdateFilterableAttributes updates the filterable attributes of the index. UpdateFilterableAttributes(request *[]interface{}) (*TaskInfo, error) // UpdateFilterableAttributesWithContext updates the filterable attributes of the index using the provided context for cancellation. UpdateFilterableAttributesWithContext(ctx context.Context, request *[]interface{}) (*TaskInfo, error) // ResetFilterableAttributes resets the filterable attributes of the index to default values. ResetFilterableAttributes() (*TaskInfo, error) // ResetFilterableAttributesWithContext resets the filterable attributes of the index to default values using the provided context for cancellation. ResetFilterableAttributesWithContext(ctx context.Context) (*TaskInfo, error) // UpdateSortableAttributes updates the sortable attributes of the index. UpdateSortableAttributes(request *[]string) (*TaskInfo, error) // UpdateSortableAttributesWithContext updates the sortable attributes of the index using the provided context for cancellation. UpdateSortableAttributesWithContext(ctx context.Context, request *[]string) (*TaskInfo, error) // ResetSortableAttributes resets the sortable attributes of the index to default values. ResetSortableAttributes() (*TaskInfo, error) // ResetSortableAttributesWithContext resets the sortable attributes of the index to default values using the provided context for cancellation. ResetSortableAttributesWithContext(ctx context.Context) (*TaskInfo, error) // UpdateTypoTolerance updates the typo tolerance settings of the index. UpdateTypoTolerance(request *TypoTolerance) (*TaskInfo, error) // UpdateTypoToleranceWithContext updates the typo tolerance settings of the index using the provided context for cancellation. UpdateTypoToleranceWithContext(ctx context.Context, request *TypoTolerance) (*TaskInfo, error) // ResetTypoTolerance resets the typo tolerance settings of the index to default values. ResetTypoTolerance() (*TaskInfo, error) // ResetTypoToleranceWithContext resets the typo tolerance settings of the index to default values using the provided context for cancellation. ResetTypoToleranceWithContext(ctx context.Context) (*TaskInfo, error) // UpdatePagination updates the pagination settings of the index. UpdatePagination(request *Pagination) (*TaskInfo, error) // UpdatePaginationWithContext updates the pagination settings of the index using the provided context for cancellation. UpdatePaginationWithContext(ctx context.Context, request *Pagination) (*TaskInfo, error) // ResetPagination resets the pagination settings of the index to default values. ResetPagination() (*TaskInfo, error) // ResetPaginationWithContext resets the pagination settings of the index to default values using the provided context for cancellation. ResetPaginationWithContext(ctx context.Context) (*TaskInfo, error) // UpdateFaceting updates the faceting settings of the index. UpdateFaceting(request *Faceting) (*TaskInfo, error) // UpdateFacetingWithContext updates the faceting settings of the index using the provided context for cancellation. UpdateFacetingWithContext(ctx context.Context, request *Faceting) (*TaskInfo, error) // ResetFaceting resets the faceting settings of the index to default values. ResetFaceting() (*TaskInfo, error) // ResetFacetingWithContext resets the faceting settings of the index to default values using the provided context for cancellation. ResetFacetingWithContext(ctx context.Context) (*TaskInfo, error) // UpdateEmbedders updates the embedders of the index. UpdateEmbedders(request map[string]Embedder) (*TaskInfo, error) // UpdateEmbeddersWithContext updates the embedders of the index using the provided context for cancellation. UpdateEmbeddersWithContext(ctx context.Context, request map[string]Embedder) (*TaskInfo, error) // ResetEmbedders resets the embedders of the index to default values. ResetEmbedders() (*TaskInfo, error) // ResetEmbeddersWithContext resets the embedders of the index to default values using the provided context for cancellation. ResetEmbeddersWithContext(ctx context.Context) (*TaskInfo, error) // UpdateSearchCutoffMs updates the search cutoff time in milliseconds. UpdateSearchCutoffMs(request int64) (*TaskInfo, error) // UpdateSearchCutoffMsWithContext updates the search cutoff time in milliseconds using the provided context for cancellation. UpdateSearchCutoffMsWithContext(ctx context.Context, request int64) (*TaskInfo, error) // ResetSearchCutoffMs resets the search cutoff time in milliseconds to default value. ResetSearchCutoffMs() (*TaskInfo, error) // ResetSearchCutoffMsWithContext resets the search cutoff time in milliseconds to default value using the provided context for cancellation. ResetSearchCutoffMsWithContext(ctx context.Context) (*TaskInfo, error) // UpdateSeparatorTokens update separator tokens // https://www.meilisearch.com/docs/reference/api/settings#update-separator-tokens UpdateSeparatorTokens(tokens []string) (*TaskInfo, error) // UpdateSeparatorTokensWithContext update separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#update-separator-tokens UpdateSeparatorTokensWithContext(ctx context.Context, tokens []string) (*TaskInfo, error) // ResetSeparatorTokens reset separator tokens // https://www.meilisearch.com/docs/reference/api/settings#reset-separator-tokens ResetSeparatorTokens() (*TaskInfo, error) // ResetSeparatorTokensWithContext reset separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#reset-separator-tokens ResetSeparatorTokensWithContext(ctx context.Context) (*TaskInfo, error) // UpdateNonSeparatorTokens update non-separator tokens // https://www.meilisearch.com/docs/reference/api/settings#update-non-separator-tokens UpdateNonSeparatorTokens(tokens []string) (*TaskInfo, error) // UpdateNonSeparatorTokensWithContext update non-separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#update-non-separator-tokens UpdateNonSeparatorTokensWithContext(ctx context.Context, tokens []string) (*TaskInfo, error) // ResetNonSeparatorTokens reset non-separator tokens // https://www.meilisearch.com/docs/reference/api/settings#reset-non-separator-tokens ResetNonSeparatorTokens() (*TaskInfo, error) // ResetNonSeparatorTokensWithContext reset non-separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#reset-non-separator-tokens ResetNonSeparatorTokensWithContext(ctx context.Context) (*TaskInfo, error) // UpdateDictionary update user dictionary // https://www.meilisearch.com/docs/reference/api/settings#update-dictionary UpdateDictionary(words []string) (*TaskInfo, error) // UpdateDictionaryWithContext update user dictionary and support parent context // https://www.meilisearch.com/docs/reference/api/settings#update-dictionary UpdateDictionaryWithContext(ctx context.Context, words []string) (*TaskInfo, error) // ResetDictionary reset user dictionary // https://www.meilisearch.com/docs/reference/api/settings#reset-dictionary ResetDictionary() (*TaskInfo, error) // ResetDictionaryWithContext reset user dictionary and support parent context // https://www.meilisearch.com/docs/reference/api/settings#reset-dictionary ResetDictionaryWithContext(ctx context.Context) (*TaskInfo, error) // UpdateProximityPrecision set ProximityPrecision value ByWord or ByAttribute // https://www.meilisearch.com/docs/reference/api/settings#update-proximity-precision-settings UpdateProximityPrecision(proximityType ProximityPrecisionType) (*TaskInfo, error) // UpdateProximityPrecisionWithContext set ProximityPrecision value ByWord or ByAttribute and support parent context // https://www.meilisearch.com/docs/reference/api/settings#update-proximity-precision-settings UpdateProximityPrecisionWithContext(ctx context.Context, proximityType ProximityPrecisionType) (*TaskInfo, error) // ResetProximityPrecision reset ProximityPrecision to default ByWord // https://www.meilisearch.com/docs/reference/api/settings#reset-proximity-precision-settings ResetProximityPrecision() (*TaskInfo, error) // ResetProximityPrecisionWithContext reset ProximityPrecision to default ByWord and support parent context // https://www.meilisearch.com/docs/reference/api/settings#reset-proximity-precision-settings ResetProximityPrecisionWithContext(ctx context.Context) (*TaskInfo, error) // UpdateLocalizedAttributes update the localized attributes settings of an index // https://www.meilisearch.com/docs/reference/api/settings#update-localized-attribute-settings UpdateLocalizedAttributes(request []*LocalizedAttributes) (*TaskInfo, error) // UpdateLocalizedAttributesWithContext update the localized attributes settings of an index using the provided context for cancellation // https://www.meilisearch.com/docs/reference/api/settings#update-localized-attribute-settings UpdateLocalizedAttributesWithContext(ctx context.Context, request []*LocalizedAttributes) (*TaskInfo, error) // ResetLocalizedAttributes reset the localized attributes settings ResetLocalizedAttributes() (*TaskInfo, error) // ResetLocalizedAttributesWithContext reset the localized attributes settings using the provided context for cancellation ResetLocalizedAttributesWithContext(ctx context.Context) (*TaskInfo, error) // UpdatePrefixSearch updates the prefix search setting of the index. UpdatePrefixSearch(request string) (*TaskInfo, error) // UpdatePrefixSearchWithContext updates the prefix search setting of the index using the provided context for cancellation. UpdatePrefixSearchWithContext(ctx context.Context, request string) (*TaskInfo, error) // ResetPrefixSearch resets the prefix search setting of the index to default value. ResetPrefixSearch() (*TaskInfo, error) // ResetPrefixSearchWithContext resets the prefix search setting of the index to default value using the provided context for cancellation. ResetPrefixSearchWithContext(ctx context.Context) (*TaskInfo, error) // UpdateFacetSearch updates the facet search setting of the index. UpdateFacetSearch(request bool) (*TaskInfo, error) // UpdateFacetSearchWithContext updates the facet search setting of the index using the provided context for cancellation. UpdateFacetSearchWithContext(ctx context.Context, request bool) (*TaskInfo, error) // ResetFacetSearch resets the facet search setting of the index to default value. ResetFacetSearch() (*TaskInfo, error) // ResetFacetSearchWithContext resets the facet search setting of the index to default value using the provided context for cancellation. ResetFacetSearchWithContext(ctx context.Context) (*TaskInfo, error) }
type SettingsReader ΒΆ added in v0.30.0
type SettingsReader interface { // GetSettings retrieves the settings of the index. GetSettings() (*Settings, error) // GetSettingsWithContext retrieves the settings of the index using the provided context for cancellation. GetSettingsWithContext(ctx context.Context) (*Settings, error) // GetRankingRules retrieves the ranking rules of the index. GetRankingRules() (*[]string, error) // GetRankingRulesWithContext retrieves the ranking rules of the index using the provided context for cancellation. GetRankingRulesWithContext(ctx context.Context) (*[]string, error) // GetDistinctAttribute retrieves the distinct attribute of the index. GetDistinctAttribute() (*string, error) // GetDistinctAttributeWithContext retrieves the distinct attribute of the index using the provided context for cancellation. GetDistinctAttributeWithContext(ctx context.Context) (*string, error) // GetSearchableAttributes retrieves the searchable attributes of the index. GetSearchableAttributes() (*[]string, error) // GetSearchableAttributesWithContext retrieves the searchable attributes of the index using the provided context for cancellation. GetSearchableAttributesWithContext(ctx context.Context) (*[]string, error) // GetDisplayedAttributes retrieves the displayed attributes of the index. GetDisplayedAttributes() (*[]string, error) // GetDisplayedAttributesWithContext retrieves the displayed attributes of the index using the provided context for cancellation. GetDisplayedAttributesWithContext(ctx context.Context) (*[]string, error) // GetStopWords retrieves the stop words of the index. GetStopWords() (*[]string, error) // GetStopWordsWithContext retrieves the stop words of the index using the provided context for cancellation. GetStopWordsWithContext(ctx context.Context) (*[]string, error) // GetSynonyms retrieves the synonyms of the index. GetSynonyms() (*map[string][]string, error) // GetSynonymsWithContext retrieves the synonyms of the index using the provided context for cancellation. GetSynonymsWithContext(ctx context.Context) (*map[string][]string, error) // GetFilterableAttributes retrieves the filterable attributes of the index. GetFilterableAttributes() (*[]interface{}, error) // GetFilterableAttributesWithContext retrieves the filterable attributes of the index using the provided context for cancellation. GetFilterableAttributesWithContext(ctx context.Context) (*[]interface{}, error) // GetSortableAttributes retrieves the sortable attributes of the index. GetSortableAttributes() (*[]string, error) // GetSortableAttributesWithContext retrieves the sortable attributes of the index using the provided context for cancellation. GetSortableAttributesWithContext(ctx context.Context) (*[]string, error) // GetTypoTolerance retrieves the typo tolerance settings of the index. GetTypoTolerance() (*TypoTolerance, error) // GetTypoToleranceWithContext retrieves the typo tolerance settings of the index using the provided context for cancellation. GetTypoToleranceWithContext(ctx context.Context) (*TypoTolerance, error) // GetPagination retrieves the pagination settings of the index. GetPagination() (*Pagination, error) // GetPaginationWithContext retrieves the pagination settings of the index using the provided context for cancellation. GetPaginationWithContext(ctx context.Context) (*Pagination, error) // GetFaceting retrieves the faceting settings of the index. GetFaceting() (*Faceting, error) // GetFacetingWithContext retrieves the faceting settings of the index using the provided context for cancellation. GetFacetingWithContext(ctx context.Context) (*Faceting, error) // GetEmbedders retrieves the embedders of the index. GetEmbedders() (map[string]Embedder, error) // GetEmbeddersWithContext retrieves the embedders of the index using the provided context for cancellation. GetEmbeddersWithContext(ctx context.Context) (map[string]Embedder, error) // GetSearchCutoffMs retrieves the search cutoff time in milliseconds. GetSearchCutoffMs() (int64, error) // GetSearchCutoffMsWithContext retrieves the search cutoff time in milliseconds using the provided context for cancellation. GetSearchCutoffMsWithContext(ctx context.Context) (int64, error) // GetSeparatorTokens returns separators tokens // https://www.meilisearch.com/docs/reference/api/settings#get-separator-tokens GetSeparatorTokens() ([]string, error) // GetSeparatorTokensWithContext returns separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#get-separator-tokens GetSeparatorTokensWithContext(ctx context.Context) ([]string, error) // GetNonSeparatorTokens returns non-separator tokens // https://www.meilisearch.com/docs/reference/api/settings#get-non-separator-tokens GetNonSeparatorTokens() ([]string, error) // GetNonSeparatorTokensWithContext returns non-separator tokens and support parent context // https://www.meilisearch.com/docs/reference/api/settings#get-non-separator-tokens GetNonSeparatorTokensWithContext(ctx context.Context) ([]string, error) // GetDictionary returns user dictionary // //Allows users to instruct Meilisearch to consider groups of strings as a //single term by adding a supplementary dictionary of user-defined terms. //This is particularly useful when working with datasets containing many domain-specific //words, and in languages where words are not separated by whitespace such as Japanese. //Custom dictionaries are also useful in a few use-cases for space-separated languages, //such as datasets with names such as "J. R. R. Tolkien" and "W. E. B. Du Bois". // // https://www.meilisearch.com/docs/reference/api/settings#get-dictionary GetDictionary() ([]string, error) // GetDictionaryWithContext returns user dictionary and support parent context // //Allows users to instruct Meilisearch to consider groups of strings as a //single term by adding a supplementary dictionary of user-defined terms. //This is particularly useful when working with datasets containing many domain-specific //words, and in languages where words are not separated by whitespace such as Japanese. //Custom dictionaries are also useful in a few use-cases for space-separated languages, //such as datasets with names such as "J. R. R. Tolkien" and "W. E. B. Du Bois". // // https://www.meilisearch.com/docs/reference/api/settings#get-dictionary GetDictionaryWithContext(ctx context.Context) ([]string, error) // GetProximityPrecision returns ProximityPrecision configuration value // https://www.meilisearch.com/docs/reference/api/settings#get-proximity-precision-settings GetProximityPrecision() (ProximityPrecisionType, error) // GetProximityPrecisionWithContext returns ProximityPrecision configuration value and support parent context // https://www.meilisearch.com/docs/reference/api/settings#get-proximity-precision-settings GetProximityPrecisionWithContext(ctx context.Context) (ProximityPrecisionType, error) // GetLocalizedAttributes get the localized attributes settings of an index // https://www.meilisearch.com/docs/reference/api/settings#get-localized-attributes-settings GetLocalizedAttributes() ([]*LocalizedAttributes, error) // GetLocalizedAttributesWithContext get the localized attributes settings of an index using the provided context for cancellation // https://www.meilisearch.com/docs/reference/api/settings#get-localized-attributes-settings GetLocalizedAttributesWithContext(ctx context.Context) ([]*LocalizedAttributes, error) // GetPrefixSearch retrieves the prefix search setting of the index. GetPrefixSearch() (*string, error) // GetPrefixSearchWithContext retrieves the prefix search setting of the index using the provided context for cancellation. GetPrefixSearchWithContext(ctx context.Context) (*string, error) // GetFacetSearch retrieves the facet search setting of the index. GetFacetSearch() (bool, error) // GetFacetSearchWithContext retrieves the facet search setting of the index using the provided context for cancellation. GetFacetSearchWithContext(ctx context.Context) (bool, error) }
type SimilarDocumentQuery ΒΆ added in v0.27.2
type SimilarDocumentQuery struct { Id interface{} `json:"id,omitempty"` Embedder string `json:"embedder"` AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"` Offset int64 `json:"offset,omitempty"` Limit int64 `json:"limit,omitempty"` Filter string `json:"filter,omitempty"` ShowRankingScore bool `json:"showRankingScore,omitempty"` ShowRankingScoreDetails bool `json:"showRankingScoreDetails,omitempty"` RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"` RetrieveVectors bool `json:"retrieveVectors,omitempty"` }
SimilarDocumentQuery is query parameters of similar documents
type SimilarDocumentResult ΒΆ added in v0.27.2
type SimilarDocumentResult struct { Hits Hits `json:"hits,omitempty"` ID string `json:"id,omitempty"` ProcessingTimeMS int64 `json:"processingTimeMs,omitempty"` Limit int64 `json:"limit,omitempty"` Offset int64 `json:"offset,omitempty"` EstimatedTotalHits int64 `json:"estimatedTotalHits,omitempty"` }
type SortFacetType ΒΆ added in v0.28.0
type SortFacetType string // SortFacetType is type of facet sorting, alpha or count
const ( SortFacetTypeAlpha SortFacetType = "alpha" SortFacetTypeCount SortFacetType = "count" )
type Stats ΒΆ
type Stats struct { DatabaseSize int64 `json:"databaseSize"` UsedDatabaseSize int64 `json:"usedDatabaseSize"` LastUpdate time.Time `json:"lastUpdate"` Indexes map[string]StatsIndex `json:"indexes"` }
Stats is the type that represent all stats
type StatsIndex ΒΆ added in v0.9.1
type StatsIndex struct { NumberOfDocuments int64 `json:"numberOfDocuments"` IsIndexing bool `json:"isIndexing"` FieldDistribution map[string]int64 `json:"fieldDistribution"` RawDocumentDbSize int64 `json:"rawDocumentDbSize"` AvgDocumentSize int64 `json:"avgDocumentSize"` NumberOfEmbeddedDocuments int64 `json:"numberOfEmbeddedDocuments"` NumberOfEmbeddings int64 `json:"numberOfEmbeddings"` }
StatsIndex is the type that represent the stats of an index in meilisearch
type Stream ΒΆ added in v0.33.1
type Stream[T any] struct { // contains filtered or unexported fields }
type SwapIndexesParams ΒΆ added in v0.22.0
type Task ΒΆ added in v0.18.0
type Task struct { Status TaskStatus `json:"status"` UID int64 `json:"uid,omitempty"` TaskUID int64 `json:"taskUid,omitempty"` IndexUID string `json:"indexUid"` Type TaskType `json:"type"` Error meilisearchApiError `json:"error,omitempty"` TaskNetwork TaskNetwork `json:"network,omitempty"` Duration string `json:"duration,omitempty"` EnqueuedAt time.Time `json:"enqueuedAt"` StartedAt time.Time `json:"startedAt,omitempty"` FinishedAt time.Time `json:"finishedAt,omitempty"` Details Details `json:"details,omitempty"` CanceledBy int64 `json:"canceledBy,omitempty"` }
Task indicates information about a task resource
Documentation: https://www.meilisearch.com/docs/learn/advanced/asynchronous_operations
type TaskInfo ΒΆ added in v0.20.0
type TaskInfo struct { Status TaskStatus `json:"status"` TaskUID int64 `json:"taskUid"` IndexUID string `json:"indexUid"` Type TaskType `json:"type"` EnqueuedAt time.Time `json:"enqueuedAt"` }
TaskInfo indicates information regarding a task returned by an asynchronous method
Documentation: https://www.meilisearch.com/docs/reference/api/tasks#tasks
type TaskManager ΒΆ added in v0.30.0
type TaskManager interface { TaskReader // CancelTasks cancels specific tasks. CancelTasks(param *CancelTasksQuery) (*TaskInfo, error) // CancelTasksWithContext cancels specific tasks with a context for cancellation. CancelTasksWithContext(ctx context.Context, param *CancelTasksQuery) (*TaskInfo, error) // DeleteTasks deletes specific tasks. DeleteTasks(param *DeleteTasksQuery) (*TaskInfo, error) // DeleteTasksWithContext deletes specific tasks with a context for cancellation. DeleteTasksWithContext(ctx context.Context, param *DeleteTasksQuery) (*TaskInfo, error) }
type TaskNetwork ΒΆ added in v0.33.3
type TaskNetwork struct { Origin *Origin `json:"origin,omitempty"` Remotes map[string]*TaskRemote `json:"remotes,omitempty"` }
TaskNetwork indicates information about a task network
Documentation: https://www.meilisearch.com/docs/reference/api/tasks#network
type TaskReader ΒΆ added in v0.30.0
type TaskReader interface { // GetTask retrieves a task by its UID. GetTask(taskUID int64) (*Task, error) // GetTaskWithContext retrieves a task by its UID using the provided context for cancellation. GetTaskWithContext(ctx context.Context, taskUID int64) (*Task, error) // GetTasks retrieves multiple tasks based on query parameters. GetTasks(param *TasksQuery) (*TaskResult, error) // GetTasksWithContext retrieves multiple tasks based on query parameters using the provided context for cancellation. GetTasksWithContext(ctx context.Context, param *TasksQuery) (*TaskResult, error) // WaitForTask waits for a task to complete by its UID with the given interval. WaitForTask(taskUID int64, interval time.Duration) (*Task, error) // WaitForTaskWithContext waits for a task to complete by its UID with the given interval using the provided context for cancellation. WaitForTaskWithContext(ctx context.Context, taskUID int64, interval time.Duration) (*Task, error) }
type TaskRemote ΒΆ added in v0.33.3
type TaskResult ΒΆ added in v0.20.0
type TaskResult struct { Results []Task `json:"results"` Limit int64 `json:"limit"` From int64 `json:"from"` Next int64 `json:"next"` Total int64 `json:"total"` }
TaskResult return of multiple tasks is wrap in a TaskResult
type TaskStatus ΒΆ added in v0.18.0
type TaskStatus string // TaskStatus is the status of a task.
const ( // TaskStatusUnknown is the default TaskStatus, should not exist TaskStatusUnknown TaskStatus = "unknown" // TaskStatusEnqueued the task request has been received and will be processed soon TaskStatusEnqueued TaskStatus = "enqueued" // TaskStatusProcessing the task is being processed TaskStatusProcessing TaskStatus = "processing" // TaskStatusSucceeded the task has been successfully processed TaskStatusSucceeded TaskStatus = "succeeded" // TaskStatusFailed a failure occurred when processing the task, no changes were made to the database TaskStatusFailed TaskStatus = "failed" // TaskStatusCanceled the task was canceled TaskStatusCanceled TaskStatus = "canceled" )
type TaskType ΒΆ added in v0.26.0
type TaskType string // TaskType is the type of a task
const ( // TaskTypeIndexCreation represents an index creation TaskTypeIndexCreation TaskType = "indexCreation" // TaskTypeIndexUpdate represents an index update TaskTypeIndexUpdate TaskType = "indexUpdate" // TaskTypeIndexDeletion represents an index deletion TaskTypeIndexDeletion TaskType = "indexDeletion" // TaskTypeIndexSwap represents an index swap TaskTypeIndexSwap TaskType = "indexSwap" // TaskTypeDocumentAdditionOrUpdate represents a document addition or update in an index TaskTypeDocumentAdditionOrUpdate TaskType = "documentAdditionOrUpdate" // TaskTypeDocumentDeletion represents a document deletion from an index TaskTypeDocumentDeletion TaskType = "documentDeletion" // TaskTypeSettingsUpdate represents a settings update TaskTypeSettingsUpdate TaskType = "settingsUpdate" // TaskTypeDumpCreation represents a dump creation TaskTypeDumpCreation TaskType = "dumpCreation" // TaskTypeTaskCancelation represents a task cancelation TaskTypeTaskCancelation TaskType = "taskCancelation" // TaskTypeTaskDeletion represents a task deletion TaskTypeTaskDeletion TaskType = "taskDeletion" // TaskTypeSnapshotCreation represents a snapshot creation TaskTypeSnapshotCreation TaskType = "snapshotCreation" // TaskTypeExport represents a task exportation TaskTypeExport TaskType = "export" )
type TasksQuery ΒΆ added in v0.20.0
type TasksQuery struct { UIDS []int64 Limit int64 From int64 IndexUIDS []string Statuses []TaskStatus Types []TaskType CanceledBy []int64 BeforeEnqueuedAt time.Time AfterEnqueuedAt time.Time BeforeStartedAt time.Time AfterStartedAt time.Time BeforeFinishedAt time.Time AfterFinishedAt time.Time Reverse bool }
TasksQuery is a list of filter available to send as query parameters
type TenantTokenClaims ΒΆ added in v0.19.0
type TenantTokenClaims struct { APIKeyUID string `json:"apiKeyUid"` SearchRules interface{} `json:"searchRules"` jwt.RegisteredClaims }
TenantTokenClaims custom Claims structure to create a Tenant Token
type TenantTokenOptions ΒΆ added in v0.19.0
TenantTokenOptions information to create a tenant token
ExpiresAt is a time.Time when the key will expire. Note that if an ExpiresAt value is included it should be in UTC time. ApiKey is the API key parent of the token.
type Timestampz ΒΆ added in v0.33.1
type Timestampz int64
func (Timestampz) String ΒΆ added in v0.33.1
func (t Timestampz) String() string
func (Timestampz) ToTime ΒΆ added in v0.33.1
func (t Timestampz) ToTime() time.Time
type TypoTolerance ΒΆ added in v0.19.1
type TypoTolerance struct { Enabled bool `json:"enabled"` MinWordSizeForTypos MinWordSizeForTypos `json:"minWordSizeForTypos,omitempty"` DisableOnWords []string `json:"disableOnWords,omitempty"` DisableOnAttributes []string `json:"disableOnAttributes,omitempty"` DisableOnNumbers bool `json:"disableOnNumbers,omitempty"` }
TypoTolerance is the type that represents the typo tolerance setting in meilisearch
type UpdateDocumentByFunctionRequest ΒΆ added in v0.30.0
type UpdateIndexRequestParams ΒΆ added in v0.34.0
type UpdateIndexRequestParams struct { PrimaryKey string `json:"primaryKey,omitempty"` UID string `json:"uid,omitempty"` }
UpdateIndexRequest is the request body for update Index primary key and renaming IndexUid
type UpdateWebhookRequest ΒΆ added in v0.33.1
type Version ΒΆ
type Version struct { CommitSha string `json:"commitSha"` CommitDate string `json:"commitDate"` PkgVersion string `json:"pkgVersion"` }
Version is the type that represents the versions in meilisearch
type WebhookManager ΒΆ added in v0.33.1
type WebhookManager interface { WebhookReader // AddWebhook add a new webhook to meilisearch. AddWebhook(params *AddWebhookRequest) (*Webhook, error) // AddWebhookWithContext add a new webhook to meilisearch with a context. AddWebhookWithContext(ctx context.Context, params *AddWebhookRequest) (*Webhook, error) // UpdateWebhook modifies a previously existing webhook. // If the webhook has isEditable to false the HTTP call returns an error. UpdateWebhook(uuid string, params *UpdateWebhookRequest) (*Webhook, error) // UpdateWebhookWithContext modifies a previously existing webhook with a context. // If the webhook has isEditable to false the HTTP call returns an error. UpdateWebhookWithContext(ctx context.Context, uuid string, params *UpdateWebhookRequest) (*Webhook, error) // DeleteWebhook deletes an existing webhook. Will also fail when the webhook doesnβt exist. // If the webhook has isEditable to false the HTTP call returns an error. DeleteWebhook(uuid string) error // DeleteWebhookWithContext deletes an existing webhook with a context. Will also fail when the webhook doesnβt exist. // If the webhook has isEditable to false the HTTP call returns an error. DeleteWebhookWithContext(ctx context.Context, uuid string) error }
type WebhookReader ΒΆ added in v0.33.1
type WebhookReader interface { // ListWebhooks lists all the webhooks. ListWebhooks() (*WebhookResults, error) // ListWebhooksWithContext lists all the webhooks with context. ListWebhooksWithContext(ctx context.Context) (*WebhookResults, error) // GetWebhook gets a webhook by uuid. GetWebhook(uuid string) (*Webhook, error) // GetWebhookWithContext gets a webhook by uuid with a context. GetWebhookWithContext(ctx context.Context, uuid string) (*Webhook, error) }
type WebhookResults ΒΆ added in v0.33.1
type WebhookResults struct {
Result []*Webhook `json:"results"`
}
Source Files
ΒΆ
- chat.go
- chat_interface.go
- client.go
- doc.go
- encoding.go
- enum.go
- error.go
- features.go
- field.go
- helper.go
- hit.go
- index.go
- index_document.go
- index_interface.go
- index_search.go
- index_settings.go
- index_task.go
- meilisearch.go
- meilisearch_interface.go
- networks.go
- options.go
- pool.go
- stream.go
- types.go
- version.go
- webhooks.go
- webhooks_interface.go
Directories
ΒΆ
Path | Synopsis |
---|---|
examples
|
|
add_documents
command
|
|
chat_stream
command
|
|
create_index_settings
command
|
|
facet_search
command
|
|
manage_tasks
command
|
|
multi_search
command
|
|
search
command
|