Elasticsearch - 如何结合来自多个领域的术语建议?
Elasticsearch - How does one combine term suggestions from multiple fields?
term suggester documentation 列出了术语建议器的基础知识,但这让我想知道如何从多个领域找到建议并将它们组合起来。我可能可以在事后想出一些实现,但我想知道是否缺少某些设置。
例如,假设我想从三个不同的领域获得建议
GET product-search-product/_search
{
"suggest": {
"text": "som typu here",
"my-suggest-1": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_one"
}
},
"my-suggest-2": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_two"
}
},
"my-suggest-3": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_three"
}
}
}
}
我可以使用这个 returns 结果,但我必须弄清楚哪个字段有 "best" 建议。
"suggest": {
"my-suggest-1": [
{
"text": "som",
...
"options": [
{
"text": "somi"
...
}
]
},
{
"text": "typu",
...
"options": [
{
"text": "typo"
...
}
]
},
{
"text": "here",
...
"options": []
}
],
"my-suggest-2": [
{
"text": "som",
...
"options": [
{
"text": "some"
...
}
]
},
{
"text": "typu",
...
"options": []
},
{
"text": "here",
...
"options": []
}
],
"my-suggest-3": [
{
"text": "som",
...
"options": []
},
{
"text": "typu",
...
"options": [
{
"text": "typa"
...
}
]
},
{
"text": "here",
...
"options": []
}
]
}
在我看来,好像我必须实施一些东西来确定哪个领域提出了最好的建议。有没有办法在建议者中将这些结合起来以便它可以为我做到这一点?
Phrase suggester 适合我的情况,并且存在短语 suggester candidate generators 似乎可以解决我的问题。
term suggester documentation 列出了术语建议器的基础知识,但这让我想知道如何从多个领域找到建议并将它们组合起来。我可能可以在事后想出一些实现,但我想知道是否缺少某些设置。
例如,假设我想从三个不同的领域获得建议
GET product-search-product/_search
{
"suggest": {
"text": "som typu here",
"my-suggest-1": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_one"
}
},
"my-suggest-2": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_two"
}
},
"my-suggest-3": {
"term": {
"size": 1,
"max_edits": 1,
"prefix_length": 3,
"field": "field_three"
}
}
}
}
我可以使用这个 returns 结果,但我必须弄清楚哪个字段有 "best" 建议。
"suggest": {
"my-suggest-1": [
{
"text": "som",
...
"options": [
{
"text": "somi"
...
}
]
},
{
"text": "typu",
...
"options": [
{
"text": "typo"
...
}
]
},
{
"text": "here",
...
"options": []
}
],
"my-suggest-2": [
{
"text": "som",
...
"options": [
{
"text": "some"
...
}
]
},
{
"text": "typu",
...
"options": []
},
{
"text": "here",
...
"options": []
}
],
"my-suggest-3": [
{
"text": "som",
...
"options": []
},
{
"text": "typu",
...
"options": [
{
"text": "typa"
...
}
]
},
{
"text": "here",
...
"options": []
}
]
}
在我看来,好像我必须实施一些东西来确定哪个领域提出了最好的建议。有没有办法在建议者中将这些结合起来以便它可以为我做到这一点?
Phrase suggester 适合我的情况,并且存在短语 suggester candidate generators 似乎可以解决我的问题。