554325746@qq.com
2019-06-25 f9ecff08394b734fb8420044bcba471df1af352c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package esutil
 
import (
        "errors"
        "strconv"
 
        "basic.com/pubsub/protomsg.git"
        )
 
func DbPersoninfos( queryindex int, querynums int ) (dbpersoninfos []protomsg.Baseinfo, err error){
            point   := strconv.Itoa(queryindex)
            number   := strconv.Itoa(querynums)
 
            var dbinfoRequest =  `  {
                    "from": ` + point +  `,        
                    "query": {
                        "match_all": {}
                    },
                        "size":`+ number +`,
                        "_source": [
                       "tableId",
                       "tableName",
                       "compareScore",
                       "personId",
                       "personName",
                       "personPicUrl",
                       "phoneNum",
                       "sex",
                       "idCard",
                       "monitorLevel",
                       "faceFeature",
                       "content",
                       "id"
                       ]
                }`
 
      // 返回请求的buf
      buf, err := GetDbinfo(dbinfoRequest )
      if err != nil {
        return nil ,errors.New("http request get dbperson info is err!")
      }
 
      // 返回 _source 数组
      sources, err := Sourcelist(buf)
      if err != nil {
            return nil,err 
      }
 
      // 返回所有查询的数据
      dbpersoninfos =  Parsesources(sources)
      return dbpersoninfos, nil
}