尽管带有通配符的query_string有效,但通配符查询不会返回结果

时间:2017-09-21 10:51:17

标签: elasticsearch wildcard

鉴于此映射

"mappings": {
    "schools": { 
        "properties": {
            "autocomplete": {
                "type": "string"
            } 
            ...
        }
    }
}

此查询有效:

GET records-schools/_search
{
    "query": {
        "query_string": {
            "query": "my_*al",
            "default_field": "autocomplete",
            "analyze_wildcard": true
        }
    },
    "from": 0,
    "size": 10
}

但是这个,不是:

GET records-schools/_search
{
   "query": {
       "wildcard": {
           "autocomplete": "my_*al"
       }
   },
   "from": 0,
   "size": 10
}

虽然,如果我将上一个查询的值更改为简单的星号*就可以

为什么通配符查询不起作用?

注意:
ElasticSearch版本:2.4

0 个答案:

没有答案