查询所有 type | curl localhost:9200/_mapping?pretty=true |
---|---|
查询所有index | curl localhost:9200/_cat/indices?v |
如果要对字段进行term查询,字段需要时keyword
查询 index 为 card* 的所有数据
GET /card*/_search
{
"query": {
"match_all": {}
}
}
term
GET _search
{
"query": {
"term": {
"targetUserId": {
"value": "7810906108ed42e1914aaaa44505f070",
"boost": 1
}
}
}
}
bool
GET _search
{
"query": {
"bool": {
"must": [
{
"term": {
"targetUserId": {
"value": "7810906108ed42e1914aaaa44505f070",
"boost": 1
}
}
}
]
}
}
}
分桶
GET /es-customer/_search
{
"size" : 0,
"aggs" : {
"days" : {
"date_histogram": {
"field": "createTime",
"interval": "day"
},
"aggs": {
"distinct_name" : {
"cardinality" : {
"field" : "firstName"
}
}
}
}
}
}
删除 index
DELETE /card*
备份时候用到的指令
GET _search
{
"query": {
"match_all": {}
}
}
GET _cat/indices/*
GET test_customer1*/_mapping
GET test_customer1*/_search
{
"query": {"match_all": {}}
}
DELETE /test_**
PUT _snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "D:\\my-program\\elasticsearch-6.3.2\\backup",
"compress": true
}
}
PUT _snapshot/my_backup/snapshot_3
{
"indices": "test_customer1*"
}
POST _snapshot/my_backup/snapshot_3/_restore
GET _snapshot/my_backup/_all?pretty
DELETE _snapshot/my_backup/snapshot_3
网友评论