gpt4 book ai didi

elasticsearch - 将Elasticsearch配置为不突出停用词

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

是否可以将Elasticsearch配置为不突出显示单独出现在文本中的停用词?

例如,在以下来自维基百科的文字中,我要突出显示“指环王”,“指环”或“主”,但我不希望Elasticsearch突出显示“of”或“the”(如果它们单独出现) 。

The Lord of the Rings is an epic high-fantasy novel written by English author J. R. R. Tolkien. The story began as a sequel to Tolkien's 1937 fantasy novel The Hobbit, but eventually developed into a much larger work. Written in stages between 1937 and 1949, The Lord of the Rings is one of the best-selling novels ever written, with over 150 million copies sold. The title of the novel refers to the story's main antagonist, the Dark Lord Sauron, who had in an earlier age created the One Ring to rule the other Rings of Power as the ultimate weapon ...

最佳答案

您正在寻找highlight_query:

  • 使用_analyze分析《指环王》获得无停用词的单词
  • 使用highlight_query在《指环王》中进行搜索,而没有来自1.的停用词。

  • 也许像:
    GET /_search
    {
    "query" : {
    "match": {
    "my_field": {
    "query": "The Lord of the Rings"
    }
    }
    },
    "highlight" : {
    "order" : "score",
    "fields" : {
    "my_field" : {
    "highlight_query": {
    "bool": {
    "should": {
    "match_phrase": {
    "content": {
    "query": "my words"
    }
    }
    }
    }
    }
    }
    }
    }
    }

    关于elasticsearch - 将Elasticsearch配置为不突出停用词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41583196/

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