curl -XPUT "localhost:9200/products" -d '{
"settings": {
"index": {
"number_of_replicas" : 0,
"number_of_shards": 1
}
},
"mappings": {
"products": {
"properties": {
"location" : {
"type" : "geo_point"
}
}
}
}
}'
我目前有一个创建索引的bash脚本。代码在上面。
如何添加词干?
答案 0 :(得分:6)
最通用的方法是将default
分析器替换为snowball
分析器。这将启用所有动态映射的字符串字段。这就是你如何启用英语词干分析器:
curl -XPUT "localhost:9200/products" -d '{
"settings": {
"index": {
"number_of_replicas" : 0,
"number_of_shards": 1,
"analysis" :{
"analyzer": {
"default": {
"type" : "snowball",
"language" : "English"
}
}
}
}
},
"mappings": {
"products": {
"properties": {
"location" : {
"type" : "geo_point"
}
}
}
}
}'