All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Query data

Last updated:2022-01-11 13:43:17

Create an index

In the Kibana console, create an index named school with a type named student. Create the following four fields for this index: name, address, age, and date. For more information about field types, see the official document Field Datatypes. image.png

PUT school
{
  "settings":{
    "number_of_shards": 3,   
    "number_of_replicas": 1 
  },
  "mappings":{
    "student":{
      "properties":{
        "name":{
          "type":"text"
        },
        "address":{
          "type":"keyword"
        },
        "age":{
          "type":"integer"
        },
        "date":{
          "type":"date",
          "format":"yyyy-MM-dd HH:mm:ss"
        }
      }
    }
  }
}

Create a document and insert data

If "errors" : false is returned, data is successfully inserted. image.png

POST /school/student/_bulk
{"index":{}}
{"name":"Zhang San","address":"Jinan, Shandong","age":"22","date":"2020-01-19 08:10:00"}
{"index":{}}
{"name":"Li Si","address":"Haidian District, Beijing","age":"21","date":"2020-02-19 09:00:00"}
{"index":{}}
{"name":"Wang Wu","address":"Changchun, Jilin","age":"23","date":"2020-02-19 10:00:00"}

Query data

image.png

GET /school/_search
{
  "query": {
    "match": {
      "address": "Haidian District, Beijing
    }
  }
}
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback