elasticsearch 查询语法
精选
原创
©著作权归作者所有:来自51CTO博客作者wx6406b4f21e40e的原创作品,请联系作者获取转载授权,否则将追究法律责任
GET test/_search
{
"query": {
"match_all": {}
}
}
GET test/_search
{
"query":{
"match":{
"name":"zhangsan"
}
}
}
GET test/_search
{
"query": {
"fuzzy": {
"data": "好"
}
},
"_source": ["name", "data"]
}
GET /test/_search
{
"query": {
"bool": {
"must": [
{
"exists": {
"field": "age"
}
},
{
"term": {
"id": {
"value": 45
}
}
}
]
}
}
}
GET /test/_search
{
"query": {
"bool": {
"must": [
{
"terms": {
"is_success": [1,2]
}
},
{
"term": {
"deleted": 0
}
}
]
}
},
"_source": [
"_id",
"name",
"stage"
],
"from": 0,
"size": 1000
}
GET test/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"customer_gmt_create_time": {
"order": "asc"
}
}
],
"from": 0,
"size": 10
}
GET test/_search
{
"query": {
"match_phrase_prefix": {
"name": "wang"
}
}
}
GET test/_search
{
"query": {
"bool": {
"should": [
{
"term": {
"age":27
}
},{
"term":{
"age":28
}
}
]
}
}
}
GET test/_search
{
"query": {
"ids": {
"values": ["66606794","66606795"]
}
}
}
GET test/_search
{
"query": {
"bool": {
"must": [
{
"range": {
"create_time": {
"gte": "2017-12-25 01:25:10",
"lte": "2017-12-25 12:10:36"
}
}
},
{
"bool": {
"should": [
{
"term": {
"name": {
"value": "zhangsan"
}
}
},
{
"term": {
"age": {
"value": 7
}
}
}
]
}
}
]
}
},
"_source": ["alarm_name","alarm_time","alarm_type","info"]
}