【问题标题】:Elastic opposite query弹性反向查询
【发布时间】:2016-02-21 21:23:41
【问题描述】:

我正在使用弹性搜索来搜索经典查询,例如“搜索名称中包含 G4 和制造商中包含 LG 的所有文档”。还行吧。但是,如果我有很多包含大量搜索词的文档和数据库,我需要知道哪些文档与某些特定的多列词匹配。例如:

文件:

[
    {
     "id": 5787,
     "name": "Smartphone G4",
     "manufacturer": "LG",
     "description": "The revolutionary LG G4 design can only be described as forward thinking—with a classic touch."
    },
    {
     "id": 68779,
     "name": "Smartphone S6",
     "manufacturer": "Samsung",
     "description": "The Samsung Galaxy S6 is powerful to use and beautiful to behold."
    }
]

...

条款:

[
   {
     "id": "587",
     "name": "G4",
     "manufacturer": "LG",
     "description": "classic touch"
    },
    {
     "id": "364",
     "manufacturer": "Samsung",
     "description": "galaxy s6"
    }
]

...

结果:

{
  "587": [5787],
  "364": [68779]
}

或者:

{
  "5787": [587],
  "68779": [364]
}

我需要与它们相对应(或相反)的文档列表和术语列表。在少量的条件下,应该可以将所有规则一一应用并保存匹配的文档。但我有数百万个文档和数千个术语。因此,不可能一一应用它们。有没有可能换一种方式?

【问题讨论】:

  • 这不是我要找的。我需要将许多文档与许多搜索词进行比较。在链接的问题上,只有单词计数器。还是我错过了什么?

标签: search elasticsearch full-text-search


【解决方案1】:

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html 正是我想要的。它可以存储您的查询并针对文档执行它们。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-25
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多