[英]Is there a way to have multiple completion suggesters on a single index?
Here is my index: 这是我的索引:
{
"mappings": {
"packages" : {
"properties" : {
"suggest-name" : {
"type" : "completion"
},
"suggest-tags" : {
"type" : "completion"
},
"suggest-cmdlets" : {
"type" : "completion"
}
}
}
}
}
I would love to be able to something like this: 我希望能够实现以下功能:
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"]
}
}
}
}
'
and specify all the fields I want to try to look at for the autocomplete. 并指定要尝试查看自动填充功能的所有字段。
This doesn't seem to be the right way to do it... How would you reference multiple fields in an autocomplete search query? 这似乎不是正确的方法...您将如何在自动完成的搜索查询中引用多个字段?
Thanks for the help! 谢谢您的帮助!
You need to do it like this: 您需要这样做:
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"
}
}
}
}
'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.