postman对ES的交互

Get 查看所有索引

localhost:9200/_all

PUT 创建索引-test

localhost:9200/test  


DEL 删除索引-test

localhost:9200/test  


PUT 创建索引-person-1

localhost:9200/person


PUT 新增数据-person-1

localhost:9200/person/_doc/1

{
    "first_name" : "John",
  "last_name" : "Smith",
  "age" : 25,
  "about" : "I love to go rock climbing",
  "interests" : [ "sports", "music" ]
}

PUT 新增数据-person-2

localhost:9200/person/_doc/2

{
    "first_name" : "Eric",
  "last_name" : "Smith",
  "age" : 23,
  "about" : "I love basketball",
  "interests" : [ "sports", "reading" ]
}

GET 搜索数据-person-id

localhost:9200/person/_doc/1

GET 搜索数据-person-name

localhost:9200/person/_doc/_search?q=first_name:john

{
  "took": 56,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 0.6931472,
    "hits": [
      {
        "_index": "person",
        "_type": "_doc",
        "_id": "1",
        "_score": 0.6931472,
        "_source": {
          "first_name": "John",
          "last_name": "Smith",
          "age": 25,
          "about": "I love to go rock climbing",
          "interests": [
            "sports",
            "music"
          ]
        }
      }
    ]
  }
}

 

posted on 2020-07-24 15:11  lidongsheng  阅读(2471)  评论(0编辑  收藏  举报

导航