normalizer(归一化)
curl -XPUT 'localhost:9200/index?pretty' -H 'Content-Type: application/json' -d'
{
"settings": {
"analysis": {
"normalizer": {
"my_normalizer": {
"type": "custom",
"char_filter": [],
"filter": ["lowercase", "asciifolding"]
}
}
}
},
"mappings": {
"type": {
"properties": {
"foo": {
"type": "keyword",
"normalizer": "my_normalizer"
}
}
}
}
}
'
curl -XPUT 'localhost:9200/index/type/1?pretty' -H 'Content-Type: application/json' -d'
{
"foo": "BÀR"
}
'
curl -XPUT 'localhost:9200/index/type/2?pretty' -H 'Content-Type: application/json' -d'
{
"foo": "bar"
}
'
curl -XPUT 'localhost:9200/index/type/3?pretty' -H 'Content-Type: application/json' -d'
{
"foo": "baz"
}
'
curl -XPOST 'localhost:9200/index/_refresh?pretty'
curl -XGET 'localhost:9200/index/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"match": {
"foo": "BAR"
}
}
}
'Last updated