ES 简单查询
1 : 查询所有
GET /roc_test_index/_search
{
"query":{
"match_all":{}
}
}
2 : 模糊查询
GET /roc_test_index/search
{
"query":{
"match":{
"name":"木"
}
}
}
3 : 中文短语模糊查询 , 只会匹配到包含 "木头"的数据
GET /roc_test_index/search
{
"query":{
"match_phrase":{
"name":"木头"
}
}
}
4 : in 查询 , 包含
GET /roc_test_index/search
{
"query":{
"bool":{
"must":[
{
"terms":{
"tags":["tags1","tags2"]
}
}
]
}
}
}
5 : 范围查询
GET /roc_test_index/_search
{
"_source":"number",
"query": {
"bool": {
"must": [
{
"range": {
"createTime": {
"gte": "2019-12-23",
"lte": "2019-12-24"
}
}
}
]
}
}
}