Documentation
ΒΆ
Index ΒΆ
- Constants
- type Client
- func (c *Client) CreateDump() (resp *Dump, err error)
- func (c *Client) CreateIndex(config *IndexConfig) (resp *Task, err error)
- func (c *Client) CreateKey(request *Key) (resp *Key, err error)
- func (c *Client) DeleteIndex(uid string) (resp *Task, err error)
- func (c *Client) DeleteKey(identifier string) (resp bool, err error)
- func (c *Client) GenerateTenantToken(SearchRules map[string]interface{}, Options *TenantTokenOptions) (resp string, err error)
- func (c *Client) GetAllIndexes() (resp []*Index, err error)
- func (c *Client) GetAllRawIndexes() (resp []map[string]interface{}, err error)
- func (c *Client) GetAllStats() (resp *Stats, err error)
- func (c *Client) GetDumpStatus(dumpUID string) (resp *Dump, err error)
- func (c *Client) GetIndex(uid string) (resp *Index, err error)
- func (c *Client) GetKey(identifier string) (resp *Key, err error)
- func (c *Client) GetKeys() (resp *ResultKey, err error)
- func (c *Client) GetRawIndex(uid string) (resp map[string]interface{}, err error)
- func (c *Client) GetTask(taskID int64) (resp *Task, err error)
- func (c *Client) GetTasks() (resp *ResultTask, err error)
- func (c *Client) GetVersion() (resp *Version, err error)
- func (c *Client) Health() (resp *Health, err error)
- func (c *Client) Index(uid string) *Index
- func (c *Client) IsHealthy() bool
- func (v Client) MarshalEasyJSON(w *jwriter.Writer)
- func (v Client) MarshalJSON() ([]byte, error)
- func (v *Client) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Client) UnmarshalJSON(data []byte) error
- func (c *Client) UpdateKey(identifier string, request *Key) (resp *Key, err error)
- func (c *Client) Version() (resp *Version, err error)
- func (c *Client) WaitForTask(task *Task, options ...WaitParams) (*Task, error)
- type ClientConfig
- type ClientInterface
- type CreateIndexRequest
- type Details
- type DocumentsRequest
- type Dump
- type DumpStatus
- type ErrCode
- type Error
- type Health
- type Index
- func (i Index) AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *Task, err error)
- func (i Index) AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *Task, err error)
- func (i Index) AddDocumentsCsvFromReader(documents io.Reader, primaryKey ...string) (resp *Task, err error)
- func (i Index) AddDocumentsCsvFromReaderInBatches(documents io.Reader, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) AddDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) AddDocumentsNdjson(documents []byte, primaryKey ...string) (resp *Task, err error)
- func (i Index) AddDocumentsNdjsonFromReader(documents io.Reader, primaryKey ...string) (resp *Task, err error)
- func (i Index) AddDocumentsNdjsonFromReaderInBatches(documents io.Reader, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) AddDocumentsNdjsonInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) Delete(uid string) (ok bool, err error)
- func (i Index) DeleteAllDocuments() (resp *Task, err error)
- func (i Index) DeleteDocument(identifier string) (resp *Task, err error)
- func (i Index) DeleteDocuments(identifier []string) (resp *Task, err error)
- func (i Index) FetchInfo() (resp *Index, err error)
- func (i Index) FetchPrimaryKey() (resp *string, err error)
- func (i Index) GetDisplayedAttributes() (resp *[]string, err error)
- func (i Index) GetDistinctAttribute() (resp *string, err error)
- func (i Index) GetDocument(identifier string, documentPtr interface{}) error
- func (i Index) GetDocuments(request *DocumentsRequest, resp interface{}) error
- func (i Index) GetFilterableAttributes() (resp *[]string, err error)
- func (i Index) GetRankingRules() (resp *[]string, err error)
- func (i Index) GetSearchableAttributes() (resp *[]string, err error)
- func (i Index) GetSettings() (resp *Settings, err error)
- func (i Index) GetSortableAttributes() (resp *[]string, err error)
- func (i Index) GetStats() (resp *StatsIndex, err error)
- func (i Index) GetStopWords() (resp *[]string, err error)
- func (i Index) GetSynonyms() (resp *map[string][]string, err error)
- func (i Index) GetTask(taskID int64) (resp *Task, err error)
- func (i Index) GetTasks() (resp *ResultTask, err error)
- func (v Index) MarshalEasyJSON(w *jwriter.Writer)
- func (v Index) MarshalJSON() ([]byte, error)
- func (i Index) ResetDisplayedAttributes() (resp *Task, err error)
- func (i Index) ResetDistinctAttribute() (resp *Task, err error)
- func (i Index) ResetFilterableAttributes() (resp *Task, err error)
- func (i Index) ResetRankingRules() (resp *Task, err error)
- func (i Index) ResetSearchableAttributes() (resp *Task, err error)
- func (i Index) ResetSettings() (resp *Task, err error)
- func (i Index) ResetSortableAttributes() (resp *Task, err error)
- func (i Index) ResetStopWords() (resp *Task, err error)
- func (i Index) ResetSynonyms() (resp *Task, err error)
- func (i Index) Search(query string, request *SearchRequest) (*SearchResponse, error)
- func (v *Index) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Index) UnmarshalJSON(data []byte) error
- func (i Index) UpdateDisplayedAttributes(request *[]string) (resp *Task, err error)
- func (i Index) UpdateDistinctAttribute(request string) (resp *Task, err error)
- func (i Index) UpdateDocuments(documentsPtr interface{}, primaryKey ...string) (resp *Task, err error)
- func (i Index) UpdateDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []Task, err error)
- func (i Index) UpdateFilterableAttributes(request *[]string) (resp *Task, err error)
- func (i Index) UpdateIndex(primaryKey string) (resp *Task, err error)
- func (i Index) UpdateRankingRules(request *[]string) (resp *Task, err error)
- func (i Index) UpdateSearchableAttributes(request *[]string) (resp *Task, err error)
- func (i Index) UpdateSettings(request *Settings) (resp *Task, err error)
- func (i Index) UpdateSortableAttributes(request *[]string) (resp *Task, err error)
- func (i Index) UpdateStopWords(request *[]string) (resp *Task, err error)
- func (i Index) UpdateSynonyms(request *map[string][]string) (resp *Task, err error)
- func (i Index) WaitForTask(task *Task, options ...WaitParams) (*Task, error)
- type IndexConfig
- type IndexInterface
- type Key
- type KeyParsed
- type RawType
- type ResultKey
- type ResultTask
- type SearchRequest
- type SearchResponse
- type Settings
- type Stats
- type StatsIndex
- type Task
- type TaskStatus
- type TenantTokenClaims
- type TenantTokenOptions
- type Unknown
- type UpdateIndexRequest
- type Version
- type WaitParams
Constants ΒΆ
const (
DefaultLimit int64 = 20
)
This constant contains the default values assigned by Meilisearch to the limit in search parameters
Documentation: https://docs.meilisearch.com/reference/features/search_parameters.html
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Client ΒΆ
type Client struct {
// contains filtered or unexported fields
}
Client is a structure that give you the power for interacting with an high-level api with Meilisearch.
func NewClient ΒΆ
func NewClient(config ClientConfig) *Client
NewClient creates Meilisearch with default fasthttp.Client
func NewFastHTTPCustomClient ΒΆ added in v0.13.1
func NewFastHTTPCustomClient(config ClientConfig, client *fasthttp.Client) *Client
NewFastHTTPCustomClient creates Meilisearch with custom fasthttp.Client
func (*Client) CreateDump ΒΆ added in v0.15.0
func (*Client) CreateIndex ΒΆ added in v0.15.0
func (c *Client) CreateIndex(config *IndexConfig) (resp *Task, err error)
func (*Client) DeleteIndex ΒΆ added in v0.15.0
func (*Client) GenerateTenantToken ΒΆ added in v0.19.0
func (c *Client) GenerateTenantToken(SearchRules map[string]interface{}, Options *TenantTokenOptions) (resp string, err error)
Generate a JWT token for the use of multitenancy
SearchRules parameters is mandatory and should contains the rules to be enforced at search time for all or specific accessible indexes for the signing API Key. ExpiresAt options is a time.Time when the key will expire. Note that if an ExpiresAt value is included it should be in UTC time. ApiKey options is the API key parent of the token. If you leave it empty the client API Key will be used.
func (*Client) GetAllIndexes ΒΆ added in v0.15.0
func (*Client) GetAllRawIndexes ΒΆ added in v0.16.2
func (*Client) GetAllStats ΒΆ added in v0.15.0
func (*Client) GetDumpStatus ΒΆ added in v0.15.0
func (*Client) GetRawIndex ΒΆ added in v0.17.0
func (*Client) GetTasks ΒΆ added in v0.18.0
func (c *Client) GetTasks() (resp *ResultTask, err error)
func (*Client) GetVersion ΒΆ added in v0.15.0
func (Client) MarshalEasyJSON ΒΆ added in v0.15.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Client) MarshalJSON ΒΆ added in v0.15.0
MarshalJSON supports json.Marshaler interface
func (*Client) UnmarshalEasyJSON ΒΆ added in v0.15.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Client) UnmarshalJSON ΒΆ added in v0.15.0
UnmarshalJSON supports json.Unmarshaler interface
func (*Client) WaitForTask ΒΆ added in v0.18.0
func (c *Client) WaitForTask(task *Task, options ...WaitParams) (*Task, error)
WaitForTask waits for a task to be processed
The function will check by regular interval provided in parameter interval the TaskStatus. If no ctx and interval are provided WaitForTask will check each 50ms the status of a task.
type ClientConfig ΒΆ added in v0.15.0
type ClientConfig struct {
// Host is the host of your Meilisearch database
// Example: 'http://localhost:7700'
Host string
// APIKey is optional
APIKey string
// Timeout is optional
Timeout time.Duration
}
ClientConfig configure the Client
type ClientInterface ΒΆ added in v0.13.1
type ClientInterface interface {
Index(uid string) *Index
GetIndex(indexID string) (resp *Index, err error)
GetRawIndex(uid string) (resp map[string]interface{}, err error)
GetAllIndexes() (resp []*Index, err error)
GetAllRawIndexes() (resp []map[string]interface{}, err error)
CreateIndex(config *IndexConfig) (resp *Task, err error)
DeleteIndex(uid string) (resp *Task, err error)
CreateKey(request *Key) (resp *Key, err error)
GetKey(identifier string) (resp *Key, err error)
GetKeys() (resp *ResultKey, err error)
UpdateKey(identifier string, request *Key) (resp *Key, err error)
DeleteKey(identifier string) (resp bool, err error)
GetAllStats() (resp *Stats, err error)
CreateDump() (resp *Dump, err error)
GetDumpStatus(dumpUID string) (resp *Dump, err error)
Version() (*Version, error)
GetVersion() (resp *Version, err error)
Health() (*Health, error)
IsHealthy() bool
GetTask(taskID int64) (resp *Task, err error)
GetTasks() (resp *ResultTask, err error)
WaitForTask(task *Task, options ...WaitParams) (*Task, error)
GenerateTenantToken(searchRules map[string]interface{}, options *TenantTokenOptions) (resp string, err error)
}
ClientInterface is interface for all Meilisearch client
type CreateIndexRequest ΒΆ
type CreateIndexRequest struct {
UID string `json:"uid,omitempty"`
PrimaryKey string `json:"primaryKey,omitempty"`
}
CreateIndexRequest is the request body for create index method
func (CreateIndexRequest) MarshalEasyJSON ΒΆ added in v0.13.1
func (v CreateIndexRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (CreateIndexRequest) MarshalJSON ΒΆ added in v0.13.1
func (v CreateIndexRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*CreateIndexRequest) UnmarshalEasyJSON ΒΆ added in v0.13.1
func (v *CreateIndexRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*CreateIndexRequest) UnmarshalJSON ΒΆ added in v0.13.1
func (v *CreateIndexRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Details ΒΆ added in v0.18.0
type Details struct {
ReceivedDocuments int `json:"receivedDocuments,omitempty"`
IndexedDocuments int `json:"indexedDocuments,omitempty"`
DeletedDocuments int `json:"deletedDocuments,omitempty"`
PrimaryKey string `json:"primaryKey,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 []string `json:"filterableAttributes,omitempty"`
SortableAttributes []string `json:"sortableAttributes,omitempty"`
}
func (Details) MarshalEasyJSON ΒΆ added in v0.18.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Details) MarshalJSON ΒΆ added in v0.18.0
MarshalJSON supports json.Marshaler interface
func (*Details) UnmarshalEasyJSON ΒΆ added in v0.18.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Details) UnmarshalJSON ΒΆ added in v0.18.0
UnmarshalJSON supports json.Unmarshaler interface
type DocumentsRequest ΒΆ added in v0.15.0
type DocumentsRequest struct {
Offset int64 `json:"offset,omitempty"`
Limit int64 `json:"limit,omitempty"`
AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
}
DocumentsRequest is the request body for list documents method
func (DocumentsRequest) MarshalEasyJSON ΒΆ added in v0.15.0
func (v DocumentsRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DocumentsRequest) MarshalJSON ΒΆ added in v0.15.0
func (v DocumentsRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DocumentsRequest) UnmarshalEasyJSON ΒΆ added in v0.15.0
func (v *DocumentsRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DocumentsRequest) UnmarshalJSON ΒΆ added in v0.15.0
func (v *DocumentsRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Dump ΒΆ added in v0.14.1
type Dump struct {
UID string `json:"uid"`
Status DumpStatus `json:"status"`
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
}
Dump indicate information about an dump
Documentation: https://docs.meilisearch.com/reference/api/dump.html
func (Dump) MarshalEasyJSON ΒΆ added in v0.14.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Dump) MarshalJSON ΒΆ added in v0.14.1
MarshalJSON supports json.Marshaler interface
func (*Dump) UnmarshalEasyJSON ΒΆ added in v0.14.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Dump) UnmarshalJSON ΒΆ added in v0.14.1
UnmarshalJSON supports json.Unmarshaler interface
type DumpStatus ΒΆ added in v0.17.0
type DumpStatus string
DumpStatus is the status of a dump
const ( // DumpStatusInProgress means the server is processing the dump DumpStatusInProgress DumpStatus = "in_progress" // DumpStatusFailed means the server failed to create a dump DumpStatusFailed DumpStatus = "failed" // DumpStatusDone means the server completed the dump DumpStatusDone DumpStatus = "done" )
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 // MeilisearchApiError send by the Meilisearch api MeilisearchApiErrorWithoutMessage // MeilisearchTimeoutError MeilisearchTimeoutError // MeilisearchCommunicationError impossible execute a request MeilisearchCommunicationError )
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 Health ΒΆ added in v0.13.1
type Health struct {
Status string `json:"status"`
}
Health is the request body for set Meilisearch health
func (Health) MarshalEasyJSON ΒΆ added in v0.13.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Health) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (*Health) UnmarshalEasyJSON ΒΆ added in v0.13.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Health) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface
type Index ΒΆ
type Index struct {
UID string `json:"uid"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
PrimaryKey string `json:"primaryKey,omitempty"`
// contains filtered or unexported fields
}
Index is the type that represent an index in Meilisearch
func (Index) AddDocuments ΒΆ added in v0.15.0
func (Index) AddDocumentsCsv ΒΆ added in v0.18.0
func (Index) AddDocumentsCsvFromReader ΒΆ added in v0.18.0
func (Index) AddDocumentsCsvFromReaderInBatches ΒΆ added in v0.18.0
func (Index) AddDocumentsCsvInBatches ΒΆ added in v0.18.0
func (Index) AddDocumentsInBatches ΒΆ added in v0.17.0
func (Index) AddDocumentsNdjson ΒΆ added in v0.18.0
func (Index) AddDocumentsNdjsonFromReader ΒΆ added in v0.18.0
func (Index) AddDocumentsNdjsonFromReaderInBatches ΒΆ added in v0.18.0
func (Index) AddDocumentsNdjsonInBatches ΒΆ added in v0.18.0
func (Index) DeleteAllDocuments ΒΆ added in v0.15.0
func (Index) DeleteDocument ΒΆ added in v0.15.0
func (Index) DeleteDocuments ΒΆ added in v0.15.0
func (Index) FetchPrimaryKey ΒΆ added in v0.15.0
func (Index) GetDisplayedAttributes ΒΆ added in v0.15.0
func (Index) GetDistinctAttribute ΒΆ added in v0.15.0
func (Index) GetDocument ΒΆ added in v0.15.0
func (Index) GetDocuments ΒΆ added in v0.15.0
func (i Index) GetDocuments(request *DocumentsRequest, resp interface{}) error
func (Index) GetFilterableAttributes ΒΆ added in v0.16.0
func (Index) GetRankingRules ΒΆ added in v0.15.0
func (Index) GetSearchableAttributes ΒΆ added in v0.15.0
func (Index) GetSettings ΒΆ added in v0.15.0
func (Index) GetSortableAttributes ΒΆ added in v0.16.1
func (Index) GetStats ΒΆ added in v0.15.0
func (i Index) GetStats() (resp *StatsIndex, err error)
func (Index) GetStopWords ΒΆ added in v0.15.0
func (Index) GetSynonyms ΒΆ added in v0.15.0
func (Index) GetTasks ΒΆ added in v0.18.0
func (i Index) GetTasks() (resp *ResultTask, err error)
func (Index) MarshalEasyJSON ΒΆ added in v0.13.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Index) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (Index) ResetDisplayedAttributes ΒΆ added in v0.15.0
func (Index) ResetDistinctAttribute ΒΆ added in v0.15.0
func (Index) ResetFilterableAttributes ΒΆ added in v0.16.0
func (Index) ResetRankingRules ΒΆ added in v0.15.0
func (Index) ResetSearchableAttributes ΒΆ added in v0.15.0
func (Index) ResetSettings ΒΆ added in v0.15.0
func (Index) ResetSortableAttributes ΒΆ added in v0.16.1
func (Index) ResetStopWords ΒΆ added in v0.15.0
func (Index) ResetSynonyms ΒΆ added in v0.15.0
func (Index) Search ΒΆ added in v0.15.0
func (i Index) Search(query string, request *SearchRequest) (*SearchResponse, error)
func (*Index) UnmarshalEasyJSON ΒΆ added in v0.13.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Index) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface
func (Index) UpdateDisplayedAttributes ΒΆ added in v0.15.0
func (Index) UpdateDistinctAttribute ΒΆ added in v0.15.0
func (Index) UpdateDocuments ΒΆ added in v0.15.0
func (Index) UpdateDocumentsInBatches ΒΆ added in v0.17.0
func (Index) UpdateFilterableAttributes ΒΆ added in v0.16.0
func (Index) UpdateIndex ΒΆ added in v0.15.0
func (Index) UpdateRankingRules ΒΆ added in v0.15.0
func (Index) UpdateSearchableAttributes ΒΆ added in v0.15.0
func (Index) UpdateSettings ΒΆ added in v0.15.0
func (Index) UpdateSortableAttributes ΒΆ added in v0.16.1
func (Index) UpdateStopWords ΒΆ added in v0.15.0
func (Index) UpdateSynonyms ΒΆ added in v0.15.0
func (Index) WaitForTask ΒΆ added in v0.18.0
func (i Index) WaitForTask(task *Task, options ...WaitParams) (*Task, error)
WaitForTask waits for a task to be processed. The function will check by regular interval provided in parameter interval the TaskStatus. If no ctx and interval are provided WaitForTask will check each 50ms the status of a task.
type IndexConfig ΒΆ added in v0.15.0
type IndexConfig struct {
// Uid is the unique identifier of a given index.
Uid string
// PrimaryKey is optional
PrimaryKey string
// contains filtered or unexported fields
}
IndexConfig configure the Index
type IndexInterface ΒΆ added in v0.15.0
type IndexInterface interface {
FetchInfo() (resp *Index, err error)
FetchPrimaryKey() (resp *string, err error)
UpdateIndex(primaryKey string) (resp *Task, err error)
Delete(uid string) (ok bool, err error)
GetStats() (resp *StatsIndex, err error)
AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *Task, err error)
AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []Task, err error)
AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *Task, err error)
AddDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []Task, err error)
AddDocumentsNdjson(documents []byte, primaryKey ...string) (resp *Task, err error)
AddDocumentsNdjsonInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []Task, err error)
UpdateDocuments(documentsPtr interface{}, primaryKey ...string) (resp *Task, err error)
GetDocument(uid string, documentPtr interface{}) error
GetDocuments(request *DocumentsRequest, resp interface{}) error
DeleteDocument(uid string) (resp *Task, err error)
DeleteDocuments(uid []string) (resp *Task, err error)
DeleteAllDocuments() (resp *Task, err error)
Search(query string, request *SearchRequest) (*SearchResponse, error)
GetTask(taskID int64) (resp *Task, err error)
GetTasks() (resp *ResultTask, err error)
GetSettings() (resp *Settings, err error)
UpdateSettings(request *Settings) (resp *Task, err error)
ResetSettings() (resp *Task, err error)
GetRankingRules() (resp *[]string, err error)
UpdateRankingRules(request *[]string) (resp *Task, err error)
ResetRankingRules() (resp *Task, err error)
GetDistinctAttribute() (resp *string, err error)
UpdateDistinctAttribute(request string) (resp *Task, err error)
ResetDistinctAttribute() (resp *Task, err error)
GetSearchableAttributes() (resp *[]string, err error)
UpdateSearchableAttributes(request *[]string) (resp *Task, err error)
ResetSearchableAttributes() (resp *Task, err error)
GetDisplayedAttributes() (resp *[]string, err error)
UpdateDisplayedAttributes(request *[]string) (resp *Task, err error)
ResetDisplayedAttributes() (resp *Task, err error)
GetStopWords() (resp *[]string, err error)
UpdateStopWords(request *[]string) (resp *Task, err error)
ResetStopWords() (resp *Task, err error)
GetSynonyms() (resp *map[string][]string, err error)
UpdateSynonyms(request *map[string][]string) (resp *Task, err error)
ResetSynonyms() (resp *Task, err error)
GetFilterableAttributes() (resp *[]string, err error)
UpdateFilterableAttributes(request *[]string) (resp *Task, err error)
ResetFilterableAttributes() (resp *Task, err error)
WaitForTask(task *Task, options ...WaitParams) (*Task, error)
}
type Key ΒΆ added in v0.18.0
type Key struct {
Description string `json:"description"`
Key string `json:"key,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"`
}
Keys allow the user to connect to the Meilisearch instance
Documentation: https://docs.meilisearch.com/learn/advanced/security.html#protecting-a-meilisearch-instance
func (Key) MarshalEasyJSON ΒΆ added in v0.18.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Key) MarshalJSON ΒΆ added in v0.18.0
MarshalJSON supports json.Marshaler interface
func (*Key) UnmarshalEasyJSON ΒΆ added in v0.18.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Key) UnmarshalJSON ΒΆ added in v0.18.0
UnmarshalJSON supports json.Unmarshaler interface
type KeyParsed ΒΆ added in v0.18.0
type KeyParsed struct {
Description string `json:"description"`
Key string `json:"key,omitempty"`
Actions []string `json:"actions,omitempty"`
Indexes []string `json:"indexes,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
ExpiresAt *string `json:"expiresAt"`
}
This structure is used to send the exact ISO-8601 time format managed by Meilisearch
func (KeyParsed) MarshalEasyJSON ΒΆ added in v0.18.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (KeyParsed) MarshalJSON ΒΆ added in v0.18.0
MarshalJSON supports json.Marshaler interface
func (*KeyParsed) UnmarshalEasyJSON ΒΆ added in v0.18.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*KeyParsed) UnmarshalJSON ΒΆ added in v0.18.0
UnmarshalJSON supports json.Unmarshaler interface
type RawType ΒΆ added in v0.13.1
type RawType []byte
RawType is an alias for raw byte[]
func (RawType) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (*RawType) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface
type ResultKey ΒΆ added in v0.18.0
type ResultKey struct {
Results []Key `json:"results"`
}
func (ResultKey) MarshalEasyJSON ΒΆ added in v0.18.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultKey) MarshalJSON ΒΆ added in v0.18.0
MarshalJSON supports json.Marshaler interface
func (*ResultKey) UnmarshalEasyJSON ΒΆ added in v0.18.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultKey) UnmarshalJSON ΒΆ added in v0.18.0
UnmarshalJSON supports json.Unmarshaler interface
type ResultTask ΒΆ added in v0.18.0
type ResultTask struct {
Results []Task `json:"results"`
}
func (ResultTask) MarshalEasyJSON ΒΆ added in v0.18.0
func (v ResultTask) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResultTask) MarshalJSON ΒΆ added in v0.18.0
func (v ResultTask) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResultTask) UnmarshalEasyJSON ΒΆ added in v0.18.0
func (v *ResultTask) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResultTask) UnmarshalJSON ΒΆ added in v0.18.0
func (v *ResultTask) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SearchRequest ΒΆ
type SearchRequest struct {
Offset int64
Limit int64
AttributesToRetrieve []string
AttributesToCrop []string
CropLength int64
AttributesToHighlight []string
Filter interface{}
Matches bool
FacetsDistribution []string
PlaceholderSearch bool
Sort []string
}
SearchRequest is the request url param needed for a search query. This struct will be converted to url param before sent.
Documentation: https://docs.meilisearch.com/reference/features/search_parameters.html
func (SearchRequest) MarshalEasyJSON ΒΆ added in v0.13.1
func (v SearchRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SearchRequest) MarshalJSON ΒΆ added in v0.13.1
func (v SearchRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SearchRequest) UnmarshalEasyJSON ΒΆ added in v0.13.1
func (v *SearchRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SearchRequest) UnmarshalJSON ΒΆ added in v0.13.1
func (v *SearchRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SearchResponse ΒΆ
type SearchResponse struct {
Hits []interface{} `json:"hits"`
NbHits int64 `json:"nbHits"`
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
ExhaustiveNbHits bool `json:"exhaustiveNbHits"`
ProcessingTimeMs int64 `json:"processingTimeMs"`
Query string `json:"query"`
FacetsDistribution interface{} `json:"facetsDistribution,omitempty"`
ExhaustiveFacetsCount interface{} `json:"exhaustiveFacetsCount,omitempty"`
}
SearchResponse is the response body for search method
func (SearchResponse) MarshalEasyJSON ΒΆ added in v0.13.1
func (v SearchResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SearchResponse) MarshalJSON ΒΆ added in v0.13.1
func (v SearchResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SearchResponse) UnmarshalEasyJSON ΒΆ added in v0.13.1
func (v *SearchResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SearchResponse) UnmarshalJSON ΒΆ added in v0.13.1
func (v *SearchResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Settings ΒΆ
type Settings struct {
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 []string `json:"filterableAttributes,omitempty"`
SortableAttributes []string `json:"sortableAttributes,omitempty"`
}
Settings is the type that represents the settings in Meilisearch
func (Settings) MarshalEasyJSON ΒΆ added in v0.13.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Settings) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (*Settings) UnmarshalEasyJSON ΒΆ added in v0.13.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Settings) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface
type Stats ΒΆ
type Stats struct {
DatabaseSize int64 `json:"databaseSize"`
LastUpdate time.Time `json:"lastUpdate"`
Indexes map[string]StatsIndex `json:"indexes"`
}
Stats is the type that represent all stats
func (Stats) MarshalEasyJSON ΒΆ added in v0.13.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Stats) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (*Stats) UnmarshalEasyJSON ΒΆ added in v0.13.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Stats) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface
type StatsIndex ΒΆ added in v0.9.1
type StatsIndex struct {
NumberOfDocuments int64 `json:"numberOfDocuments"`
IsIndexing bool `json:"isIndexing"`
FieldDistribution map[string]int64 `json:"fieldDistribution"`
}
StatsIndex is the type that represent the stats of an index in Meilisearch
func (StatsIndex) MarshalEasyJSON ΒΆ added in v0.13.1
func (v StatsIndex) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (StatsIndex) MarshalJSON ΒΆ added in v0.13.1
func (v StatsIndex) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*StatsIndex) UnmarshalEasyJSON ΒΆ added in v0.13.1
func (v *StatsIndex) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*StatsIndex) UnmarshalJSON ΒΆ added in v0.13.1
func (v *StatsIndex) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Task ΒΆ added in v0.18.0
type Task struct {
Status TaskStatus `json:"status"`
UID int64 `json:"uid"`
IndexUID string `json:"indexUid"`
Type string `json:"type"`
Error meilisearchApiError `json:"error,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"`
}
Task indicate information about a task is returned for asynchronous method
Documentation: https://docs.meilisearch.com/learn/advanced/asynchronous_operations.html
func (Task) MarshalEasyJSON ΒΆ added in v0.18.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Task) MarshalJSON ΒΆ added in v0.18.0
MarshalJSON supports json.Marshaler interface
func (*Task) UnmarshalEasyJSON ΒΆ added in v0.18.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Task) UnmarshalJSON ΒΆ added in v0.18.0
UnmarshalJSON supports json.Unmarshaler interface
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" )
type TenantTokenClaims ΒΆ added in v0.19.0
type TenantTokenClaims struct {
APIKeyPrefix string `json:"apiKeyPrefix"`
SearchRules interface{} `json:"searchRules"`
jwt.StandardClaims
}
Custom Claims structure to create a Tenant Token
func (TenantTokenClaims) MarshalEasyJSON ΒΆ added in v0.19.0
func (v TenantTokenClaims) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TenantTokenClaims) MarshalJSON ΒΆ added in v0.19.0
func (v TenantTokenClaims) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TenantTokenClaims) UnmarshalEasyJSON ΒΆ added in v0.19.0
func (v *TenantTokenClaims) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TenantTokenClaims) UnmarshalJSON ΒΆ added in v0.19.0
func (v *TenantTokenClaims) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type TenantTokenOptions ΒΆ added in v0.19.0
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.
func (TenantTokenOptions) MarshalEasyJSON ΒΆ added in v0.19.0
func (v TenantTokenOptions) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TenantTokenOptions) MarshalJSON ΒΆ added in v0.19.0
func (v TenantTokenOptions) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TenantTokenOptions) UnmarshalEasyJSON ΒΆ added in v0.19.0
func (v *TenantTokenOptions) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TenantTokenOptions) UnmarshalJSON ΒΆ added in v0.19.0
func (v *TenantTokenOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type UpdateIndexRequest ΒΆ added in v0.15.0
type UpdateIndexRequest struct {
PrimaryKey string `json:"primaryKey"`
}
UpdateIndexRequest is the request body for update Index primary key
func (UpdateIndexRequest) MarshalEasyJSON ΒΆ added in v0.15.0
func (v UpdateIndexRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UpdateIndexRequest) MarshalJSON ΒΆ added in v0.15.0
func (v UpdateIndexRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UpdateIndexRequest) UnmarshalEasyJSON ΒΆ added in v0.15.0
func (v *UpdateIndexRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UpdateIndexRequest) UnmarshalJSON ΒΆ added in v0.15.0
func (v *UpdateIndexRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
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
func (Version) MarshalEasyJSON ΒΆ added in v0.13.1
MarshalEasyJSON supports easyjson.Marshaler interface
func (Version) MarshalJSON ΒΆ added in v0.13.1
MarshalJSON supports json.Marshaler interface
func (*Version) UnmarshalEasyJSON ΒΆ added in v0.13.1
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Version) UnmarshalJSON ΒΆ added in v0.13.1
UnmarshalJSON supports json.Unmarshaler interface