kibana执行es请求

两种查询方式

GET bank/_search?q=*&sort=account_number:desc

GET bank/_search
{
  "query": {
    "match_all": {}
  },
  "sort": [
    {
      "account_number": {
        "order": "asc"
      }
    }
  ]
}

参数解释:
q=*:查询所有;
sort=account_number:desc:按照account_number的降序;
"query": {
"match_all": {}
}:匹配所有;
image

其他用法

取出5条数据(from:从第1条开始,size:取5条;从0开始)
image
返回部分字段

GET bank/_search
{
  "query": {
    "match_all": {}
  },
  "sort": [
    {
      "account_number": {
        "order": "asc"
      }
    }
  ],
  "from": 0,
  "size": 5,
  "_source": ["balance","firstname"]
}

image
精确匹配
image
全文匹配,只要包含了指定字符串,都会查出来
image
只要包含了mill lane,任意一个单词都可以查出来,由得分可知,第一个最匹配,其他都是包含了一个;
image
image
短语匹配查询,必须同时包含
image
多字段匹配(address和city包含mill的(只要有一个字段包含就行)都查出来)
image
image
多条件同时必须满足must,不满足是must_not

GET bank/_search
{
  "query": {
    "bool": {
      "must": [
        {"match": {
          "gender": "M"
        }},
        {
          "match": {
            "address": "mill"
          }
        }
      ],
      "must_not": [
        {"match": {
          "age": "38"
        }}
      ]
    }
  }
}

should用法,满足了条件更好,不满足也可以
image
image

原文地址:https://www.cnblogs.com/kaka-qiqi/p/14757133.html