目录
  1. 1. 用逗号将索引隔开
    1. 1.1. 通配符
    2. 1.2. 数学表达式风格
ES多索引

用逗号将索引隔开

如:

1
$ curl -XPOST http://localhost:9200/aaa,website/_search/

结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
"took":  1,
"timed_out":  false,
"_shards":  {
"total":  10,
"successful":  10,
"failed":  0
},
"hits":  {
"total":  5,
"max_score":  1,
"hits":  [{
"_index":   "website",
"_type":   "blog",
"_id":   "123",
"_score":  1,
"_source":  {
"title":   "My first blog entry",
"text":   "Just trying this out...",
"date":   "2014/01/01"
}
},
{
"_index":   "website",
"_type":   "blog",
"_id":   "AVbkih8AltSLRRB7XAun",
"_score":  1,
"_source":  {
"title":   "TestTitle",
"text":   "text",
"date":   "2016/09/01"
}
},
{
"_index":   "website",
"_type":   "blog",
"_id":   "AVbf1AtSyvALLDk8cjpY",
"_score":  1,
"_source":  {
"title":   "My 3 blog entry",
"text":   "Still trying this out...",
"date":   "2014/01/01"
}
},
{
"_index":   "aaa",
"_type":   "aaa",
"_id":   "AVcCopjQzgrwoUDkEMu3",
"_score":  1,
"_source":  {
"str1":   "hello",
"str2":   "world"
}
},
{
"_index":   "aaa",
"_type":   "aaa",
"_id":   "AVcCogrMzgrwoUDkEMu2",
"_score":  1,
"_source":  {
"str1":   "hello, world!",
"str2":   "goodbye! world"
}
}
]
}
}

通配符

elasticsearch还支持使用统配的风格,如使用*匹配任意字符。

数学表达式风格

最后可以通过add(+)添加一个索引,使用remove(-)去掉一个索引。

文章作者: 李浩
文章链接: https://leehoward.cn/2019/10/16/ES多索引/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 leehoward
打赏
  • 微信
  • 支付宝

评论