## 精确匹配
<br>
> term 单个条件相等 (keyword代表不分词)
```
GET /user/_search
{
"query": {
"term": {
"name.keyword": "李四"
}
}
}
```
> terms 单个字段属于某个值数组内的值
```
GET /user/_search
{
"query": {
"terms": {
"name.keyword": ["李四","王五"]
}
}
}
```
> range 字段属于某个范围内的值(包含临界值)
```
GET /user/_search
{
"query": {
"range": {
"age": {
"gte": 24,
"lte": 28
}
}
}
}
```
> exists 某个字段的值是否存在,相当于 ``select * from user where gender is not null``
```
GET /user/_search
{
"query": {
"exists": {
"field": "gender"
}
}
}
```
> miss 某个字段的值是否缺失,相当于 ``select * from user where gender is null``
```
GET /user/_search
{
"query": {
"miss": {
"field": "gender"
}
}
}
```
> ids 通过ID批量查询
```
GET /user/_search
{
"query": {
"ids": {
"values": [1,2,3]
}
}
}
```