1、新建索引
{
"settings": {
"index": {
"number_of_shards": "5",
"number_of_replicas": "1",
"mappings": { "myType": { "properties": { "content": { "type": "text", "analyzer": "comma" } } } }, "analysis": { "analyzer": { "comma": { "type": "pattern", "pattern": ",", "lowercase": false //保留原来大小写 } } } } }}
2、测试
结果:
{
"tokens": [ { "token": "a", "start_offset": 0, "end_offset": 1, "type": "word", "position": 0 } , { "token": "b", "start_offset": 2, "end_offset": 3, "type": "word", "position": 1 } , { "token": "S", "start_offset": 4, "end_offset": 5, "type": "word", "position": 2 } , { "token": "T_L", "start_offset": 6, "end_offset": 9, "typ