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"
}
}
]
}
}
}