q454784419 2019-01-16 20:09 采纳率: 0%
浏览 1796

关于elasticsearch的高亮显示

有没有人了解 elasticsearch 在长文本的搜索时 结果高亮字段 如何替换掉原字段
比如你的文章大概700字 而你内容的高亮结果集每个只有100个字符 如何替换到原文中 尤其是在ik分词器后

  • 写回答

1条回答

  • CCodeFm 2019-07-10 11:50
    关注

    可设置number_of_fragment的值为0,这样会在返回原文的情况下对相同的片段高亮显示。
    number_of_fragments
    The maximum number of fragments to return. If the number of fragments is set to 0, no fragments are returned. Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If number_of_fragments is 0, fragment_size is ignored. Defaults to 5.
    参阅https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-request-highlighting.html

    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容