要不要也来分享分享一下啊

如何使用template为所有字段指定分词器

Elasticsearch | 作者 feihui | 发布于2017年05月18日 | 阅读数:6201

数据从 mongo 同步到 es, 有张 document 的 field 数量有几百个, 如何使用template为所有字段指定分词器,下面是我的例子:

the data is syncronized from mongo to es, and there is a document which has hunderds of fields, so i want to know how can i create a template to spicify analyzer for all fields, below is my example :
{
"order": 0,
"template": "*",
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0"
}
},
"mappings": {
"T_CF_FormInst_Custom": {
"_all": {
"search_analyzer": "ik_max_word",
"analyzer": "ik_max_word",
"term_vector": "no",
"store": "false"
}
}
},
"aliases": {}
}
已邀请:

medcl - 今晚打老虎。

赞同来自:

参考:设置所有的text默认类型
curl -XDELETE http://localhost:9200/_template/rtf


curl -XPUT http://localhost:9200/ _template/rtf
-d'
{
"template": "*",
"settings": { "number_of_shards": 1 },
"mappings": {
"_default_": {
"_all": {
"enabled": true
},
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"analyzer":"ik_max_word",
"ignore_above": 256,
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
]
}
}
}
'

要回复问题请先登录注册