首页 归档 关于 文件 Github
×

ElasticSearch下的Kibana的使用 - 别名(视图)

2022-03-02 15:23:37
ElasticSearch
  • Kibana
本文总阅读量(次):
本文字数统计(字):331
本文阅读时长(分):1

作用

能非常优雅的解决两个索引无缝切换的问题;

创建(add)、删除(remove)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
POST /_aliases
{
"actions": [
{
"add": {
"index": "my_index",
"alias": "my_index_v1"
}
},
{
"remove": {
"index": "my_index",
"alias": "my_index_v1"
}
}
]
}

读写

当索引别名指向多个索引时,进行写操作,其中的一个索引必须被指定为写索引,并且只能指定一个,否则则无法写入。
is_write_index:默认为false;需要有且仅设置一个为true;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
POST /_aliases
{
"actions": [
{
"add": {
"index": "my_index_1",
"alias": "my_index_v2",
"is_write_index" : true
}
},
{
"add": {
"index": "my_index_2",
"alias": "my_index_v2",
"is_write_index" : false
}
}
]
}

复制

将索引【my_index_1】的数据复制到【my_index_2】的索引上;会根据数据的大小,消耗的时间不等;
注意:假如【my_index_2】本身已有数据,“_index”,“_type”,“_id”等值的不同,都是会造成有重复数据存在的因素;

1
2
3
4
5
6
7
8
9
POST /_reindex
{
"source": {
"index": "my_index_1"
},
"dest": {
"index": "my_index_2"
}
}

示例

创建结构一样索引: my_index_1,my_index_2;

1
2
3
4
5
6
7
8
9
10
11
12
PUT /my_index
{
"mappings": {
"_doc": {
"properties": {
"user_id": {
"type": "integer"
}
}
}
}
}

按照 is_write_index=true 的设置,当POST数据的时候,会写到索引为 my_index_1 内容,根据索引查询结果:
20220303140424

更改 is_write_index=true 的设置,当POST数据的时候,会写到索引为 my_index_2 内容,根据索引查询结果:
20220303140952

完
ElasticSearch的数据类型
ElasticSearch下的Kibana的使用 - 增删改查

本文标题:ElasticSearch下的Kibana的使用 - 别名(视图)

文章作者:十二

发布时间:2022-03-02 15:23:37

最后更新:2022-03-04 18:39:27

原始链接:https://www.zhuqiaolun.com/2022/03/1646205817389/1646205817389/

许可协议:署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

头像

十二

我想起那天夕阳下的奔跑,那是我逝去的青春。

分类

  • Blog4
  • ElasticSearch13
  • Freemarker2
  • Git2
  • Go-FastDfs2
  • IDEA2
  • J-Package6
  • J-Tools21
  • Java2
  • JavaFx3
  • Kafka4
  • Linux2
  • Logger5
  • Maven5
  • MyBatis6
  • MyCat3
  • MySql2
  • Nginx5
  • OceanBase1
  • RabbitMq4
  • Redis6
  • SVN1
  • SpringBoot11
  • Tomcat6
  • WebService2
  • Windows2
  • kubernetes10

归档

  • 二月 20251
  • 十二月 20244
  • 八月 202416
  • 六月 20241
  • 九月 20231
  • 八月 20231
  • 七月 20232
  • 八月 20222
  • 三月 202214
  • 二月 20224
  • 十一月 20211
  • 七月 20215
  • 六月 20213
  • 五月 20213
  • 四月 20211
  • 三月 202116
  • 二月 20212
  • 一月 20211
  • 十一月 202014
  • 十月 20201
  • 九月 202014
  • 八月 20205
  • 七月 20204
  • 六月 20208
  • 五月 20208

作品

我的微信 我的文件

网站信息

本站运行时间统计: 载入中...
本站文章字数统计:96.9k
本站文章数量统计:132
© 2025 十二  |  鄂ICP备18019781号-1  |  鄂公网安备42118202000044号
驱动于 Hexo  | 主题 antiquity  |  不蒜子告之 阁下是第个访客
首页 归档 关于 文件 Github