ES常用操作
查询所有索引
curl 'localhost:9200/_cat/indices?v'
查询索引下的所有数据
如索引值为:index
curl 'localhost:9200/index/_search
查询日期范围
"range" : {
"timestamp" : {
"gt" : "2014-01-01 00:00:00",
"lt" : "2014-01-07 00:00:00"
}
}
查询字段等于某个值的记录
例如查询,字段日期pdate,格式为:yyyyMMdd
查找2019年10月1号到2019年10月15号:
{
"query"{
"match":{
"name":"lcc"
}
}
}
查询某个值的范围
例如查询,字段日期pdate,格式为:yyyyMMdd
查找2019年10月1号到2019年10月15号:
{
"query"{
"bool":{
"must":[{
"range" : {
"pdate" : {
"gte" : "20191001",
"lt" : "20191001"
}
}
}]
}
}
}