tonglin0325的个人主页

Elasticsearch学习笔记——索引模板

在索引模板里面,date类型的字段的format支持多种类型,在es中全部会转换成long类型进行存储,参考

1
2
https://zhuanlan.zhihu.com/p/34240906

一个索引模板范例

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
69
70
71
72
73
74
75
76
77
78
{
"order": 0,
"index_patterns": [
"ssssssssssssssss_test*"
],
"settings": {
"index": {
"codec": "best_compression",
"routing": {
"allocation": {
"require": {
"box_type": "master"
},
"total_shards_per_node": "3"
}
},
"refresh_interval": "60s",
"unassigned": {
"node_left": {
"delayed_timeout": "900m"
}
},
"number_of_shards": "3",
"number_of_replicas": "1"
}
},
"mappings": {
"_default_": {
"_source": {
"enabled": true
},
"dynamic_templates": [
{
"string_template": {
"mapping": {
"type": "keyword"
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"properties": {
"a1": {
"search_analyzer": "ik_max_word",
"analyzer": "ik_max_word",
"type": "text"
},
"a2": {
"type": "float"
},
"a3": {
"type": "integer"
},
"untitled": {
"type": "float"
},
"a4": {
"type": "long"
},
"a5": {
"type": "double"
},
"a6": {
"type": "ip"
},
"a8": {
"type": "keyword"
}
},
"_all": {
"enabled": false
}
}
},
"aliases": {}
}