inleft
2024-05-18 57e3bead08715d72efaeffe90fafa179b8366473
commit | author | age
bf6fbe 1
L 2     
3
63af45 4 # 两种分词器使用的最佳实践  🍻
bf6fbe 5     索引时用ik_max_word,在搜索时用ik_smart。
L 6        { "arttitle": {
7                 "type": "text",
8                 "analyzer": "ik_max_word",
9                 "search_analyzer": "ik_smart"
10                 }
11          }
12     
13 # 字段禁止动态添加映射  
14     "dynamic" :"strict",
15 # 日期动态格式化 
16     "dynamic_date_formats":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
17
18 #  别名
19 + 别名添加
20         POST _aliases
21         {
22         "actions" : [{"add" : {"index" : "student" , "alias" : "in1"}}]
23         }
24         
25 + 别名删除
26         POST /_aliases
27         {
28             "actions": [
29                 {"remove": {"index": "school", "alias": "in1"}}
30             ]
31         }
32 + 别名修改
33         POST _aliases
34         {
35         "actions" : [{"remove" : {"index" : "student" , "alias" : "in1"}}],
36         "actions" : [{"add" : {"index" : "student" , "alias" : "in2"}}]
37         }
38
39 # config
40     "tagContainer": "智能标签,#转两个数组?",
41     
42     ```
43     {
44         "settings": {
45             "number_of_shards": "5",
46             "number_of_replicas": "1"
47         },
48         "mappings": {
49             "dynamic": "strict",
50             "dynamic_date_formats": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
51             "properties": {
52                 "fileName": {
53                     "type": "text",
54                     "analyzer": "ik_max_word",
55                     "search_analyzer": "ik_max_word"
56                 },
57                 "description": {
58                     "type": "text",
59                     "analyzer": "ik_max_word",
60                     "search_analyzer": "ik_smart"
61                 },
62                 "title": {
63                     "type": "text",
64                     "analyzer": "ik_max_word",
65                     "search_analyzer": "ik_max_word"
66                 },
67                 
68                 "videoText": {
69                     "type": "text",
70                     "analyzer": "ik_max_word",
71                     "search_analyzer": "ik_smart"
72                 },
73                 
74                 "tags": {
75                     "type": "keyword"
76                 },
77                 
78                 "personTags": {
79                     "type": "keyword"
80                 },
81                 
82                 "labelTags": {
83                     "type": "keyword"
84                 },
85                 
86                 "deptId": {
87                     "type": "keyword"
88                 },
89                 "storeType": {
90                     "type": "integer"
91                 },
92                 "id": {
93                     "type": "integer"
94                 },
95     
96                 
97                 "typeId": {
98                     "type": "integer"
99                 },
100     
101                 "createTime": {
102                     "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
103                     "type": "date"
104                 },
105     
106                  
107                 "groupId": {
108                     "type": "integer"
109                 },
110                 "status": {
111                     "type": "integer"
112                 },
113                 "uploadStatus": {
114                     "type": "integer"
115                 },
116                 "duration": {
117                     "type": "integer"
118                 },
119                 "height": {
120                     "type": "integer"
121                 },
122                 "width": {
123                     "type": "integer"
124                 },
125     
126                 "dirId": {
127                     "type": "integer"
128                 },
129                 "videoBitrate": {
130                     "type": "integer"
131                 },
132     
133     
134                 "fileMd5": {
135                     "type": "keyword"
136                 },
137     
138     
139                 "programId": {
140                     "type": "integer"
141                 },
142                 
143                 "videoId": {
144                     "type": "integer"
145                 },
146                 "userId": {
147                     "type": "keyword"
148                 },
149                 "userName": {
150                     "type": "keyword"
151                 },
152     
153                 "size": {
154                     "type": "long"
155                 },
156                 "cateId": {
157                     "type": "integer"
158                 },
159     
160                 "cateIdLeaf": {
161                     "type": "integer"
162                 },
163                 "mediaStatus": {
164                     "type": "integer"
165                 },
166     
167                 "decodeStatus": {
168                     "type": "integer"
169                 },
170                 "isCollect": {
171                     "type": "integer"
172                 },
173     
174     
175     
176                 "fps": {
177                     "type": "integer",
178                     "index": false
179                 },
180                 "audioBitrate": {
181                     "type": "integer",
182                     "index": false
183                 },
184                 "previewUrl": {
185                     "type": "text",
186                     "index": false
187                 },
188                 "originalFile": {
189                     "type": "text",
190                     "index": false
191                 },
192                 "coverUrl": {
193                     "type": "text",
194                     "index": false
195                 },
196                 "format": {
197                     "type": "text",
198                     "index": false
199                 },
200                 "videoCodec": {
201                     "type": "text",
202                     "index": false
203                 },
204                 "audioCodec": {
205                     "type": "text",
206                     "index": false
207                 }
208     
209     
210     
211     
212             }
213         }
214     }
215     
216 ```
217 ```
218
219     
220     #remove
221     "videoText": "顺丰到付的",
222     "recordList": null,
223     "fileCountNumber": null,
224     "fileCountSize": null,
225     "flagRecordList": null,
226     "groupFileList": null,
227     "sizeMB": "20.83",
228     
229     
230     cateIdLeaf
231     tags
232     
233     groupId
234     programId
235     videoCodec
236     audioCodec
237     duration
238     videoBitrate
239     audioBitrate
240     fps
241     width
242     height