ES查询distinct、in、between
mysql的 count ( distinct (uuid)) 在ES中使用 aggs 和 cardinalityGET log/_search{"size": 0,"aggs": {"count": {"cardinality": {"field": "uuid"}}}}//返回结果{……"aggregations" : {"count" : {"value" : 277
·
mysql的 count ( distinct (uuid)) 在ES中使用 aggs 和 cardinality
GET log/_search
{
"size": 0,
"aggs": {
"count": {
"cardinality": {
"field": "uuid"
}
}
}
}
//返回结果
{
……
"aggregations" : {
"count" : {
"value" : 277
}
}
}
mysql的 IN(1,2,3) 和 BETWEEN 1 AND 10在ES中使用 terms 和 range
GET log/_search
{
"_source": ["phone","uuid"],
"query": {
"bool": {
"filter": [
{
"terms": {
"phone": [
"18694063829",
"13324543534"
]
}
},
{
"range": {
"createdate": {
"gte": "2020-01-01 00:00:00",
"lte": "2022-01-01 00:00:00"
}
}
}
]
}
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)