8
我使用上下文建议程序,我想知道是否可以设置上下文的范围用于建议,而不是使用所有上下文。Elasticsearch上下文建议程序,上下文布尔
当前查询需要匹配所有上下文。我们可以在上下文中添加“OR”操作和/或指定哪个上下文用于特定查询?
以从here的例子: 映射:
PUT /venues/poi/_mapping
{
"poi" : {
"properties" : {
"suggest_field": {
"type": "completion",
"context": {
"type": {
"type": "category"
},
"location": {
"type": "geo",
"precision" : "500m"
}
}
}
}
}
}
然后我索引的文档:
{
"suggest_field": {
"input": ["The Shed", "shed"],
"output" : "The Shed - fresh sea food",
"context": {
"location": {
"lat": 51.9481442,
"lon": -5.1817516
},
"type" : "restaurant"
}
}
}
查询:
{
"suggest" : {
"text" : "s",
"completion" : {
"field" : "suggest_field",
"context": {
"location": {
"value": {
"lat": 51.938119,
"lon": -5.174051
}
}
}
}
}
}
如果我的查询只使用一个上下文(在上面的例子中“位置”)它给出了一个错误,我需要pa连接两个上下文,是否可以指定使用哪个上下文?或者传递一个像“Context_Operation”参数设置为“OR”的东西。
是否确定指标的类别是这样:任何,餐厅](“任何”将被包括在默认情况下,所有的索引文档),当你执行查询,通过“任意”作为类别+“位置”? –