您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch通配符*
发布时间:2021-08-23 15:51:03编辑:雪饮阅读()
ElasticSearch关于_all是用来匹配所有的索引的,这个是上篇中学习的内容。那么对于通配符在elasticSearch的应用,就拿*来说,他可以匹配例如以某个前缀的的索引,例如下面这个请求
http://localhost:9200/school*/_search post
这里相当于匹配了所有school为前缀的索引,那么像是前面我们的schools和schools2以及schools_gov这些索引也都是可以匹配到的。
那么请求体假比是:
{
"query":{
"query_string":{
"query":"CBSE"
}
}
}
则这里是在上面匹配的结果中在检索下CBSE单词。
那么一个响应结果如:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": 1.0417082,
"hits": [
{
"_index": "schools",
"_type": "school",
"_id": "1",
"_score": 1.0417082,
"_source": {
"name": "Central School",
"description": "CBSE Affiliation",
"street": "Nagan",
"city": "paprola",
"state": "HP",
"zip": "176115",
"location": [
31.8955385,
76.8380405
],
"fees": 2000,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3.5"
}
},
{
"_index": "schools2",
"_type": "school",
"_id": "1",
"_score": 1.0417082,
"_source": {
"name": "Central School",
"description": "CBSE Affiliation",
"street": "Nagan",
"city": "paprola",
"state": "HP",
"zip": "176115",
"location": [
31.8955385,
76.8380405
],
"fees": 2000,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3.5"
}
},
{
"_index": "schools_gov",
"_type": "school",
"_id": "1",
"_score": 0.7549127,
"_source": {
"name": "Model School",
"description": "CBSE Affiliation",
"street": "silk city",
"city": "Hyderabad",
"state": "AP",
"zip": "500030",
"location": [
17.3903703,
78.4752129
],
"fees": 200,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3"
}
}
]
}
}
关键字词:elasticSearch,*,通配符
相关文章
- elasticSearch的_all查询关键字(在所有索引中查询)
- 完全群集重新启动与滚动升级以及elasticSearch多索引
- elasticSearch安装及配置elasticSearch默认对外端口
- windows下使用elasticSearch-head为elasticSearch进行
- windows下使用elasticSearch-head为elasticSearch创建
- 配置elasticSearch-head连接elasticSearch服务
- 配置安装elasticSearch-head
- elasticSearch创建映射和添加数据(_bulk批处理)
- elasticSearch创建没有正文的空索引
- elasticSearch无需查询即可进行过滤(match_all、分数