api

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MethodPostFunc   = func() string { return http.MethodPost }
	MethodPutFunc    = func() string { return http.MethodPut }
	MethodGetFunc    = func() string { return http.MethodGet }
	MethodDeleteFunc = func() string { return http.MethodDelete }
	MethodHeadFunc   = func() string { return http.MethodHead }
)

Functions

This section is empty.

Types

type API

type API struct {
	Document *Document
	Searcher *Searcher
	Indexer  *Indexer
	Cat      *Cat
	Ping     Ping
}

func New

func New(t Transport) *API

type ActionParam

type ActionParam struct {
	Index         string                 `json:"index,omitempty"`
	Indices       []string               `json:"indices,omitempty"`
	Alias         string                 `json:"alias,omitempty"`
	Aliases       []string               `json:"aliases,omitempty"`
	Filter        map[string]interface{} `json:"filter,omitempty"`
	IsHidden      bool                   `json:"is_hidden,omitempty"`
	MustExist     bool                   `json:"must_exist,omitempty"`
	IsWriteIndex  bool                   `json:"is_write_index,omitempty"`
	Routing       string                 `json:"routing,omitempty"`
	IndexRouting  string                 `json:"index_routing,omitempty"`
	SearchRouting string                 `json:"search_routing,omitempty"`
}

type AliasAction

type AliasAction struct {
	Add         *ActionParam `json:"add,omitempty"`
	Remove      *ActionParam `json:"remove,omitempty"`
	RemoveIndex *ActionParam `json:"remove_index,omitempty"`
}

type AliasExists

type AliasExists func(alias []string, o ...func(request *AliasExistsRequest)) (*Response, error)

func (AliasExists) WithIndex

func (f AliasExists) WithIndex(v ...string) func(*AliasExistsRequest)

type AliasExistsRequest

type AliasExistsRequest struct {
	BaseRequest
	Alias []string
}

type AliasGet

type AliasGet func(o ...func(*AliasGetRequest)) (*Response, error)

func (AliasGet) WithAlias

func (f AliasGet) WithAlias(v ...string) func(*AliasGetRequest)

func (AliasGet) WithIndex

func (f AliasGet) WithIndex(v ...string) func(*AliasGetRequest)

type AliasGetRequest

type AliasGetRequest struct {
	BaseRequest
	Alias []string
}

type Aliases

type Aliases func(actions []*AliasAction, o ...func(*AliasesRequest)) (*Response, error)

type AliasesRequest

type AliasesRequest struct {
	BaseRequest
}

type BaseRequest

type BaseRequest struct {
	Index string
	Body  *[]byte
	// contains filtered or unexported fields
}

func (*BaseRequest) AddParam

func (b *BaseRequest) AddParam(key, value string)

func (*BaseRequest) Do

func (b *BaseRequest) Do(ctx context.Context, transport Transport) (*Response, error)

type BulkAction

type BulkAction struct {
	Create *BulkItem `json:"create,omitempty"`
	Delete *BulkItem `json:"delete,omitempty"`
	Index  *BulkItem `json:"index,omitempty"`
	Update *BulkItem `json:"update,omitempty"`
}

type BulkItem

type BulkItem struct {
	Index           string `json:"_index,omitempty"`
	Id              string `json:"_id,omitempty"`
	RetryOnConflict int    `json:"retry_on_conflict,omitempty"`
}

type Cat

type Cat struct {
	Indices CatIndices
}

type CatIndices

type CatIndices func(o ...func(*CatIndicesRequest)) (*Response, error)

func (*CatIndices) WithColumns

func (f *CatIndices) WithColumns(v ...string) func(*CatIndicesRequest)

func (*CatIndices) WithFormat

func (f *CatIndices) WithFormat(v string) func(*CatIndicesRequest)

func (*CatIndices) WithIndex

func (f *CatIndices) WithIndex(v ...string) func(*CatIndicesRequest)

type CatIndicesRequest

type CatIndicesRequest struct {
	BaseRequest
	H      string
	Format string
}

type Doc

type Doc interface {
	BulkAction() *BulkAction
	Content() []byte
	GetUUID() string
}

type Document

type Document struct {
	Index DocumentIndex
	Bulk  DocumentBulk
	Get   Get
}

type DocumentBulk

type DocumentBulk func(docs []Doc, o ...func(*DocumentBulkRequest)) (*Response, error)

func (DocumentBulk) WithFilterPath added in v0.0.3

func (f DocumentBulk) WithFilterPath(filterPath string) func(request *DocumentBulkRequest)

func (DocumentBulk) WithIndex

func (f DocumentBulk) WithIndex(v string) func(*DocumentBulkRequest)

type DocumentBulkRequest

type DocumentBulkRequest struct {
	BaseRequest
}

type DocumentIndex

type DocumentIndex func(index string, doc Doc, o ...func(*DocumentIndexRequest)) (*Response, error)

func (DocumentIndex) WithDocumentID

func (f DocumentIndex) WithDocumentID(v string) func(*DocumentIndexRequest)

func (DocumentIndex) WithOpType

func (f DocumentIndex) WithOpType(v string) func(*DocumentIndexRequest)

type DocumentIndexRequest

type DocumentIndexRequest struct {
	BaseRequest
	DocumentID string
	OpType     string
}

type Get

type Get func(index, _id string, o ...func(*GetRequest)) (*Response, error)

func (Get) WithExcludes

func (g Get) WithExcludes(v ...string) func(*GetRequest)

func (Get) WithIncludes

func (g Get) WithIncludes(v ...string) func(*GetRequest)

type GetRequest

type GetRequest struct {
	BaseRequest
	DocumentID string
}

type IndexCreate

type IndexCreate func(index string, o ...func(request *IndexCreateRequest)) (*Response, error)

func (IndexCreate) WithBody

func (f IndexCreate) WithBody(v *[]byte) func(*IndexCreateRequest)

type IndexCreateRequest

type IndexCreateRequest struct {
	BaseRequest
}

type IndexDelete

type IndexDelete func(index []string, o ...func(*IndexDeleteRequest)) (*Response, error)

type IndexDeleteRequest

type IndexDeleteRequest struct {
	BaseRequest
}

type IndexExists

type IndexExists func(o ...func(*IndexExistsRequest)) (*Response, error)

func (IndexExists) WithIndex

func (f IndexExists) WithIndex(v string) func(*IndexExistsRequest)

type IndexExistsRequest

type IndexExistsRequest struct {
	BaseRequest
}

type IndexGetMapping

type IndexGetMapping func(o ...func(request *IndexGetMappingRequest)) (*Response, error)

func (IndexGetMapping) WithIndex

func (f IndexGetMapping) WithIndex(v string) func(*IndexGetMappingRequest)

type IndexGetMappingRequest

type IndexGetMappingRequest struct {
	BaseRequest
}

type Indexer

type Indexer struct {
	Create      IndexCreate
	Delete      IndexDelete
	GetMapping  IndexGetMapping
	Exists      IndexExists
	AliasExists AliasExists
	AliasGet    AliasGet
	Aliases     Aliases
	SettingsGet SettingsGet
}

type Ping

type Ping func() (*Response, error)

type PingRequest

type PingRequest struct {
	BaseRequest
}

type Request

type Request interface {
	Do(ctx context.Context, transport Transport) (*Response, error)
}

type Response

type Response struct {
	*http.Response
	// contains filtered or unexported fields
}

func (*Response) IsError

func (r *Response) IsError() bool

func (*Response) Result

func (r *Response) Result(result interface{}) (err error)

func (*Response) ResultBytes

func (r *Response) ResultBytes() []byte

func (*Response) ResultJson

func (r *Response) ResultJson(v interface{}) error

func (*Response) ResultString

func (r *Response) ResultString() string
type Search func(o ...func(*SearchRequest)) (*Response, error)

func (Search) WithBody

func (f Search) WithBody(v *[]byte) func(*SearchRequest)

func (Search) WithIndex

func (f Search) WithIndex(v ...string) func(*SearchRequest)

func (Search) WithSource

func (f Search) WithSource(v ...string) func(*SearchRequest)

func (Search) WithSourceExcludes

func (f Search) WithSourceExcludes(v ...string) func(*SearchRequest)

func (Search) WithSourceIncludes

func (f Search) WithSourceIncludes(v ...string) func(*SearchRequest)

func (Search) WithTrackTotalHits

func (f Search) WithTrackTotalHits(v bool) func(*SearchRequest)

type SearchRequest

type SearchRequest struct {
	BaseRequest
	Source         []string
	SourceExcludes []string
	SourceIncludes []string
	TrackTotalHits bool
}

type Searcher

type Searcher struct {
	Search Search
}

type SettingsGet

type SettingsGet func(o ...func(*SettingsGetRequest)) (*Response, error)

func (SettingsGet) WithIndex

func (f SettingsGet) WithIndex(v ...string) func(*SettingsGetRequest)

func (SettingsGet) WithSettings

func (f SettingsGet) WithSettings(v ...string) func(*SettingsGetRequest)

type SettingsGetRequest

type SettingsGetRequest struct {
	BaseRequest
	Settings     []string
	FlatSettings bool
}

type Transport

type Transport interface {
	Perform(*http.Request) (*http.Response, error)
}

Jump to

Keyboard shortcuts

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