feat:完善项目

This commit is contained in:
henry
2022-01-18 09:20:18 +08:00
parent 8a97ec40d3
commit 478182dcb0
12 changed files with 161 additions and 30 deletions

View File

@ -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()