-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmapping.py
More file actions
68 lines (61 loc) · 1.66 KB
/
mapping.py
File metadata and controls
68 lines (61 loc) · 1.66 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
'''
Created on 2017-01-03 11:05
---------
@summary: 提供一些操作数据库公用的方法
---------
@author: Boris
'''
import sys
sys.path.append('../../')
import init
import utils.tools as tools
from db.elastic_search import ES
es = ES()
def set_mapping():
mapping = {
"weibo_article":{
"properties":{
"comment_count":{
"type":"long"
},
"video_url":{
"type":"string",
"index":"not_analyzed"
},
"user_name":{
"type":"string",
"index":"not_analyzed"
},
"id":{
"type":"string",
"index":"not_analyzed"
},
"up_count":{
"type":"long"
},
"record_time":{
"type":"date",
"format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"content":{
"type":"string",
"analyzer":"ik_max_word"
},
"url":{
"type":"string",
"index":"not_analyzed"
},
"release_time":{
"type":"date",
"format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"transmit_count":{
"type":"long"
}
}
}
}
es.set_mapping('weibo_article', mapping)
if __name__ == '__main__':
set_mapping()