Documentation ¶
Index ¶
- Variables
- type EsClient
- func (es *EsClient) CreateDocument(ctx context.Context, indexName string, docId string, ...) (map[string]interface{}, error)
- func (es *EsClient) CreateIndex(ctx context.Context, indexName string, body string) (map[string]interface{}, error)
- func (es *EsClient) DeleteDocument(ctx context.Context, indexName string, docId string) error
- func (es *EsClient) DeleteDocumentByQuery(ctx context.Context, indexName string, query, data map[string]interface{}) (map[string]interface{}, error)
- func (es *EsClient) DeleteIndex(ctx context.Context, indexName string) error
- func (es *EsClient) GetDocument(ctx context.Context, indexName, docId string) (map[string]interface{}, error)
- func (es *EsClient) GetIndex(ctx context.Context, indexName string) (map[string]interface{}, error)
- func (es *EsClient) IsExistDocument(ctx context.Context, indexName, docId string) (bool, error)
- func (es *EsClient) Search(ctx context.Context, indexName string, query, sort map[string]interface{}, ...) (ret []map[string]interface{}, total int, err error)
- func (es *EsClient) SearchByAggregations(ctx context.Context, indexName string, jsonBody string) (ret map[string]interface{}, err error)
- func (es *EsClient) UpdateDocument(ctx context.Context, indexName, docId string, data map[string]interface{}) (map[string]interface{}, error)
- func (es *EsClient) UpdateDocumentByQuery(ctx context.Context, indexName string, query, data map[string]interface{}) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrEsNotFound = errors.New("es: not found")
)
Functions ¶
This section is empty.
Types ¶
type EsClient ¶
type EsClient struct {
// contains filtered or unexported fields
}
func NewESClient ¶
func (*EsClient) CreateDocument ¶
func (es *EsClient) CreateDocument(ctx context.Context, indexName string, docId string, data map[string]interface{}) (map[string]interface{}, error)
CreateDocument create a document
func (*EsClient) CreateIndex ¶
func (es *EsClient) CreateIndex(ctx context.Context, indexName string, body string) (map[string]interface{}, error)
CreateIndex creates an index with the given name and body.
func (*EsClient) DeleteDocument ¶
func (*EsClient) DeleteDocumentByQuery ¶
func (*EsClient) DeleteIndex ¶
DeleteIndex deletes an index with the given name.
func (*EsClient) GetDocument ¶
func (es *EsClient) GetDocument(ctx context.Context, indexName, docId string) (map[string]interface{}, error)
GetDocument get a document
func (*EsClient) IsExistDocument ¶
IsExistDocument check a document is exist
func (*EsClient) Search ¶
func (es *EsClient) Search(ctx context.Context, indexName string, query, sort map[string]interface{}, offset, limit int) (ret []map[string]interface{}, total int, err error)
Search documents by query and sort
func (*EsClient) SearchByAggregations ¶
func (es *EsClient) SearchByAggregations(ctx context.Context, indexName string, jsonBody string) (ret map[string]interface{}, err error)
SearchByAggregations documents by body with json format
Click to show internal directories.
Click to hide internal directories.