假设我通过简单地调用:
在ElasticSearch中创建索引PUT strings
然后我通过调用
来插入文档POST strings/string/<some_id>
{
"name": "some_string"
}
现在我想搜索包含字母&#39;的所有字符串,例如:
GET strings/string
{
"query": {
"regexp": {
"name": ".*s.*"
}
}
}
是的,这给了我想要的东西。不过,我从here读到Matching everything like .* is very slow as well as using look-around regular expressions.
问题是,我应该如何构建正则表达式以便做同样的事情,但性能更好?