【问题标题】:How can use filters with a percolate query in Elasticsearch 5.1?如何在 Elasticsearch 5.1 中使用过滤器和过滤查询?
【发布时间】:2021-01-23 07:26:46
【问题描述】:

我在 Elasticsearch 5.1 版中使用了percolator 进行反向搜索。

我现在面临的问题是如何在使用 percolator 搜索文档的匹配查询时添加过滤查询。我浏览了 Elasticsearch 文档,但没有找到任何帮助。

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    我刚刚发现 percolate 可以在 Elasticsearch 5.x 中与 bool 一起使用。 PFB 示例:

    {
      "min_score": 50,
      "query": {
        "bool": {
          "must": [
            {
              "percolate": {
                "field": "query",
                "document_type": "doc_type",
                "type": "doc_type",
                "id": doc_id_for_scoring,
                "index": "index_name"
              }
            }
          ]
        }
      },
      "from": 0,
      "size": 10
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-13
      相关资源
      最近更新 更多