1.查询索引信息
GET /blog5
- 查询索引mapping信息
GET /blog5/_mapping
- 匹配查询
GET /blog5/_search
{
"query": {
"match": {
"content": "你"
}
},
"size": 20
}
4.字典查询
GET /blog5/_search
{
"query": {
"term": {
"content": {
"value": "你"
}
}
}
}
5.bool查询
关键词 | 描述 |
---|---|
must | 查询的结果必须匹配查询条件,并计算score |
filter | 查询的结果必须匹配查询条件,和must不同不会计算score |
should | 查询结果必须符合查询条件中的一个或多个 |
must_not | 查询结果必须不符合查询条件 |
6.match查询和term查询区别。
关键词 | 描述 |
---|---|
match | 对查询的字段切词查询 |
term | 不切词精准查询 |
7.aggs聚合查询(相当于group by)
GET /blog5/_search
{
"query": {
"term": {
"cid": {
"value": "2"
}
}
},
"aggs": {
"classification": {
"terms": {
"field": "cid"
}
}
}
}