【发布时间】:2016-12-14 17:17:32
【问题描述】:
我正在尝试将范围查询与 elasticsearch 一起使用
{
"query": {
"range": {
"order_no": {
"gte": "VM-0001",
"lte": "VM-0005"
}
}
}
}
但是弹性没有返回结果。我发现系统存在字符串问题,包括 - 或 _
这是该字段的映射:
"order_no" : {
"type" : "string",
"index_analyzer" : "str_index_analyzer",
"search_analyzer" : "str_search_analyzer"
}
{
"analysis": {
"analyzer": {
"str_search_analyzer": {
"tokenizer": "keyword",
"filter": [
"lowercase"
]
},
"str_index_analyzer": {
"tokenizer": "keyword",
"filter": [
"lowercase",
"substring"
]
}
},
"filter": {
"substring": {
"type": "nGram",
"min_gram": 1,
"max_gram": 20
}
}
}
}
【问题讨论】: