PUT worksheet
{
"settings": {
"analysis": {
"analyzer": {
"myanalyzer": {
"tokenizer": "mytokenizer"
}
},
"tokenizer": {
"mytokenizer": {
"type": "ngram",
"min_gram": 2,
"max_gram": 2,
"token_chars": [
"letter",
"digit",
"whitespace",
"punctuation",
"symbol"
]
}
}
}
},
"mappings":{
"properties":{
"id":{
"type":"long",
"fields":{
"keyword":{
"type":"keyword"
}
}
},
"sheetNo":{"type":"keyword"},
"handleUser": { "type": "keyword"},
"callNo":{
"type": "keyword"},
"createUser":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
}
},
"createTime": { "type": "long"},
"address":{
"type":"text",
"analyzer": "myanalyzer",
"search_analyzer": "myanalyzer",
"fields":{
"keyword":{
"type":"keyword"
}
}
}
}
}
}
搜索条件是
GET worksheet/_search
{
"query": {
"match": {
"address": {
"query": "成都成华",
"operator": "and"
}
}
}
}
{
"settings": {
"analysis": {
"analyzer": {
"myanalyzer": {
"tokenizer": "mytokenizer"
}
},
"tokenizer": {
"mytokenizer": {
"type": "ngram",
"min_gram": 2,
"max_gram": 2,
"token_chars": [
"letter",
"digit",
"whitespace",
"punctuation",
"symbol"
]
}
}
}
},
"mappings":{
"properties":{
"id":{
"type":"long",
"fields":{
"keyword":{
"type":"keyword"
}
}
},
"sheetNo":{"type":"keyword"},
"handleUser": { "type": "keyword"},
"callNo":{
"type": "keyword"},
"createUser":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
}
},
"createTime": { "type": "long"},
"address":{
"type":"text",
"analyzer": "myanalyzer",
"search_analyzer": "myanalyzer",
"fields":{
"keyword":{
"type":"keyword"
}
}
}
}
}
}
搜索条件是
GET worksheet/_search
{
"query": {
"match": {
"address": {
"query": "成都成华",
"operator": "and"
}
}
}
}
4 个回复
yongde - 90后IT男
赞同来自: chenfengchao
2、myanalyzer 分词器对 “成都成华”的分词结果
3、比较 步骤2的分词是不是在步骤1中都存在
chenfengchao
赞同来自:
anning19890402
赞同来自:
YuLiGod - 小于小朋友
赞同来自: