ES DSL Search-Query All and Pagination

1 Introduction

Mainly introduce the basic API operation of index request, use postman to make the request, the prefix address of the interface request is unified as the elasticsearch deployment IP address + port number (for example, http://192.168.51.4:9200.

2 Query all documents

match_all

Query all documents in the index

2.1 GET query

GET /search_demo/_doc/_search

2.2 POST query

2.2.1 postman request

  • _source: You can specify the field column to be queried, and the default query that is not specified is all
{
    
    
    "query": {
    
    
        "match_all": {
    
    }
    },
    "_source": [
        "id",
        "nickname",
        "age"
    ]
}

2.2.2 Head visualization operation

Insert picture description here

3 Paging query

3.1 postman request

The default query is only 10 records, which can be displayed through custom pagination

  • from: the starting record to be queried
  • size: step size, the number to be queried, that is, the size of each page
{
    
    
    "query": {
    
    
        "match_all": {
    
    }
    },
    "_source": [
        "id",
        "nickname",
        "age"
    ],
    "from": 0,
    "size": 10
}

3.2 Head visualization operation

Insert picture description here

4 Related information

  • The blog post is not easy, everyone who has worked so hard to pay attention and praise, thank you

Guess you like

Origin blog.csdn.net/qq_15769939/article/details/114517762