ES-查询语句说明

查询所有
命令:

GET fcy_trace_log/_search
{
  "query": {
    "match_all": {

    }
  }
}

结果

{
  "took": 5,    查询事件
  "timed_out": false,  是否超时
  "_shards": {
    "total": 2,    分片
    "successful": 2,    
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 16,    查询结果总数
    "max_score": 1,
    "hits": [
      {
        "_index": "fcy_trace_log",
        "_type": "fcy_trace_type",
        "_id": "9UTIF3IBIDm_yOFoO5VC",
        "_score": 1,
        "_source": {
          "operPath": "客户管理/新增页面/新增按1钮",
          "realName": "xxx",
          "system": "xxdkd",
          "tarceTime": "2020-05-15T18:01:36.865+08:00",
          "operation": "0",
          "userId": "10"
        }
      },

带参数查询:

GET fcy_trace_log/_search
{
  "query": {
    "match": {
      "realName": "xxx"   如果该字段支持全文检索则这样可以做到模糊查询效果,不然就是精确查询
    }
  }
}

分页查询:

GET fcy_trace_log/_search
{
  "query": {
    "match_all": {

    }
  },
  "from": 1,   第一页
  "size": 2      每页2条
}

你可能感兴趣的:(ES-查询语句说明)