From 98ac3a8c6d249262afc7c6259024bf5760ecca0b Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期四, 14 十一月 2019 18:40:17 +0800
Subject: [PATCH] add command select

---
 EsApi.go |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/EsApi.go b/EsApi.go
index 693c130..dd608ed 100644
--- a/EsApi.go
+++ b/EsApi.go
@@ -240,13 +240,18 @@
 
 
 //鏍规嵁鎶撴媿浜哄憳id鏇存柊锛坴ideourl锛夋憚鍍忔満鍦板潃
-func UpdateVideourlById(id string, videoUrl string, indexName string, serverIp string, serverPort string) (statu int) {
+func UpdateVideourlById(id string, videoUrl string, indexName string, serverIp string, serverPort string,command int) (statu int) {
+
 	var info interface{}
 	url := "http://"+serverIp+":"+serverPort+"/"+indexName+"/_update_by_query?refresh=true"
+	sourceStr :=  "ctx._source.videoUrl='" + videoUrl + "'"
+	if command>=0  {
+		sourceStr =  "ctx._source.linkTagInfo["+strconv.Itoa(command)+"].videoUrl='" + videoUrl + "'"
+	}
 	var videoUrlInfo = `
         {
           "script": {
-            "source": "ctx._source.videoUrl='` + videoUrl + `'"	
+            "source": "`+ sourceStr + `"	
           },
           "query": {
             "term": {

--
Gitblit v1.8.0