feat:完善项目
This commit is contained in:
@ -17,15 +17,25 @@ type (
|
||||
)
|
||||
|
||||
// Create 创建操作
|
||||
func Create(index string, body []byte) error {
|
||||
func Create(index, id string, body []byte) error {
|
||||
_, err := client.Index().
|
||||
Index(index).
|
||||
//Id(fmt.Sprintf("%d", 1)).
|
||||
Id(id).
|
||||
BodyJson(string(body)).
|
||||
Do(context.Background())
|
||||
return err
|
||||
}
|
||||
|
||||
// Update 更新操作
|
||||
func Update(index, id string, body []byte) error {
|
||||
_, err := client.Update().
|
||||
Index(index).
|
||||
Id(id).
|
||||
Doc(string(body)).
|
||||
Do(context.Background())
|
||||
return err
|
||||
}
|
||||
|
||||
// Search 搜索操作
|
||||
func Search(src interface{}, index string, params *SearchParams, page, pageSize int) ([]interface{}, error) {
|
||||
query := elastic.NewBoolQuery()
|
||||
|
Reference in New Issue
Block a user