elasticsearch - 为什么_explain返回的文档匹配:_search不返回true?

标签 elasticsearch

我正在努力解决以下Elasticsearch问题:

使用以下主体获取/myindex/mytype/_search:

{
  "query": {
    "bool": {
      "should": [
        {
          "prefix": {
            "name": "attorneys"
          }
        },
        {
          "multi_match": {
            "query": "attorneys",
            "type": "most_fields",
            "fields": [
              "name^2",
              "description"
            ]
          }
        },
        {
          "nested": {
            "boost": 2.0,
            "path": "categories",
            "score_mode": "sum",
            "query": {
              "bool": {
                "should": [
                  {
                    "match": {
                      "categories.name": {
                        "fuzziness": 10,
                        "query": "attorneys"
                      }
                    }
                  },
                  {
                    "term": {
                      "categories.name": "attorneys"
                    }
                  }
                ]
// ...closing brackets trimmed for conciseness

不会返回ID = 10007的文档。

但是,具有完全相同的查询正文的GET /myindex/mytype/10007/_explain返回:

{
  "_index": "vendors",
  "_type": "vendor",
  "_id": "10007",
  "matched": true,
  "explanation": {
    "value": 0.26991397,
    "description": "product of:",
    "details": [
      {
        "value": 0.8097419,
        "description": "sum of:",
        "details": [
          {
            "value": 0.8097419,
            "description": "Score based on child doc range from 304 to 304"
          }
        ]
      },
      {
        "value": 0.33333334,
        "description": "coord(1/3)"
      }
    ]
  }
}

为什么_explain返回"matched": true_query不返回
文件?

最佳答案

您的查询匹配多少个结果?由于您未指定from / size,因此默认值为返回前10个结果。也许文档10007来得晚。

关于elasticsearch - 为什么_explain返回的文档匹配:_search不返回true?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30224865/

相关文章:

elasticsearch - 从应用程序使用Kibana View 查询

onFailure 中的 Elasticsearch 错误处理(异步请求)

elasticsearch - 存储桶脚本不起作用-Elasticsearch 2.4.2

ElasticSearch extended_bounds 最小最大

elasticsearch - Elasticsearch:通过嵌套对象查询查找内部命中

elasticsearch - ElasticSearch:如何使用edge_ngram并具有真正相关的匹配项以首先显示

elasticsearch - 是否可以使用 ElasticSearch 别名写入多个索引?

elasticsearch - Elasticsearch对嵌套字段的不同计数

elasticsearch - 更改多个文档字段在ES 2.3.3中不起作用

elasticsearch - Elasticsearch不允许使用括号将字段名称用于脚本