这是我的索引:
{
"mappings": {
"packages" : {
"properties" : {
"suggest-name" : {
"type" : "completion"
},
"suggest-tags" : {
"type" : "completion"
},
"suggest-cmdlets" : {
"type" : "completion"
}
}
}
}
}
我希望能够做到这样的事情:
curl -XPOST 'localhost:32769/test/_search?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"suggest": {
"packages-suggest" : {
"prefix" : "get",
"completion" : {
"fields" : ["suggest-cmdlet", "suggest-name", "suggest-tags"]
}
}
}
}
'
并指定我想要查看自动填充的所有字段。
这似乎不是正确的方法...您如何在自动填充搜索查询中引用多个字段?
感谢您的帮助!
答案 0 :(得分:3)
你需要这样做:
curl -XPOST 'localhost:32769/test/_search?pretty&pretty' -H 'Content-Type: application/json' -d'
{
"suggest": {
"packages-suggest-1" : {
"prefix" : "get",
"completion" : {
"field" : "suggest-cmdlets"
}
},
"packages-suggest-2" : {
"prefix" : "get",
"completion" : {
"field" : "suggest-name"
}
},
"packages-suggest-3" : {
"prefix" : "get",
"completion" : {
"field" : "suggest-tags"
}
}
}
}
'