0

我正在尝试根据作者和标题匹配书籍。不幸的是,用作输入的标题和作者与弹性搜索中的不同,单词的顺序不同并且有其他差异,所以我无法进行精确匹配。我的图书记录有字段作者和标题。我想出了以下查询:

{
  "query":{
    "bool":{
      "must":{
        "query_string":{
          "query":"Not the Israel My Parents Promised Me"
        },
        "fuzzy":{
          "author":{
            "value":"Peka, Harvey",
            "boost":2
          }
        }
      }
    }
  },
  "from":1,
  "size":1
}

无论输入是什么,它每次都会给出相同的结果,所以它似乎有问题。我是不是走错了路?

4

1 回答 1

1

我索引了一些书籍和作者并尝试了这一点。为我工作了不同的组合,比如,混乱的单词和不完整的名字,即使有些单词不正确,如下所示:

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "default_field": "book",
            "query": "The girl with the angel tattoo"
          }
        },
        {
          "query_string": {
            "default_field": "author",
            "query": "Steig Larsson"
          }
        }
      ]
    }
  }
}
于 2013-05-21T17:11:36.117 回答