|
@@ -272,7 +272,7 @@ func (e *Elastic) GetNoLimit(index, query string) *[]map[string]interface{} {
|
|
// return nil
|
|
// return nil
|
|
//}
|
|
//}
|
|
|
|
|
|
-func (e *Elastic) Count(index, itype string, query interface{}) int64 {
|
|
|
|
|
|
+func (e *Elastic) Count(index string, query interface{}) int64 {
|
|
client := e.GetEsConn()
|
|
client := e.GetEsConn()
|
|
defer e.DestoryEsConn(client)
|
|
defer e.DestoryEsConn(client)
|
|
if client != nil {
|
|
if client != nil {
|
|
@@ -365,11 +365,11 @@ func (e *Elastic) Count(index, itype string, query interface{}) int64 {
|
|
//}
|
|
//}
|
|
|
|
|
|
// UpdateBulk 批量修改文档
|
|
// UpdateBulk 批量修改文档
|
|
-func (e *Elastic) UpdateBulk(index, itype string, docs ...[]map[string]interface{}) {
|
|
|
|
|
|
+func (e *Elastic) UpdateBulk(index string, docs ...[]map[string]interface{}) {
|
|
client := e.GetEsConn()
|
|
client := e.GetEsConn()
|
|
defer e.DestoryEsConn(client)
|
|
defer e.DestoryEsConn(client)
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
- // bulkService.Type(itype)
|
|
|
|
|
|
+ //bulkService.Type(itype)
|
|
for _, d := range docs {
|
|
for _, d := range docs {
|
|
id := d[0]["_id"].(string)
|
|
id := d[0]["_id"].(string)
|
|
doc := es.NewBulkUpdateRequest().Id(id).Doc(d[1])
|
|
doc := es.NewBulkUpdateRequest().Id(id).Doc(d[1])
|
|
@@ -389,7 +389,7 @@ func (e *Elastic) UpsertBulk(ctx context.Context, index string, ids []string, do
|
|
client := e.GetEsConn()
|
|
client := e.GetEsConn()
|
|
defer e.DestoryEsConn(client)
|
|
defer e.DestoryEsConn(client)
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
- // bulkService.Type("bidding")
|
|
|
|
|
|
+ //bulkService.Type("bidding")
|
|
for i := range ids {
|
|
for i := range ids {
|
|
doc := es.NewBulkUpdateRequest().Id(ids[i]).Doc(docs[i]).Upsert(docs[i])
|
|
doc := es.NewBulkUpdateRequest().Id(ids[i]).Doc(docs[i]).Upsert(docs[i])
|
|
bulkService.Add(doc)
|
|
bulkService.Add(doc)
|
|
@@ -409,7 +409,7 @@ func (e *Elastic) DeleteBulk(index string, ids []string) {
|
|
client := e.GetEsConn()
|
|
client := e.GetEsConn()
|
|
defer e.DestoryEsConn(client)
|
|
defer e.DestoryEsConn(client)
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
bulkService := client.Bulk().Index(index).Refresh("true")
|
|
- bulkService.Type("bidding")
|
|
|
|
|
|
+ //bulkService.Type("bidding")
|
|
for i := range ids {
|
|
for i := range ids {
|
|
req := es.NewBulkDeleteRequest().Id(ids[i])
|
|
req := es.NewBulkDeleteRequest().Id(ids[i])
|
|
bulkService.Add(req)
|
|
bulkService.Add(req)
|