欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

es入门1

程序员文章站 2022-07-05 13:59:39
...
入门sql


DELETE testindex

PUT testindex

GET testindex

GET testindex/perdata/_search
{
  "query": {
    "match_all": {}
  }
}


POST testindex/perdata/1
{
   "name": "TOM",
   "nick_name": "happy tom"
}

POST testindex/perdata/2
{
  "name": "JERRY",
  "nick_name": "happy jerry. high"
}

PUT testindex/perdata/3
{
  "name": "TOM TWO",
  "nick_name": "happy tom. I am two"
}

POST testindex/perdata/4
{
  "name": "TOM4",
  "nick_name": "happy tom. I am 4"
}

PUT testindex/perdata/5
{
  "name": "TOM TWO",
  "address": "shanghai pudong"
}

POST testindex/perdata
{
  "name": "TOM3",
  "nick_name": "happy tom. I am 3",
  "address": "shanghai pudong new area"
}

DELETE testindex/perdata/WGQ0o2kBFrrH_L6C6Lc6


GET testindex/perdata/1


PUT testindex/perdata/4
{
  "name": "TOM4 change",
  "nick_name": "happy tom. I am 4 chaneg"
}


POST testindex/perdata/4
{
  "name": "TOM4 change",
  "nick_name": "happy tom. I am 4 chaneg",
  "address": "tom address"
}

GET testindex/perdata/_search

GET testindex/perdata/_search
{
  "query": {
   "match_all": {
   }
  }
}

GET testindex/perdata/_search
{
  "query": {
   "match_all": {
   }
  },
  "size": 2,
  "from": 0
}

GET testindex/perdata/_search
{
  "query": {
   "match": {
       "name":"TOM"
   }
  }
}

GET testindex/perdata/_search
{
  "query": {
   "match": {
       "name":"TOM"
   }
  },
  "size": 2,
  "from": 2
}

// 如果有多个搜索关键字, Elastic 认为它们是or关系。
GET testindex/perdata/_search
{
  "query": {
   "match": {
       "name":"TOM TWO"
   }
  }
}
// 如果要执行多个关键词的and搜索,必须使用布尔查询。
GET testindex/perdata/_search
{
  "query": {
    "bool": {
      "must": [
       {
         "match": {
           "name":"TOM"
         }
       },
      { 
        "match": {
           "name":"TWO"
        }
      }
      ]
    }
  }
}



 

上一篇: ES6-入门

下一篇: ES6入门