gpt4 book ai didi

elasticsearch - 查询字符串搜索不起作用

转载 作者:行者123 更新时间:2023-12-02 22:23:19 27 4
gpt4 key购买 nike

嗨,我正在使用未分析的字段

但是当我使用以下查询进行搜索时

 "query": {
"query_string": {
"query": "06H121605E",
"default_field": "invoiceID"
}
}
}

我得到2个结果文件

但是当我寻求通配符时

它给我的点击为空
 "query": {
"query_string": {
"query": "06H121605*",
"default_field": "invoiceID"
}
}

这是我对invoiceID字段的映射
 "invoiceID": {
"type": "string",
"index": "not_analyzed"
},

查询:
GET ordersdetails/_search
{
"size": 1000,
"query": {
"query_string": {
"query": "06H121605E\\*",
"default_field": "invoiceID",
"analyze_wildcard": true
}
}
}

输出值
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

最佳答案

对于5.2.1版,您的查询可以正常使用:

{
"query": {
"query_string" : {
"query" : "06H121605*",
"default_field": "invoiceID",
"analyze_wildcard": true
}
}
}

这里是引用:

Documentation query string

关于elasticsearch - 查询字符串搜索不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42787279/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com