Elasticsearch custom analyzer with custom pattern(自定义Analyzer的分词pattern)

来源:互联网 发布:apache svn服务器搭建 编辑:程序博客网 时间:2024/05/18 00:12
DELETE testindexPUT testindex{    "index" : {        "analysis" : {            "tokenizer" : {                "comma" : {                    "type" : "pattern",                    "pattern" : ","                }            },            "analyzer" : {                "comma" : {                    "type" : "custom",                    "tokenizer" : "comma"                }            }        }    }}PUT /testindex/_mapping/yourtype{        "properties" : {            "contentType" : {                "type" : "string",                "analyzer" : "comma"            }        }}PUT /testindex/yourtype/1{    "contentType" : "1,2,3"}PUT /testindex/yourtype/2{    "contentType" : "3,4"}PUT /testindex/yourtype/3{    "contentType" : "1,6"}GET /testindex/_search{    "query": {"match_all": {}}}GET /testindex/_search{    "filter": {        "term": {           "contentType": "6"        }    }}

Indexing a comma separated value field in elastic search

0 0
原创粉丝点击