Elasticsearch常用脚本

1、检测集群是否健康。 确保9200端口号可用

GET http://192.168.251.7:9200/_cat/health?v

curl http://192.168.251.7:9200/_cat/health?v

2、获取集群的节点列表

GET http://192.168.250.101:9200/_cat/nodes?v

3、列出所有索引

GET http://192.168.251.7:9200/_cat/indices?v

4、添加索引

在管理平台手动添加

5、添加文档

PUT http://192.168.250.101:9200/telnum_fee_index/_mapping/telnum_fee_type

{
"properties": {
"id": {
"type": "keyword"
},
"enterpriseCode": {
"type": "keyword"
},
"createTime": {
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
"type": "date"
},
"price": {
"type": "double"
},
"fee": {
"type": "double"
},
"num": {
"type": "integer"
},
"servicerName": {
"type": "keyword"
},
"servicerId": {
"type": "keyword"
},
"startTime": {
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
"type": "date"
},
"updateTime": {
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
"type": "date"
},
"endTime": {
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
"type": "date"
},
"enterpriseName": {
"type": "keyword"
}
}
}

6、index追加字段

PUT http://192.168.251.7:9200/call_record_index/_mapping/call_record_type

{
"properties": {
"serverFee": {
"type": "double"
},
"platFee": {
"type": "double"
}
}
}

7、设置ES最大每页数据


PUT  http://192.168.250.101:9200/telnum_fee_index/_settings

{ 
"index": { 
"max_result_window": 10000000 
} 
}

猜你喜欢

转载自blog.csdn.net/jiahao1186/article/details/81058050