# 常用查询

# 查询所有

GET tk_question_test/_search
{
  "query": { "match_all": {} },
  "sort": [
    { "create.time": "desc" }
  ]
}
1
2
3
4
5
6
7

# 分页查询

GET tk_question_test/_search
{
  "size": 1,
  "from": 0,
  "query": { "match_all": {} },
  "sort": [
    { "create.time": "desc" }
  ]
}
1
2
3
4
5
6
7
8
9

# 单字段查询

GET tk_question_test/_search
{
  "query": {
    "match": {
      "uuid": "34d24674-9c47-4b44-b383-c9dc4022857b"
    }
  }
}
1
2
3
4
5
6
7
8

# 多字段查询

GET tk_question_test/_search
{
  "size": 1,
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "phase": "3"
          }
        },
        {
          "match": {
            "subject": "31"
          }
        },
        {
          "match": {
            "status": "1"
          }
        }
      ]
    }
  }

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

# 模糊查询

GET tk_question_test/_search
{
  "size": 10,
  "from": 0,
  "query": {
    "match": {
      "structure.txt": "在一次摸取奖票的活动中,已知中奖的概率为2%,若票仓中有足够多的票则下列说法正确的是(  )"
    }
  }
}
1
2
3
4
5
6
7
8
9
10
更新时间: 2021-04-28 09:24:43