ElasticSearch模糊过滤器查询不匹配

时间:2016-07-28 16:55:58

标签: elasticsearch-2.0

请向我解释以下问题:

模糊0查询不匹配。为什么呢?

我有映射:

$ curl -XGET 'http://localhost:9200/words/_mapping?pretty'
{
  "words" : {
    "mappings" : {
      ".percolator" : {
        "properties" : {
          "category" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "fuzziness" : {
            "type" : "long"
          },
          "list" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "query" : {
            "type" : "object",
            "enabled" : false
          }
        }
      },
      "query_doc" : {
        "properties" : {
          "category" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "text" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

我有过滤器查询:

$ curl 'http://localhost:9200/words/.percolator/_search?pretty=true&q=*:*'
{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "words",
      "_type" : ".percolator",
      "_id" : "id4_0",
      "_score" : 1.0,
      "_source" : {
        "query" : {
          "fuzzy" : {
            "text" : {
              "fuzziness" : 0,
              "value" : "Banes"
            },
            "category" : "cuba"
          }
        }
      }
    }, {
      "_index" : "words",
      "_type" : ".percolator",
      "_id" : "id4_1",
      "_score" : 1.0,
      "_source" : {
        "query" : {
          "fuzzy" : {
            "text" : {
              "fuzziness" : 1,
              "value" : "Banes"
            },
            "category" : "cuba"
          }
        }
      }
    } ]
  }
}

当我运行percolate查询时,只有模糊1的查询匹配:

$ curl 'http://localhost:9200/words/query_doc/_percolate?pretty' -d '
{
    "doc": {
        "text": "Just Banes"
    }
}'
{
  "took" : 2,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "total" : 1,
  "matches" : [ {
    "_index" : "words",
    "_id" : "id4_1"
  } ]
}

有什么问题?有人可以解释一下吗?

由于

0 个答案:

没有答案