后续会不断更新
"query" : {
"match_all" : {}
}
查询全部数据 "query" : {
"match" : {
”title" : "干饭" }
}
根据一定规则,查询和干饭有关的数据 ”from"
分页开始的位置 “size" 分页展示的长度 ”sort" : {
"price" : {
"order" : "desc"
}
}
根据order降序展示数据 "query" : {
"bool" : {
"must" : [
{
"match" : {
"category" : "小米"
}
},
{
"match" : {
"price" : 1999.00
}
}
]
}
}
必须要category为小米,price为1999.00 {
"query" : {
"bool" : {
"should" : [
{
"match" : {
"category" : "小米"
}
},
{
"match" : {
"category" : "华为"
}
}
]
}
}
}
两种符合条件,并且算法是查询有关数据 {
"query" : {
"bool" : {
"filter" : {
"range" : {
"price" : {
"gt" : 5000
}
}
}
}
}
}
查询价格超过5000 {
"properties" : {
"name" : {
"type" : "text",
"index" : true
},
"sex" : {
"type" : "keyword",
"index" : true
},
"tel" : {
"type" : "keyword",
"index" : false
}
}
}
设置映射,
1.name设置为可以通过倒排索引进行查询。
2.sex设置为精准查询
3.tel设置为不能通过tel进行查询