ES动态模板,设置ik分词器,指定分词字段,指定其他字段类型

curl -XPUT 'http://127.0.0.1:9200/_template/alarm-template?pretty' -H 'Content-Type: application/json' -d'
{
	"order": 0,
	"template": "alarm-log-*",
	"settings": {
		"index": {
			"number_of_shards": 5,
			"number_of_replicas": "1"
		}
	},
	"mappings": {
		"alarm": {
			"dynamic_templates": [
			  {
				"text_fields": {
					"match_mapping_type": "string",
					"match": "*",
					"unmatch": "message",
					"mapping": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					}
				}
			  },
			  {
				"date_fields": {
				  "mapping": {
					"type": "date",
					"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
				  },
				  "match_mapping_type": "date",
				  "match": "*"
				}
			  }			
			],
			"properties": {
				"message": {
					"type": "text",
					"analyzer": "ik_max_word",
					"search_analyzer": "ik_max_word"
				}	
			}
		}
	},
	"aliases": {}
}'




猜你喜欢

转载自blog.csdn.net/LSY929981117/article/details/107564424
今日推荐