should must match 相当于or and =
多条件中must类似and,should类似or
查询
查询全部索引
条件查询
添加数据
删除索引
创建索引
查看所有索引
should 相当于 ormust 相当于 andmatch 相当于 =
GET _all : 查看所有
GET /index名/_doc(默认的type,6版本以后可省略)/id : 根据id查
根据指定条件查询:
should=or
must=and
match=like
#1
POST /person/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"first_name": "Eric"
}
}
]
}
}
}
新增数据-person
{"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "Hello world",
"interests" :["music","Sports"]}
ES条件查询(可省略_doc),should里可有多个match,相当于or语句,should改成must,就变成了and语句
POST /person/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"last_name": "Simth"
}
},
{
"match": {
"about": "love"
}
}
]
}
}
}
es根据主键查询:GET /person/_doc/1
should 相当于 or
must 相当于 and
match 相当于 =
{
"query":{
"bool":{
"should":[
{"match":{ "title":"标题"}
}]
}
}
}
好用
1111111