嘿~ 今天天气不错嘛

关于elasticsearch API 方法 regexpQuery正则匹配结果问题

Elasticsearch | 作者 solike8 | 发布于2020年04月27日 | 阅读数:2853

当我匹配"2019.*"时可以匹配到以2019开头的所有数据
regexpQuery("last_update_string_time", "2019*")));
当我以"2019-04.*"却匹配为空,期间也试过转义字符"2019\\-04.*"(本人ubuntu电脑转义为\\)
 
elasticsearch 中被正则的字段为keyword,具体如下
"last_update_string_time": "2019-03-26 18:51:05"
已邀请:

solike8 - 95后,挨打男

赞同来自:

有没有前辈试过为什么!!!

solike8 - 95后,挨打男

赞同来自:

问题已经在官网找到
The regexp query allows you to use regular expression term queries. See Regular expression syntax for details of the supported regular expression language. The "term queries" in that first sentence means that Elasticsearch will apply the regexp to the terms produced by the tokenizer for that field, and not to the original text of the field.

solike8 - 95后,挨打男

赞同来自:

此贴终结

要回复问题请先登录注册