我正在尝试使用 ElasticSearch 作为数据存储来通过他们的名字找到一些人。我尝试创建索引,添加单词,更改映射,但是当我尝试使用 JaroWinkler & Levenstein 算法按姓名查找人员时,它什么也没有返回。
步骤 1放置:http : //127.0.0.1 :9200/list
{
"mappings": {
"main": {
"properties": {
"ppl_name": {
"type": "text"
}
}
}
}
}
有答案
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "list"
}
第2步
发布/放置http://127.0.0.1:9200/list/main/1
{"ppl_name":"oleksandroleksandrovychborysenko"}
{"ppl_name":"oleksandr oleksandrovych borysenko"}
有答案
{
"_index": "list",
"_type": "main",
"_id": "2",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true
}
第 3 步 获取http://127.0.0.1:9200/list/_mapping 答案:
{
"list": {
"mappings": {
"main": {
"properties": {
"ppl_name": {
"type": "text"
}
}
}
}
}
}
第 4 步
发布http://127.0.0.1:9200/list/main/_search
有身体
{
"suggest": {
"text" : "oleksandr oleksandrovych borysenko",
"levenstein" : {
"term" : {
"string_distance": "levenstein",
"field" : "ppl_name"
}
},
"jarowinkler" : {
"term" : {
"string_distance": "jarowinkler",
"field" : "ppl_name"
}
}
}
}
和回答
{
"took": 28,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"jarowinkler": [
{
"text": "oleksandr",
"offset": 0,
"length": 9,
"options": []
},
{
"text": "oleksandrovych",
"offset": 10,
"length": 14,
"options": []
},
{
"text": "borysenko",
"offset": 25,
"length": 9,
"options": []
}
],
"levenstein": [
{
"text": "oleksandr",
"offset": 0,
"length": 9,
"options": []
},
{
"text": "oleksandrovych",
"offset": 10,
"length": 14,
"options": []
},
{
"text": "borysenko",
"offset": 25,
"length": 9,
"options": []
}
]
}
}
任何人都可以帮助我解决这种情况吗?