gpt4 book ai didi

elasticsearch - Elasticsearch查询返回摘要

转载 作者:行者123 更新时间:2023-12-02 22:50:28 25 4
gpt4 key购买 nike

嗨,我是Elasticsearch的新手,现在我为一个网站建立了索引,我希望获得包含查询词的文本摘录,

示例一索引

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi nec odio in magna blandit porta quis a nibh. Integer sodales ex ut sagittis venenatis. Duis efficitur ligula ac magna tincidunt, in iaculis magna facilisis. Nullam pulvinar diam vitae elit auctor auctor a a urna. Fusce accumsan non magna non fermentum. Curabitur dapibus tempus nisi, efficitur mattis magna aliquam nec. In hac habitasse platea dictumst. In lacus nulla, feugiat vitae neque ac, aliquam hendrerit orci.



如果我要求Nullam pulvinar,我想提取类似

Nullam pulvinar diam vitae elit auctor auctor a a urna.



可能吗 ?

最佳答案

您可以为此使用Highlighting
来自文档

{
"query" : {...},
"highlight" : {
"fields" : {
"content" : {}
}
}
}

您还可以根据需要指定 fragment_sizenumber_of_fragments

关于elasticsearch - Elasticsearch查询返回摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34086980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com