curl -XPUT 'http://192.168.1.181:9200/_template/template_t_url' -d ' {
"template": "t_url-*",
"settings": {
"index": {
"number_of_shards": 3,
"number_of_replicas": 1
}
},
"mappings": {
"info": {
"properties": {
"referer": {
"type": "string",
"index": "not_analyzed"
},
"descid": {
"type": "integer",
"index": "not_analyzed"
},
"line": {
"type": "string",
"index": "not_analyzed"
},
"words": {
"type": "string",
"index": "not_analyzed"
},
"dip": {
"type": "ip",
"index": "not_analyzed"
},
"starttime": {
"type": "date",
"format": "yyy-MM-dd HH:mm:ss"
},
"dir": {
"type": "integer",
"index": "not_analyzed"
},
"rid": {
"type": "string",
"index": "not_analyzed"
},
"type": {
"type": "integer",
"index": "not_analyzed"
},
"grpids": {
"type": "integer",
"index": "not_analyzed"
},
"platform": {
"type": "string",
"index": "not_analyzed"
},
"url": {
"type": "string",
"index": "not_analyzed"
},
"dport": {
"type": "integer",
"index": "not_analyzed"
},
"subtype": {
"type": "integer",
"index": "not_analyzed"
},
"bytes": {
"type": "integer",
"index": "not_analyzed"
},
"browser": {
"type": "string",
"index": "not_analyzed"
},
"domain": {
"type": "string",
"index": "not_analyzed"
},
"action": {
"type": "string",
"index": "not_analyzed"
},
"termtype": {
"type": "string",
"index": "not_analyzed"
},
"sip": {
"type": "ip",
"index": "not_analyzed"
},
"sport": {
"type": "integer",
"index": "not_analyzed"
},
"username": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}'
本文详细介绍了如何使用curl命令向Elasticsearch发送PUT请求来创建一个名为'template_t_url'的索引模板。该模板定义了包括'starttime'在内的多个字段的映射和设置,如'descid'、'url'等,并设置了3个主分片和1个副本。
405

被折叠的 条评论
为什么被折叠?



