需求
username字段类型为keyword,需要实现termQuery username时,大小写不敏感
settings设置如下
{
"index": {
"routing": {
"allocation": {
"total_shards_per_node": "2"
}
},
"refresh_interval": "1s",
"number_of_shards": "5",
"number_of_replicas": "1"
},
"analysis": {
"normalizer": {
"lowercase": {
"filter": [
"lowercase"
],
"type": "custom"
}
}
}
}
mappings设置如下
{
"properties": {
"username": {
"normalizer": "lowercase",
"type": "keyword"
}
}
}
网友评论