1. 程式人生 > 實用技巧 >elasticsearch 基本查詢語句

elasticsearch 基本查詢語句

GET /_cat/indices?v


DELETE /logstash-2020.07.16?pretty


GET /logstash-2020.07.16/_search
{

  "query": { "match_all": {} },

  "size":1

}


GET /logstash-2020.07.14/_search
{
    "query": {
      "match": {
        "userID": "3482"
      }
    },
      "sort": { "@timestamp": { "order": "desc" }}

}

GET /logstash-2020.07.14/_search
{
  
"query":{ "constant_score": { "filter": { "range": { "datetime.keyword": { "format": "yyyy-MM-dd hh:mm:ss", "gte":"2019-03-10 00:12:00", "lt": "2019-03-16 00:12:00" } } }, "boost": 1.2 } }, "sort": { "datetime.keyword
": { "order": "desc" }} } GET /logstash-2020.07.14/_search { "query":{ "range": { "@timestamp": { "gte": "2020-07-11T07:07:38.155Z", "lte": "2020-07-16T07:20:38.155Z" } } } } GET /logstash-2020.07.14/_search { "query":{ "range": { "datetime.keyword": { "gte
": "2019-03-10 00:00:00", "lte": "2019-03-16 00:0:00" } } } } GET /logstash-2020.07.16/_search { "query": { "bool": { "must": [{"match": {"userID": "768445"}}], "filter": [ {"range": { "datetime.keyword": { "gte": "2020-07-08 00:00:00", "lte": "2020-07-20 00:00:00" } }} ] } } , "_source": {"excludes": ["agent","tags","input","log","@version","host","ecs"]}, "sort": { "datetime.keyword": { "order": "desc" }} } GET /logstash-2020.07.14/_mapping POST /_analyze/?pretty { "analyzer": "ik_smart", "text": "我愛北京天安門" } GET /_analyze { "text":"農業銀行" }