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
|
curl 'http://localhost:9200/_cat/indices?v'
# 获取全部数据,默认只显示10条
curl -XGET 'http://localhost:9200/index-name/doc-type/_search?pretty'
# 根据ID查询数据
curl -XGET 'http://localhost:9200/index-name/doc-type/id?pretty'
# 查询条件,参数 q=
curl -XGET 'http://localhost:9200/megacorp/employee/_search?q=name:Smith'
curl -XGET 'http://localhost:29200/nginx_access/_search?q=x_forwarded_for:117.136.38.182&pretty'
# del index
curl -X DELETE "http://localhost:19200/indexName?pretty"'&timeout=5m'
# 时间范围数量统计
curl -XGET 'http://10.27.10.30:29200/cd-nginx-2020.11.01/_count?pretty' \
-H 'content-type: application/json' -d '
{
"query": {
"range":{
"@timestamp":{
"gte": "2020-11-01 10:00:00",
"lte": "2020-11-01 11:00:00",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd",
"time_zone": "+08:00"
}
}
}
}'
|