我想要求查询至少有5个匹配的连续字符来匹配特定的字段。它们可能有点模糊(如果序列越长,它就越模糊,那将是理想的)。
发布于 2022-06-21 16:32:59
在这个例子中,我定义了n克,没有最小的5个字符。这样就有可能与至少5个字符匹配。
PUT teste
{
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"ngram": {
"type": "text",
"analyzer": "shingle_analyzer"
}
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"shingle_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"shingle_filter"
]
}
},
"filter": {
"shingle_filter": {
"type": "edge_ngram",
"min_gram": 5,
"max_gram": 8
}
}
}
}
}
POST teste/_doc
{
"name":"example text match fiver terms sequence"
}
GET teste/_search
{
"query": {
"match": {
"name.ngram": "exampl"
}
}
}https://stackoverflow.com/questions/72703609
复制相似问题