自定义分析器,分词器
PUT http://xxx.xxx.xxx.xxx:9200/test_index/
{
"settings": {
"analysis": {
"analyzer": {
"char_edge_ngram_analyzer": {
"tokenizer": "char_edge_ngram_tokenizer"
}
},
"tokenizer": {
"char_edge_ngram_tokenizer": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 10
}
}
}
},
"mappings": {
"test_index_type": {
"properties": {
"my_field": {
"type": "text",
"analyzer": "char_edge_ngram_analyzer"
}
}
}
}
}
所有字段检索
{
"query": {
"multi_match": {
"query": "河北保定",
"type": "cross_fields",
"fields": ["*"],
"operator": "AND"
}
}
}
高亮搜索
{
"highlight": {
"fields": {
"name": {},
"content": {},
},
"pre_tags": ["<em>"],
"post_tags": ["</em>"]
}
}
分词测试
GET /test_index/_analyze
{
"field": "my_field",
"text": "this is admin"
}
标签:语句,常用,tokenizer,xxx,char,ngram,edge,type,es
From: https://www.cnblogs.com/mayanan/p/17563681.html