es根据条件删除数据备份索引等操作
1.删除索引数据POST /索引名称/_delete_by_query{"query": {"bool": {"must_not": [{"match": {"test": "字段值"}}]}}...
1.删除索引数据
POST /索引名称/_delete_by_query
{
"query": {
"bool": {
"must_not": [
{
"match": {
"test": "字段值"
}
}
]
}
}
}
2.从一个索引数据导入另一个索引里
POST _reindex
{
"source": {
"index": "test_20201207",
"size":5000
},
"dest": {
"index": "test_20201208"
}
}
3.查询索引结构
GET /索引名称/_mapping?pretty
4.查询索引数据
GET /索引名称/_search
5.创建模板
curl -H "Content-Type: application/json" -XPUT "ip:9201/_template/模板名称?pretty" -d '{
"template" : "模板名称*",
"settings" : {
"number_of_shards" : 10,
"number_of_replicas" : 1,
"index.max_result_window": 1000000000
},
"mappings" : {
"properties" : {
"test1" : {
"type" : "keyword"
},
"test2" : {
"type" : "long"
}
}
}
}'
6.增加或更新数据
PUT /_bulk
{"index":{"_index" : "索引名称","_type" : "_doc","_id" : "1189866394802000"}}
{"test1": "12345", "test2": "889999"}
7.删除索引
DELETE /索引名称
8.修改索引的字段值
POST /索引名称/_update_by_query
{
"query": {
"bool": {
"must": [
{
"match": {
"status": "1"
}
}
]
}
},
"script": {
"inline": "ctx._source['major'] = 'net';ctx._source['com_name'] = 'lisi'"
}
}
更多推荐
所有评论(0)