小编Ayu*_*mar的帖子

无法为 ElasticSearch 编写通配符查询?

我在使用通配符时遇到问题。每当我尝试使用通配符查找数据时,它都会返回错误

ES中的数据集如下所示:

   "hits": {
      "total": 1000,
      "max_score": 1,
      "hits": [
         {
            "_index": "accounts",
            "_type": "data",
            "_id": "25",
            "_score": 1,
            "_source": {
               "account_number": 25,
               "balance": 40540,
               "firstname": "Virginia",
               "lastname": "Ayala",
               "age": 39,
               "gender": "F",
               "address": "171 Putnam Avenue",
               "employer": "Filodyne",
               "email": "virginiaayala@filodyne.com",
               "city": "Nicholson",
               "state": "PA"
            }
         }
Run Code Online (Sandbox Code Playgroud)

我使用以下查询:

GET /_search
{
    "query":{       
    "filtered" : {
      "filter" : {
        "bool" : {
          "should" :
          {
            "match":{
            "wildcard":{"lastname" : "Aya*" }
            }
          }      
        }
      }
    }
    }
}
Run Code Online (Sandbox Code Playgroud)

但它抛出以下错误:

{
   "error": { …
Run Code Online (Sandbox Code Playgroud)

wildcard match elasticsearch

2
推荐指数
1
解决办法
3783
查看次数

标签 统计

elasticsearch ×1

match ×1

wildcard ×1