我有一个索引,其中存储了一些名称。
PUT localhost:9200/myIndex
{
"mappings": {
"record" : {
"properties" : {
"namesuggest" : {
"type" : "completion"
}
}
}
}
}
所以我输入了一些记录:
PUT localhost:9200/myindex/record/1
{
"namesuggest" : "Homer Simpson"
}
PUT localhost:9200/myindex/record/2
{
"namesuggest" : "Bart Simpson"
}
PUT localhost:9200/myindex/record/3
{
"namesuggest" : "Marge Simpson"
}
通过这个查询,我得到了建议:
POST localhost:9200/myindex/_search
{
"suggest": {
"name-suggest" : {
"prefix" : "bart",
"completion" : {
"field" : "namesuggest"
}
}
}
}
如果我设置prefix == bart
了,我已经返回了“Bart Simpson”的建议,这是正确的。
我不明白为什么,如果我设置prefix == Simpson
我返回了空白结果。
我会有一个%Simpson%
与类似 SQL 的运算符匹配的结果集:
荷马辛普森
巴特辛普森
玛吉辛普森
我该如何进行查询?